Пример #1
0
        public VisaManageViewPage Index(string searchString, VisaState1 State, int?page)
        {
            VisaManageViewPage xx = new VisaManageViewPage();
            var VisaManage        = db.Visa.ToList();
            int pageNumber;
            int pageSizeNum;
            int ItemNum;
            int pageNum;

            if (State == VisaState1.All)
            {
                VisaManage = VisaManage.Where(s => s.VisaName.Contains(searchString)).ToList();
            }
            else
            {
                if (!String.IsNullOrEmpty(searchString))
                {
                    VisaManage = VisaManage.Where(s => s.VisaName.Contains(searchString)).ToList();
                }
                VisaManage = VisaManage.Where(s => s.VisaState == State).ToList();
            }


            pageSizeNum = 5;                                                                                    //每页显示多少条
            ItemNum     = VisaManage.Count();                                                                   //数据总数
            pageNum     = (ItemNum % pageSizeNum) == 0 ? (ItemNum / pageSizeNum) : (ItemNum / pageSizeNum) + 1; //总页数
            if (page == 4)
            {
                pageNumber = pageNum;
            }
            else
            {
                pageNumber = page ?? 1;
            }
            VisaManage      = VisaManage.OrderBy(x => x.VisaID).Skip((pageNumber - 1) * pageSizeNum).Take(pageSizeNum).ToList();
            xx.aa           = VisaManage;
            xx.pageNumber   = pageNumber;
            xx.pageNumx     = pageNum;
            xx.ItemNum      = ItemNum.ToString();
            xx.searchstring = searchString;
            xx.State        = State;
            return(xx);
        }
Пример #2
0
        public ActionResult VisaManageIndex1(string searchString, VisaState1 State, int?page)
        {
            IVisaManage IV = new VisaManageMethod();

            return(Json(IV.Index(searchString, State, page), JsonRequestBehavior.AllowGet));
        }