using PetaPoco; using System; using System.Collections.Generic; using System.Linq; namespace Bootstrap.DataAccess { /// /// /// [TableName("ResetUsers")] public class ResetUser { /// /// 获得/设置 用户主键ID /// public string Id { get; set; } /// /// /// public string UserName { get; set; } /// /// /// public string DisplayName { get; set; } /// /// /// public string Reason { get; set; } /// /// /// public DateTime ResetTime { get; set; } /// /// /// /// public virtual bool Save() { DbManager.Create().Save(this); return true; } /// /// /// /// /// public virtual ResetUser RetrieveUserByUserName(string userName) => DbManager.Create().FirstOrDefault("where UserName = @0 order by ResetTime desc", userName); /// /// /// /// /// public virtual IEnumerable> RetrieveResetReasonsByUserName(string userName) => DbManager.Create().Fetch("where UserName = @0 order by ResetTime desc", userName).Select(user => new KeyValuePair(user.ResetTime, user.Reason)); } }