| | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public partial class LoginUserMain |
| | | public partial class UserLoginAccount |
| | | { |
| | | //获取缓存 |
| | | private static List<Model.LoginUserMain> GetCache() |
| | | private static List<Model.UserLoginAccount> GetCache() |
| | | { |
| | | #region Cache |
| | | |
| | |
| | | var model_list = Entity2Models(entity_list); |
| | | if (model_list == null) |
| | | { |
| | | model_list = new List<Model.LoginUserMain>(); |
| | | model_list = new List<Model.UserLoginAccount>(); |
| | | } |
| | | return model_list; |
| | | }, Yw.Service.ConfigHelper.CacheKeepTime, Yw.Service.ConfigHelper.CacheRandomTime); |
| | |
| | | public static void UpdateCacheByEmployeeID(long ID) |
| | | { |
| | | var dal = DALCreateHelper.CreateDAL<HStation.DAL.ILoginUserMain>(); |
| | | var loginuser = UserLoginMap.GetLoginUserIDByEmployeeID(ID); |
| | | var loginuserid = UserLoginMap.GetLoginUserByEmployeeID(ID); |
| | | var alllist = dal.GetAll(); |
| | | var select = alllist.Find(x => x.ID == loginuser.LoginID); |
| | | var select = alllist.Find(x => x.ID == loginuserid); |
| | | var model_ds = Entity2Model(select); |
| | | var all = GetCache(); |
| | | var model = all.Find(x => x.ID == loginuser.LoginID); |
| | | var model = all.Find(x => x.ID == loginuserid); |
| | | if (model == null) |
| | | { |
| | | all.Add(model_ds); |
| | |
| | | /// <summary> |
| | | /// 获取所有 |
| | | /// </summary> |
| | | public List<Model.LoginUserMain> GetAll() |
| | | public List<Model.UserLoginAccount> GetAll() |
| | | { |
| | | var all = GetCache(); |
| | | return all; |
| | |
| | | /// <summary> |
| | | /// 通过 ID 获取 |
| | | /// </summary> |
| | | public Model.LoginUserMain GetByID(long ID) |
| | | public Model.UserLoginAccount GetByID(long ID) |
| | | { |
| | | var all = GetAll(); |
| | | return all.Find(x => x.ID == ID); |
| | |
| | | /// <summary> |
| | | /// 通过 ID 获取 |
| | | /// </summary> |
| | | public List<Model.LoginUserMain> GetByIds(List<long> Ids) |
| | | public List<Model.UserLoginAccount> GetByIds(List<long> Ids) |
| | | { |
| | | if (Ids == null || Ids.Count < 1) |
| | | { |
| | |
| | | return all.Where(x => Ids.Contains(x.ID)).ToList(); |
| | | } |
| | | |
| | | //通过 员工ID获取用户 |
| | | public Model.UserLoginAccount GetLoginUserByEmployeeID(long ID) |
| | | { |
| | | var dal = DALCreateHelper.CreateDAL<HStation.DAL.ILoginUserMain>(); |
| | | var loginuserid = UserLoginMap.GetLoginUserByEmployeeID(ID); |
| | | var alllist = dal.GetAll(); |
| | | var select = alllist.Find(x => x.ID == loginuserid); |
| | | var model_ds = Entity2Model(select); |
| | | if (model_ds == null) |
| | | return null; |
| | | return model_ds; |
| | | } |
| | | |
| | | #endregion Query |
| | | |
| | | #region Insert |
| | |
| | | /// <summary> |
| | | /// 插入一条数据 |
| | | /// </summary> |
| | | public long Insert(Model.LoginUserMain model) |
| | | public long Insert(Model.UserLoginAccount model) |
| | | { |
| | | if (model == null) |
| | | { |
| | |
| | | /// <summary> |
| | | /// 插入多条 |
| | | /// </summary> |
| | | public bool Inserts(List<Model.LoginUserMain> list) |
| | | public bool Inserts(List<Model.UserLoginAccount> list) |
| | | { |
| | | if (list == null || list.Count < 1) |
| | | { |
| | |
| | | /// <summary> |
| | | /// 更新一条 |
| | | /// </summary> |
| | | public bool Update(Model.LoginUserMain model) |
| | | public bool Update(Model.UserLoginAccount model) |
| | | { |
| | | if (model == null) |
| | | { |
| | |
| | | /// <summary> |
| | | /// 批量更新 |
| | | /// </summary> |
| | | public bool Updates(List<Model.LoginUserMain> list) |
| | | public bool Updates(List<Model.UserLoginAccount> list) |
| | | { |
| | | if (list == null || list.Count < 1) |
| | | { |