コード例 #1
0
ファイル: UserInfoController.cs プロジェクト: kiddVS/OA
        public ActionResult GetUserInfo()
        {
            int            pageIndex    = Request["page"] == null ? 1 : int.Parse(Request["page"]);
            int            pageSize     = Request["rows"] == null ? 5 : int.Parse(Request["rows"]);
            string         searchUName  = Request["searchUName"];
            string         searchRemark = Request["searchRemark"];
            SearchUserInfo search       = new SearchUserInfo()
            {
                PageIndex = pageIndex, PageSize = pageSize, SearchRemark = searchRemark, SearchUName = searchUName
            };

            //int total;
            CUP.PE.OA.Model.EnumType.EnumIsActive enumDel = CUP.PE.OA.Model.EnumType.EnumIsActive.ActiveLogical;
            var entities = UserInfoService.GetSearchUserInfo(search, enumDel);
            //var entities = userInfoService.LoadEntitiesByPage<int>(pageIndex, pageSize, out total, u => u.DelFlag == enumDel, u => u.ID, true);
            var showEntities = from u in entities
                               select new
            {
                ID      = u.ID,
                UName   = u.UName,
                UPwd    = u.UPwd,
                Remark  = u.Remark,
                SubTime = u.SubTime
            };
            var json = new { total = search.Total, rows = showEntities };

            return(Json(json));
        }
コード例 #2
0
        public IQueryable <UserInfo> GetSearchUserInfo(SearchUserInfo searchUserInfo, CUP.PE.OA.Model.EnumType.EnumIsActive enumFlag)
        {
            short delFlag  = (short)enumFlag;
            var   entities = CurrentDBSession.UserInfoDAL.LoadEntities(u => u.DelFlag == delFlag);

            if (!string.IsNullOrEmpty(searchUserInfo.SearchUName))
            {
                entities = entities.Where(u => u.UName.Contains(searchUserInfo.SearchUName));
            }
            if (!string.IsNullOrEmpty(searchUserInfo.SearchRemark))
            {
                entities = entities.Where(u => u.Remark.Contains(searchUserInfo.SearchRemark));
            }
            searchUserInfo.Total = entities.Count();
            return(entities.OrderBy <UserInfo, int>(u => u.ID).Skip((searchUserInfo.PageIndex - 1) * searchUserInfo.PageSize).Take(searchUserInfo.PageSize));
        }
コード例 #3
0
 public async Task SetSearchUser(SearchUserInfo user)
 {
     await _session.SetItemAsync <SearchUserInfo>("searchUser", user);
 }