Пример #1
0
        public ActionResult GetAllUserInfo(FormCollection form)
        {
            int TotalCount = 0;
            int PageSize   = int.Parse(form["rows"] ?? "8");
            int PageIndex  = int.Parse(form["page"] ?? "1");
            // sName: $("#sName").val(), sRemark: $("#sRemark").val()
            string sName   = form["sName"] ?? "";
            string sRemark = form["sRemark"] ?? "";

            Model.Param.UserInfoParam parm = new Model.Param.UserInfoParam()
            {
                PageSize  = PageSize,
                PageIndex = PageIndex,
                sName     = sName,
                sRemark   = sRemark,
            };

            var userinfo = bll.MyGerPageList(parm, PageSize, PageIndex, TotalCount, o => o.ID).Select(
                u => new
            {
                ID        = u.ID,
                Name      = u.Name,
                Remark    = u.Remark,
                ModfiedOn = u.ModfiedOn,
                SubTime   = u.SubTime
            }
                );
            var jsondata = new { total = parm.TotalCount, rows = userinfo.ToList() };

            return(Json(jsondata, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }