示例#1
0
        public ActionResult Search(ContractInfoSearchViewModel model, int page = 1)
        {
            const int pageSize = 20;

            var query = ContractInfoService.GetALL()
                .Include(x => x.Signer)
                .Include(x => x.ContractCate);

            if (model.ContractCateID != 0)
            {
                query = query.Where(x => x.ContractCateID == model.ContractCateID);
            }

            if (!string.IsNullOrEmpty(model.Key))
            {
                query = query.Where(x => x.Key.Contains(model.Key));
            }

            //if (CookieHelper.CheckPermission("boss"))
            //{

            //}
            //else if (CookieHelper.CheckPermission("manager"))
            //{
            //    var memberIds = MemberService.GetMemberIDs(CookieHelper.GetDepartmentID());
            //    query = query.Where(x => memberIds.Contains(x.SenderID));
            //}

            query = query.Where(x => x.AddTime < model.EndTime
             && x.AddTime > model.StartTime).OrderByDescending(x => x.AddTime);

            var totalCount = query.Count();

            var data = query.Skip((page - 1) * pageSize).Take(pageSize).ToList();

            ViewBag.PageInfo = new PagingInfo()
            {
                TotalItems = totalCount,
                CurrentPage = page,
                ItemsPerPage = pageSize
            };

            return PartialView(data);
        }
示例#2
0
 public ActionResult Receivables()
 {
     var model = new ContractInfoSearchViewModel();
     ViewBag.Data_ContractCateID = Utilities.GetSelectListData(ContractCateService.GetALL(),
       x => x.ID,
       x => x.CateName,
       true, true);
     return View(model);
 }