예제 #1
0
        /// <summary>
        /// 获取默认分页
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="isAllowPage"></param>
        /// <returns></returns>
        protected PageListInfo GetPageInfo(int pageIndex = 0, bool isAllowPage = true)
        {
            PageListInfo pageInfo = new PageListInfo
            {
                isAllowPage      = isAllowPage,
                CurrentPageIndex = pageIndex,
                PageRowCount     = AppCommonHelper.PageSize
            };

            return(pageInfo);
        }
예제 #2
0
        public PageListInfo <TableSimpleOut> GetList(QTableIn Para, int Page, int PageCount)
        {
            using (var db = new TemplateEntities())
            {
                var result = new PageListInfo <TableSimpleOut>();
                var data   = db.Table_1
                             .AsExpandable()
                             .Where(PrmMeeingCondition(Para));
                //實作

                return(result);
            }
        }
예제 #3
0
        /// <summary>
        /// 获取分页信息
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="orderBy"></param>
        /// <returns></returns>
        public PageListInfo GetPageInfo(int pageIndex = 1, int pageSize = 10, Dictionary <string, string> orderBy = null)
        {
            PageListInfo pli = new PageListInfo();

            pli.isAllowPage = true;
            //写PAGE cooike
            HttpCookie cook = Request.Cookies["hc.Plat.currentgridlinenumber"];

            if (cook == null)
            {
                cook         = new HttpCookie("hc.Plat.currentgridlinenumber");
                cook.Value   = pageSize.ToString();
                cook.Expires = DateTime.Now.AddDays(7);
                Response.Cookies.Add(cook);

                FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, pageSize.ToString(), DateTime.Now,
                                                                                     DateTime.Now.AddMinutes(Session.Timeout - 1), false, pageSize.ToString());
                string     encryptedTicket = FormsAuthentication.Encrypt(authTicket);
                HttpCookie authCookie      = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                Response.Cookies.Add(authCookie);
            }

            pli.PageRowCount     = pageSize;
            pli.CurrentPageIndex = pageIndex;
            if (orderBy == null)
            {
                orderBy = new Dictionary <string, string>();
                orderBy.Add("ID", "DESC");
            }
            string strOrder = "";

            foreach (var item in orderBy)
            {
                strOrder += item.Key + ":" + item.Value.ToUpper() + ",";
            }
            pli.OrderAndSortList = strOrder.TrimEnd(',');
            return(pli);
        }