コード例 #1
0
ファイル: IndexController.cs プロジェクト: ps13403232750/LWT
        public string GetPurchageList(PageParams pageParams)
        {
            pageParams.TableName = "Purchase";
            if (!string.IsNullOrEmpty(pageParams.StrWhere))
            {
                pageParams.StrWhere = "and LinkManName like '%" + pageParams.StrWhere + "%'";
            }
            var result = Common.Client.GetApi("post", "values/GetPurchasePaged", pageParams);

            return(result);
        }
コード例 #2
0
ファイル: IndexController.cs プロジェクト: ps13403232750/LWT
        public string GetCategoryList(PageParams pageParams)
        {
            pageParams.TableName = "Category";
            if (!string.IsNullOrEmpty(pageParams.StrWhere))
            {
                pageParams.StrWhere = "and UserName like '%" + pageParams.StrWhere + "%'";
            }
            var result = Common.Client.GetApi("post", "values/GetCategoryPaged", pageParams);

            return(result);
        }
コード例 #3
0
ファイル: IndexController.cs プロジェクト: ps13403232750/LWT
        public string GetUsersList(PageParams pageParams)
        {
            pageParams.TableName = "Users s join Roles r on s.roleid = r.roleid";
            if (!string.IsNullOrEmpty(pageParams.StrWhere))
            {
                pageParams.StrWhere = "and UserName like '%" + pageParams.StrWhere + "%'";
            }
            var result = Common.Client.GetApi("post", "values/GetUsersPaged", pageParams);

            return(result);
        }
コード例 #4
0
        /// <summary>
        /// 将符合查询的数据导出Excel
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="grid"></param>
        /// <param name="httplink"></param>
        public void OutputExcel(string filename, ExtjsGrid grid, EntityProductionCollect productioncollect)
        {
            #region
            int        totalcount  = 0;
            PageParams queryparams = new PageParams(1, 65536);
            DataSet    ds          = this.GetData(productioncollect, queryparams, out totalcount);

            ExportExcelProductionCollect exportexcelproductioncollect = new ExportExcelProductionCollect(filename, ds, grid);
            exportexcelproductioncollect.Output();
            #endregion
        }
コード例 #5
0
        /// <summary>
        /// 森林管控中心首页
        /// </summary>
        /// <returns></returns>
        public IActionResult Index()
        {
            PageParams pageParams = new PageParams()
            {
                CurPage = 1, Fields = "ID,Name,Sex", Filter = "", PageSize = 4, Orderby = "ID desc", TableName = "student"
            };
            var result = _pageHelper.InfoList <Student>(pageParams);

            ViewBag.Name = _student.GetStudentName();
            return(View());
        }
コード例 #6
0
        public async Task <PagedList <User> > GetUsers(PageParams pageParams)
        {
            var users = _context.Users
                        .Include(b => b.Businesses)
                        .ThenInclude(p => p.Photos)
                        .AsQueryable();

            users = users.Where(u => u.Id != pageParams.UserId);

            return(await PagedList <User> .CreateAsync(users, pageParams.PageNumber, pageParams.PageSize));
        }
コード例 #7
0
        /// <summary>
        /// 将符合查询的数据导出Excel
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="grid"></param>
        /// <param name="httplink"></param>
        public void OutputExcel(string filename, ExtjsGrid grid, EntityMenu menu)
        {
            #region
            int        totalcount  = 0;
            PageParams queryparams = new PageParams(1, 65536);
            DataSet    ds          = this.GetData(menu, queryparams, out totalcount);

            ExportExcel exportexcel = new ExportExcel(filename, ds, grid);
            exportexcel.Output();
            #endregion
        }
コード例 #8
0
        /****************************************
         ***生成器版本:V1.0.1.31494
         ***生成时间:2013-04-26 18:05:16
         ***公司:山西ICat Studio有限公司
         ***友情提示:以下代码为生成器自动生成,可做参照修改之用;
         ***         如需有其他业务要求,可在region外添加新方法;
         ***         如发现任何编译和运行时错误,请联系QQ:330669393。
         *****************************************/

        #region public members methods

        /// <summary>
        /// 根据条件筛选所有WLOGMission指定页码的数据(分页型)
        /// </summary>
        /// <param name="wlogmission">实体对象</param>
        /// <param name="pageparams">分页对象</param>
        /// <returns></returns>
        public string GetJsonByPage(EntityWLOGMission wlogmission, PageParams pageparams)
        {
            #region
            int totalCount = 0;
            WLOGMissionClass wlogmissionclass = new WLOGMissionClass();
            pageparams.PageSorts.Add(new PageSort(WLOGMissionData.writeTime, EnumSQLOrderBY.DESC));
            DataSet wlogmissiondata = this.GetData(wlogmission, pageparams, out totalCount);
            return(base.GetJson(wlogmissiondata, totalCount));

            #endregion
        }
コード例 #9
0
        public async Task <IActionResult> Get([FromQuery] PageParams pageParams)
        {
            //return Ok("Alunos: Marta, Paula, Lucas, Rafa");
            var alunos = await _repo.GetAllAlunosAsync(pageParams, true);

            var alunosResult = _mapper.Map <IEnumerable <AlunoDto> >(alunos);

            Response.AddPagination(alunos.CurrentPage, alunos.PageSize, alunos.TotalCount, alunos.TotalPages);

            return(Ok(alunosResult));
        }
コード例 #10
0
        /// <summary>
        /// 将符合查询的数据导出Excel
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="grid"></param>
        /// <param name="httplink"></param>
        public void OutputExcel(string filename, ExtjsGrid grid, EntityComputer computer)
        {
            #region
            int        totalcount  = 0;
            PageParams queryparams = new PageParams(1, 65536);
            DataSet    ds          = this.GetData(computer, queryparams, out totalcount);

            ExportExcelComputer exportexcelcomputer = new ExportExcelComputer(filename, ds, grid);
            exportexcelcomputer.Output();
            #endregion
        }
コード例 #11
0
        /// <summary>
        /// 将符合查询的数据导出Excel
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="grid"></param>
        /// <param name="httplink"></param>
        public void OutputExcel(string filename, ExtjsGrid grid, EntityRoleControlFunctionPoint rolecontrolfunctionpoint)
        {
            #region
            int        totalcount  = 0;
            PageParams queryparams = new PageParams(1, 65536);
            DataSet    ds          = this.GetData(rolecontrolfunctionpoint, queryparams, out totalcount);

            ExportExcel exportexcel = new ExportExcel(filename, ds, grid);
            exportexcel.Output();
            #endregion
        }
コード例 #12
0
        /// <summary>
        /// 将符合查询的数据导出Excel
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="grid"></param>
        /// <param name="httplink"></param>
        public void OutputExcel(string filename, ExtjsGrid grid, EntityCollectType collecttype)
        {
            #region
            int        totalcount  = 0;
            PageParams queryparams = new PageParams(1, 65536);
            DataSet    ds          = this.GetData(collecttype, queryparams, out totalcount);

            ExportExcelCollectType exportexcelcollecttype = new ExportExcelCollectType(filename, ds, grid);
            exportexcelcollecttype.Output();
            #endregion
        }
コード例 #13
0
        /// <summary>
        /// 将符合查询的数据导出Excel
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="grid"></param>
        /// <param name="httplink"></param>
        public void OutputExcel(string filename, ExtjsGrid grid, EntityWLOGPersonLog wlogpersonlog)
        {
            #region
            int        totalcount  = 0;
            PageParams queryparams = new PageParams(1, 65536);
            DataSet    ds          = this.GetData(wlogpersonlog, queryparams, out totalcount);

            ExportExcelPersonLog exportexcel = new ExportExcelPersonLog(filename, ds, grid);
            exportexcel.Output();
            #endregion
        }
コード例 #14
0
ファイル: Form2.cs プロジェクト: justseven/FCInterfaceData
        private BDCFilterResult ReRecode(string slbh)
        {
            PageParams pg = new PageParams();

            pg.PrjId = slbh;
            //pg.UserId = FCDA_BLL.GetUserID(pg.PrjId.Trim());

            BDCFilterResult res = FCDA_BLL.Insert_FCDA(pg);

            return(res);
        }
コード例 #15
0
        public async Task <PageList <Aluno> > GetAllAlunosAsync(PageParams pageParams, bool includeProfessor = false)
        {
            IQueryable <Aluno> query = _context.Alunos;

            if (includeProfessor)
            {
                query = query.Include(a => a.AlunosDisciplinas)
                        .ThenInclude(ad => ad.Disciplina)
                        .ThenInclude(d => d.Professor);
            }

            //query = query.AsNoTracking().OrderBy(a => a.Nome);

            if (!string.IsNullOrEmpty(pageParams.Nome))
            {
                query = query.Where(aluno => aluno.Nome
                                    .ToUpper()
                                    .Contains(pageParams.Nome.ToUpper()) ||
                                    aluno.Sobrenome
                                    .ToUpper()
                                    .Contains(pageParams.Nome.ToUpper()));
            }

            if (pageParams.Matricula > 0)
            {
                query = query.Where(aluno => aluno.Matricula == pageParams.Matricula);
            }

            if (pageParams.Ativo != null)
            {
                query = query.Where(aluno => aluno.Ativo == (pageParams.Ativo != 0));
            }

            switch (pageParams.OrderBy)
            {
            case "id": {
                query = query.AsNoTracking().OrderBy(a => a.Id);
                break;
            }

            case "nome": {
                query = query.AsNoTracking().OrderBy(a => a.Nome);
                break;
            }

            case "matricula": {
                query = query.AsNoTracking().OrderBy(a => a.Matricula);
                break;
            }
            }

            return(await PageList <Aluno> .CreateAsync(query, pageParams.PageNumber, pageParams.PageSize));
        }
コード例 #16
0
        public async Task <TestDto> GetTestAsync(int id, PageParams pageParams)
        {
            var testExercises = await _exerciseRepository.GetExercisesForTestAsync(id, pageParams);

            var testDto = await _context.Tests.ProjectTo <TestDto>(_mapper.ConfigurationProvider).AsQueryable()
                          .FirstOrDefaultAsync(t => t.Id == id);

            testDto.ExerciseDtos = testExercises;
            testDto.Points       = await this.CalculateTotalTestPoints(testDto.Id);

            return(testDto);
        }
コード例 #17
0
ファイル: VideoPlayPage.xaml.cs プロジェクト: Yardley999/MGTV
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            pageParams = e.Parameter as PageParams;

            PlayerSetup();
            if(pageParams != null)
            {
                LoadVideoDataAsync(pageParams.VideoId);
                HideControlPanelAnimation();
            }
        }
コード例 #18
0
        /// <summary>
        ///订单表分页显示
        /// </summary>
        /// <param name="pageParams"></param>
        /// <returns></returns>
        public string PageOrders(PageParams pageParams, string StrWhere)
        {
            pageParams.TableName = "Orders";

            if (!string.IsNullOrEmpty(StrWhere))
            {
                pageParams.StrWhere = " and OrderNum like '%" + StrWhere + "%'";
            }
            var result = Common.Client.GetApi("post", "Supplier/PageOrders", pageParams);

            return(result);
        }
コード例 #19
0
        /// <summary>
        /// pobranie użytkowników którzy nie nalezą do grupy i nie zostało wysłane do nich zaproszenie do danej grupy
        /// </summary>
        /// <param name="pageParams"></param>
        /// <param name="groupId"></param>
        /// <param name="groupUserFilters"></param>
        /// <returns></returns>
        public async Task <PagedList <UserToModifyNameDto> > GetUsersForApplication(PageParams pageParams, int groupId, GroupUsersFilter groupUserFilters)
        {
            // pobranie użytkowników grupy
            var groupUsers = await _context.UserToGroups.Where(x => x.GroupId == groupId).ToListAsync();

            // pobranie zaproszeń do użytkowników dla danej grupy
            var invitedUsers = await _context.Invitations.Where(x => x.GroupId == groupId).ToListAsync();

            // wszyscy uzytkownicy aplikacji
            var appUsers = await _context.Users.ToListAsync();

            // lista użytkowników, którzy nie należą do grupy i którzy nie zostali zaproszeni
            List <UserToModifyNameDto> lstUsers = new List <UserToModifyNameDto>();


            // jeżeli grupa ma jakiś użytkowników
            if (appUsers.Count > 0)
            {
                foreach (Users usr in appUsers)
                {
                    // jeżeli zaproszenie zostało wysłane pomijamy uzytkownika
                    if (invitedUsers.Any(x => x.UserAdresserId == usr.Id))
                    {
                        continue;
                    }

                    // jeżeli użytkownik należy już do grupy
                    if (groupUsers.Any(x => x.UserId == usr.Id))
                    {
                        continue;
                    }

                    // jeżeli nie nalezy do grupy ani jezeli nie zostalo wyslane zaproszenie pokazujemy
                    UserToModifyNameDto utmnu = new UserToModifyNameDto()
                    {
                        UserId   = usr.Id,
                        UserName = usr.UserName
                    };
                    lstUsers.Add(utmnu);
                }
            }


            if (groupUserFilters != null)
            {
                if (groupUserFilters.UserNameLike != null)
                {
                    lstUsers = lstUsers.Where(x => x.UserName.ToLower().Contains(groupUserFilters.UserNameLike.ToLower())).ToList();
                }
            }

            return(await PagedList <UserToModifyNameDto> .Create(lstUsers, pageParams.PageNumber, pageParams.PageSize));
        }
コード例 #20
0
ファイル: IndexController.cs プロジェクト: ps13403232750/LWT
        public string GetPowerList(PageParams pageParams)
        {
            pageParams.TableName = "Power";
            pageParams.SortRow   = "id";
            if (!string.IsNullOrEmpty(pageParams.StrWhere))
            {
                pageParams.StrWhere = " and PowerName like '%" + pageParams.StrWhere + "%'";
            }
            var result = Common.Client.GetApi("post", "values/GetPowerPaged", pageParams);

            return(result);
        }
コード例 #21
0
        public async Task <PageList <Developer> > GetAllDevelopersAsync(PageParams pageParams)
        {
            IQueryable <Developer> query = _context.Developer;

            query = query.Include(d => d.DeveloperProject)
                    .ThenInclude(dp => dp.Project);

            query = query.Include(d => d.Entries);

            query = query.AsNoTracking().OrderBy(d => d.Id);

            return(await PageList <Developer> .CreateAsync(query, pageParams.PageNumber, pageParams.PageSize));
        }
コード例 #22
0
        public override string RenderPage(string pageTemplate, PageParams pageParams)
        {
            var templName = pageTemplate ?? "default";

            if (!_templates.ContainsKey(templName))
            {
                throw new ArgumentException("Unsupported page template: " + pageTemplate);
            }
            var template = _templates[templName] ();

            template.Params = pageParams;
            return(template.Render());
        }
コード例 #23
0
        public async Task <IActionResult> Get([FromQuery] PageParams pageParams)
        {
            var students = await _repository.GetAllStudentsAsync(pageParams, true);

            var studentsResult = _mapper.Map <IEnumerable <StudentDto> >(students);

            Response.AddPagination(students.CurrentPage,
                                   students.PageSize,
                                   students.TotalCount,
                                   students.TotalPages);

            return(Ok(studentsResult));
        }
コード例 #24
0
        private static HouseInfo GetHouseInfo(PageParams pageParams)
        {
            FC_H_QSDC fc_h      = GetFC_H(pageParams.PrjId);
            HouseInfo houseInfo = new HouseInfo();

            houseInfo.HouseInfo_ID = CreateGuid(32);
            houseInfo.HoSite       = fc_h.ZL;
            houseInfo.H_HoUse      = fc_h.GHYT;
            houseInfo.H_ConAcre    = fc_h.JZMJ;
            houseInfo.BDCDYH       = fc_h.BDCDYH;

            return(houseInfo);
        }
コード例 #25
0
ファイル: Repository.cs プロジェクト: RenanOrtega/CRUDWebAPI
        public async Task <PageList <Cliente> > GetAllClientesAsync(PageParams pageParams)
        {
            IQueryable <Cliente> query = _context.Clientes;

            query = query.AsNoTracking()
                    .Include(c => c.Telefones)
                    .Include(c => c.Enderecos)
                    .Include(c => c.RedesSociais)
                    .OrderBy(c => c.Id);

            //return await query.ToListAsync();
            return(await PageList <Cliente> .CreateAsync(query, pageParams.PageNumber, pageParams.PageSize));
        }
コード例 #26
0
ファイル: SettleController.cs プロジェクト: ps13403232750/LWT
        /// <summary>
        /// 额度详情分页
        /// </summary>
        /// <param name="pageParams"></param>
        /// <returns></returns>
        public string ThlPageList(PageParams pageParams, string BuyerName)
        {
            pageParams.TableName = "Limits";
            var wherestr = "";

            if (!string.IsNullOrEmpty(BuyerName))
            {
                wherestr = " and BuyerName like '%" + BuyerName + "%'";
            }
            pageParams.StrWhere = wherestr;
            var list = Common.Client.GetApi("post", "Settle/ThlPageList", pageParams);

            return(list);
        }
コード例 #27
0
 /// <summary>
 /// 分页方法
 /// </summary>
 /// <param name="pageIndex"></param>
 /// <param name="pagesize"></param>
 /// <param name="totalCount"></param>
 /// <returns></returns>
 public PageResult <PublishApply> Paging(PageParams pageParams)
 {
     using (SqlSugarClient db = BaseDB.GetClient())
     {
         // List<PublishApply> page = db.Queryable<PublishApply>().ToPageList(pageIndex, pageSize, ref totalCount);
         var page = db.Queryable <User, Publisher>((st, sc) => new object[] { JoinType.Inner, st.UserInfoId == sc.PId }).Select <PublishApply>().ToPageList(pageParams.PageIndex, pageParams.PageSize, ref totalCount);
         PageResult <PublishApply> pageResult = new PageResult <PublishApply>();
         pageResult.TotalCount = totalCount;
         int i = totalCount / pageParams.PageSize;
         pageResult.TotalPage = totalCount % pageParams.PageSize == 0 ? i : i + 1;
         pageResult.DataList  = page;
         return(pageResult);
     }
 }
コード例 #28
0
        ///****************************************
        //***生成器版本:V1.0.1.31494
        //***生成时间:2013-04-24 18:44:01
        //***公司:山西ICat Studio有限公司
        //***友情提示:以下代码为生成器自动生成,可做参照复制之用;
        //***         如需有其他业务要求,则可在region外添加新的业务关联方法;
        //***         如发现任何编译错误,请联系QQ:330669393。
        //*****************************************/

        /// <summary>
        /// 检索数据并分页返回数据集
        /// </summary>
        /// <param name="recordCount">符合条件的总记录数</param>
        /// <param name="qParams">分页对象</param>
        /// <param name="conditions">查询条件集合</param>
        /// <returns>分页数据</returns>
        public DataSet SelectWLOGProjectTreeByPage(PageParams qParams,
                                                   DBConditions conditions)
        {
            #region
            WLOGProjectTreeData wlogprojecttreedata = new WLOGProjectTreeData();
            string businessSql = @"SELECT * FROM [WLOGProjectTree]";

            //conditions.AddKeys(WLOGProjectTreeData.currentId);

            base.GetCustomBusiness(businessSql, wlogprojecttreedata, conditions);
            return(wlogprojecttreedata);

            #endregion
        }
コード例 #29
0
        public async Task <PagedList <User> > GetUsers(PageParams userParams)
        {
            var users = _context.Users.AsQueryable();

            if (userParams.UserId != null)
            {
                users = _context.Users
                        .FromSql("SELECT \"Users\".* FROM \"Users\" JOIN \"UserFollows\" ON \"Users\".\"Id\"=\"UserFollows\".\"FollowedId\" WHERE \"UserFollows\".\"FollowerId\"={0}", userParams.UserId)
                        .Include(u => u.Photos)
                        .OrderByDescending(x => x.Username).AsQueryable();
            }
            userParams.PageSize = 18;
            return(await PagedList <User> .CreateAsync(users, userParams.PageNumber, userParams.PageSize));
        }
コード例 #30
0
        public async Task <IActionResult> Get([FromQuery] PageParams pageParams)
        {
            try
            {
                var turmas = await _repository.GetAllTurmas(pageParams);

                Response.AddPagination(turmas.CurrentPage, turmas.PageSize, turmas.TotalCount, turmas.TotalPages);
                return(Ok(turmas));
            }
            catch (Exception ex)
            {
                return(BadRequest($"Erro: {ex}"));
            }
        }
コード例 #31
0
        public async Task <IActionResult> Get([FromQuery] PageParams pageParams)
        {
            var professores = await _repo.GetProfessoresAsync(pageParams, true);

            var profResult = _mapper.Map <IEnumerable <ProfessorDto> >(professores);

            Response.AddPagination(professores.CurrentPage,
                                   professores.PageSize,
                                   professores.TotalCount,
                                   professores.TotalPage
                                   );

            return(Ok(profResult));
        }
コード例 #32
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (e.NavigationMode == NavigationMode.Back)
            {
                return;
            }

            pageParams = e.Parameter as PageParams;

            if (pageParams != null)
            {
                Init();
                //viewModel.Background = App.Instance.BackgroundImage;
                viewModel.Title = pageParams.ChannelName; 
                LoadFilterDataAsync(); 
                LoadLibraryDataAsync(null);
            }
        }
コード例 #33
0
ファイル: PagerHelper.cs プロジェクト: ritacc/RitaccTest
        /// <summary>
        /// 获取分页(排序)参数
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static PageParams GetPageParams(HttpRequestBase request, ViewDataDictionary viewData)
        {
            int pageSize = request["PageSize"].ParseInt();
            int pageIndex = request["PageIndex"].ParseInt();
            int? sortField = request["SortField"] == null ? null : (int?)request["SortField"].ParseInt();
            string sortFieldName = request["SortFieldName"];
            SortDirectionEnum? sortDirection = request["SortDirection"] == null ? null : (SortDirectionEnum?)request["SortDirection"].ParseInt();

            PageParams viewDataPageParams = viewData.GetPageParams();
            //if (pageSize != viewDataPageParams.PageSize)
            //    pageIndex = 1; //改变了分页大小后自动跳到第一页
            PageParams pageParams = new PageParams()
            {
                PageSize = pageSize <= 0 ? viewDataPageParams.PageSize : pageSize,
                PageIndex = pageIndex <= 0 ? viewDataPageParams.PageIndex : pageIndex,
                SortField = sortField == null ? viewDataPageParams.SortField : sortField.Value,
                SortFiledName = sortFieldName,
                sortDirection = sortDirection == null ? viewDataPageParams.sortDirection : sortDirection.Value
            };

            return pageParams;
        }
コード例 #34
0
ファイル: PagerHelper.cs プロジェクト: ritacc/RitaccTest
        /// <summary>
        /// 
        /// </summary>
        /// <param name="viewData"></param>
        /// <returns></returns>
        public static PageParams GetPageParams(this ViewDataDictionary viewData)
        {
            int pageSize = viewData["PageSize"] == null ? 0 : Convert.ToInt32(viewData["PageSize"]);
            int pageIndex = viewData["PageIndex"] == null ? 0 : Convert.ToInt32(viewData["PageIndex"]); ;
            int sortField = viewData["SortField"] == null ? 0 : Convert.ToInt32(viewData["SortField"]);
            string sortFieldName = viewData["SortFieldName"] == null ? string.Empty : viewData["SortFieldName"].ToString();
            SortDirectionEnum? sortDirection = viewData["SortDirection"] == null ? null : (SortDirectionEnum?)viewData["SortDirection"].ToString().ParseInt();

            PageParams pageParams = new PageParams()
            {
                PageSize = pageSize <= 0 ? 50 : pageSize,
                PageIndex = pageIndex <= 0 ? 1 : pageIndex,
                SortField = sortField,// < 0 ? 0 : sortField,
                sortDirection = sortDirection == null ? SortDirectionEnum.Asc : sortDirection.Value
            };
            return pageParams;
        }
コード例 #35
0
ファイル: PagerHelper.cs プロジェクト: ritacc/RitaccTest
 /// <summary>
 /// 
 /// </summary>
 /// <param name="viewData"></param>
 /// <param name="pageParams"></param>
 public static void SetSortParamsToViewData(this ViewDataDictionary viewData, PageParams pageParams)
 {
     viewData["SortField"] = pageParams.SortField;
     viewData["SortDirection"] = (int)pageParams.sortDirection;
     viewData["PageIndex"] = pageParams.PageIndex;
     viewData["PageSize"] = pageParams.PageSize;
     viewData["SortFiledName"] = pageParams.SortFiledName;
 }
コード例 #36
0
ファイル: PagerHelper.cs プロジェクト: ritacc/RitaccTest
        /// <summary>
        /// 
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static PageParams GetPageParams(this HttpRequestBase request)
        {
            int pageSize = request["PageSize"].ParseInt();
            int pageIndex = request["PageIndex"].ParseInt();
            int sortField = request["SortField"].ParseInt();
            string sortFieldName = request["SortFiledName"];

            SortDirectionEnum? sortDirection = (SortDirectionEnum?)request["SortDirection"].ParseInt();

            PageParams pageParams = new PageParams()
            {
                PageSize = pageSize <= 0 ? 50 : pageSize,
                PageIndex = pageIndex <= 0 ? 1 : pageIndex,
                SortField = sortField < 0 ? 0 : sortField,
                SortFiledName = sortFieldName,
                sortDirection = sortDirection == null ? SortDirectionEnum.Asc : sortDirection.Value
            };

            return pageParams;
        }