public WebSettings GetWebSettingByKey(string key) { var whereExp = PredicateBuilder.True <WebSettings>(); whereExp = whereExp.And(p => p.ConfigKey == key); return(CurrentDAL.GetDataListBy(whereExp).FirstOrDefault()); }
public IQueryable <FBJobInfo> MyGerPageList <S>(int PageSize, int PageIndex, out int TotalCount, Expression <Func <FBJobInfo, S> > orderby) { string RoleName = ManageProvider.Provider.Current().RoleName; int UserId = ManageProvider.Provider.Current().UserId; short Delfalg = (short)XS.OA.Model.Enum.DelflagEnum.Normal; var fbjobinfo = CurrentDAL.GetList(f => f.DelFalg == Delfalg).AsQueryable(); if (RoleName == "部门经理") { //获取经理管理用户 var manageruser = this.Dbsession.ManageUserDAL.GetList(m => m.UserInfoID == UserId && m.DelFalg == Delfalg) .Select(m => new { m.ManagerID }); List <int> listid = new List <int>(); foreach (var item in manageruser) { listid.Add(item.ManagerID); } fbjobinfo = fbjobinfo.Where(f => f.ToFKUserId == UserId && listid.Contains(f.FKUserId)).AsQueryable(); } TotalCount = fbjobinfo.Count(); fbjobinfo = fbjobinfo.OrderBy(orderby) .Skip((PageIndex - 1) * PageSize) .Take(PageSize) .AsQueryable(); return(fbjobinfo); }
public IQueryable <WebSettings> GetListByKeys(List <string> keys) { var whereExp = PredicateBuilder.True <WebSettings>(); whereExp = whereExp.And(p => keys.Contains(p.ConfigKey)); return(CurrentDAL.GetDataListBy(whereExp)); }
/// <summary> /// 获取ProfilesInfo /// </summary> /// <param name="id">id</param> public ProfilesInfo Get(string Keys, bool WithCreate) { ProfilesInfo info = CurrentDAL.GetList(p => p.Key == Keys).FirstOrDefault(); if (null == info && WithCreate) { info = new ProfilesInfo(); info.Key = Keys; info.Value = string.Empty; Create(info); } return(info); }
//public override void GetCurrentDAL() //{ // this.CurrentDAL = this.DbSession.UserInfoDAL; //} public IQueryable <UserInfo> LoadSearchPage(UserInfoSearch userInfoSearch) { IQueryable <UserInfo> list = CurrentDAL.LoadEntity(u => u.DelFlag == 0); if (!string.IsNullOrEmpty(userInfoSearch.UserName)) { list = list.Where(u => u.UName.Contains(userInfoSearch.UserName)); } if (!string.IsNullOrEmpty(userInfoSearch.Remark)) { list = list.Where(u => u.Remark.Contains(userInfoSearch.Remark)); } userInfoSearch.TotalCount = list.Count(); return(list.OrderBy <UserInfo, int>(u => u.ID).Skip <UserInfo>((userInfoSearch.PageIndex - 1) * userInfoSearch.PageSize).Take <UserInfo>(userInfoSearch.PageSize)); }
public List <ItemModel> GetTeacherItems() { var whereExp = PredicateBuilder.True <Users>(); whereExp = whereExp.And(p => p.IsActive && !p.IsDeleted && p.RoleId == (int)UserRole.教师); var users = CurrentDAL.GetDataListBy(whereExp); var items = (from p in users select new ItemModel { Text = p.RealName, Value = p.Id.ToString() }).ToList(); return(items); }
public bool Create(IEnumerable <MusicLogInfo> list) { foreach (var item in list) { CurrentDAL.Create(item); } try { CurrentDBSession.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public IQueryable <UserInfo> MyGerPageList1 <S>(Model.Param.UserInfoParam param, int PageSize, int PageIndex, int TotalCount, Expression <Func <UserInfo, S> > orderby) { var user = CurrentDAL.GetList(u => true).AsQueryable(); if (!string.IsNullOrEmpty(param.sName)) { user = user.Where(u => u.Name.Contains(param.sName)).AsQueryable(); } if (!string.IsNullOrEmpty(param.sRemark)) { user = user.Where(u => u.Remark.Contains(param.sRemark)).AsQueryable(); } if (ManageProvider.Provider.Current().RoleName == "部门经理") { int userid = ManageProvider.Provider.Current().UserId; short isdel = (short)XS.OA.Model.Enum.DelflagEnum.Normal; var manageruser = this.Dbsession.ManageUserDAL.GetList(m => m.UserInfoID == userid && m.DelFalg == isdel) .Select(m => new { m.ManagerID }); List <int> listid = new List <int>(); foreach (var item in manageruser) { listid.Add(item.ManagerID); } user = user.Where(u => listid.Contains(u.ID)).AsQueryable(); } else { //int userid = ManageProvider.Provider.Current().UserId; //short isdel = (short)XS.OA.Model.Enum.DelflagEnum.Normal; //var rolezj = this.Dbsession.RoleInfoDAL.GetList(r => r.RoleName == "部门总监" && r.DelFalg == isdel); user = (from u in user from r in u.RoleInfo where r.RoleName != "部门总监" select u); } param.TotalCount = user.Count(); user = user.OrderBy(orderby) .Skip((param.PageIndex - 1) * param.PageSize) .Take(param.PageSize) .AsQueryable(); return(user); }
public UserDto GetUser(string userName) { var whereExp = PredicateBuilder.True <Users>(); whereExp = whereExp.And(p => !p.IsDeleted && p.UserName == userName); var users = CurrentDAL.GetDataListBy(whereExp); var user = (from p in users select new UserDto { UserId = p.Id, UserName = p.UserName, PassWord = p.HashPassword, RoleId = p.RoleId, LastLoginTime = p.LastLoginTime, IsActive = p.IsActive }).FirstOrDefault(); return(user); }
public IQueryable <UserInfo> MyGerPageList <S>(Model.Param.UserInfoParam param, int PageSize, int PageIndex, int TotalCount, Expression <Func <UserInfo, S> > orderby) { var user = CurrentDAL.GetList(u => true).AsQueryable(); if (!string.IsNullOrEmpty(param.sName)) { user = user.Where(u => u.Name.Contains(param.sName)).AsQueryable(); } if (!string.IsNullOrEmpty(param.sRemark)) { user = user.Where(u => u.Remark.Contains(param.sRemark)).AsQueryable(); } param.TotalCount = user.Count(); user = user.OrderBy(orderby) .Skip((param.PageIndex - 1) * param.PageSize) .Take(param.PageSize) .AsQueryable(); return(user); }
public IQueryable <JobInfo> MyGerPageList <S>(int PageSize, int PageIndex, out int TotalCount, Expression <Func <JobInfo, bool> > wherelambda, Expression <Func <JobInfo, S> > orderby) { var jobinfo = CurrentDAL.GetList(u => true).AsQueryable(); int userid = ManageProvider.Provider.Current().UserId; short isdel = (short)XS.OA.Model.Enum.DelflagEnum.Normal; if (ManageProvider.Provider.Current().RoleName == "部门经理") { //var manageruser = this.Dbsession.ManageUserDAL.GetList(m => m.UserInfoID == userid && m.DelFalg == isdel) // .Select(m => new // { // m.ManagerID // }); //List<int> listid = new List<int>(); //foreach (var item in manageruser) //{ // listid.Add(item.ManagerID); //} //jobinfo = jobinfo.Where(u => listid.Contains(u.ID)).AsQueryable(); jobinfo = jobinfo.Where(j => j.ToAppointId == userid && j.DelFalg == isdel).AsQueryable(); } else if ((ManageProvider.Provider.Current().RoleName == "普通员工")) { jobinfo = jobinfo.Where(j => j.ToAppointId == userid && j.DelFalg == isdel).AsQueryable(); } else { jobinfo = jobinfo.Where(j => j.State == "已结束" && j.DelFalg == isdel).AsQueryable(); } TotalCount = jobinfo.Count(); jobinfo = jobinfo.OrderBy(orderby) .Skip((PageIndex - 1) * PageSize) .Take(PageSize) .AsQueryable(); return(jobinfo); }
/// <summary> /// 当前登录员工(sharp_员工ID 形式后加密) /// </summary> /// <returns></returns> public UserInfo GetCurrent() { if (System.Web.HttpContext.Current.Session != null && System.Web.HttpContext.Current.Session["UserInfo"] != null) { return((UserInfo)System.Web.HttpContext.Current.Session["UserInfo"]); } int ID = GetCurrentEmployeeID(); if (ID > 0) { UserInfo info = CurrentDAL.GetList(p => p.ID == ID).FirstOrDefault(); if (null == info) { return(null); } if (null != System.Web.HttpContext.Current.Session) { System.Web.HttpContext.Current.Session["UserInfo"] = info; } return(info); } return(null); }
public bool Update(T entity) { return(CurrentDAL.Update(entity)); }
public bool Edit(T info) { CurrentDAL.Edit(info); return(CurrentDBSession.SaveChanges()); }
public IQueryable <T> GetList <s>(int PageIndex, int PageSize, out int TotalCount, Expression <Func <T, bool> > whereLambda, Expression <Func <T, s> > OrderByLambda, bool IsASC) { return(CurrentDAL.GetList <s>(PageIndex, PageSize, out TotalCount, whereLambda, OrderByLambda, IsASC)); }
public T Create(T info) { CurrentDAL.Create(info); CurrentDBSession.SaveChanges(); return(info); }
public bool Delete(T info) { CurrentDAL.Delete(info); return(CurrentDBSession.SaveChanges()); }
public List <T> GetEntities(Expression <Func <T, bool> > whereLambda) { return(CurrentDAL.GetEntities(whereLambda)); }
public bool Del(T entity) { return(CurrentDAL.Del(entity)); }
public T GetEntity(Expression <Func <T, bool> > whereLambda) { return(CurrentDAL.GetEntity(whereLambda)); }
public bool Delete(T entity) { CurrentDAL.Delete(entity); return(Dbsession.SaveChanges() > 0); }
public T Add(T entity) { CurrentDAL.Add(entity); Dbsession.SaveChanges(); return(entity); }
public IQueryable <T> GetList(Expression <Func <T, bool> > wherelambda) { return(CurrentDAL.GetList(wherelambda)); }
public List <T> GetPageEntityes(Expression <Func <T, bool> > whereLambda, Expression <Func <T, object> > orderbyLambda, int pageSize, int pageIndex, bool isAsc) { return(CurrentDAL.GetPageEntities(whereLambda, orderbyLambda, isAsc, pageSize, pageIndex)); }
public IQueryable <T> GerPageList <S>(int PageSize, int PageIndex, out int TotalCount, Expression <Func <T, bool> > wherelambda, Expression <Func <T, S> > orderby) { return(CurrentDAL.GerPageList(PageSize, PageIndex, out TotalCount, wherelambda, orderby)); }
public int UpdateRange(List <T> entities) { return(CurrentDAL.UpdateRange(entities)); }
public bool Edit(T entity) { CurrentDAL.Edit(entity); return(Dbsession.SaveChanges() > 0); }
public int DelRange(Expression <Func <T, bool> > whereLambda) { return(CurrentDAL.DelRange(whereLambda)); }
public int DeleteLogic(List <int> ids) { CurrentDAL.DeleteLogic(ids); return(Dbsession.SaveChanges()); }
public int UpdateRange(List <T> entities, Expression <Func <T, bool> > whereLambda) { return(CurrentDAL.UpdateRange(entities, whereLambda)); }