Пример #1
0
        //Author: Wang Wang Wang
        // GET: Pending requisition list
        public ActionResult GetPendingList(int?page, int?department, int?collectionPoint, string status = "")
        {
            var requisitions = reqService.GetPendingRequisitions().OrderByDescending(r => r.RequisitionDate).ToList();

            ViewBag.departments      = reqService.GetDepartments();
            ViewBag.collectionPoints = reqService.GetCollectionPoints();
            ViewBag.statusList       = new List <string> {
                Status.Approved.ToString(), Status.Incomplete.ToString()
            };
            if (department > 0)
            {
                requisitions = requisitions.Where(r => r.Employee.DepartmentID == department).ToList();
            }
            if (collectionPoint > 0)
            {
                requisitions = requisitions.Where(r => r.Employee.Department.CollectionPointID == collectionPoint).ToList();
            }
            if (status != "")
            {
                requisitions = requisitions.Where(r => r.Status.ToString() == status).ToList();
            }
            ViewBag.department      = department;
            ViewBag.collectionPoint = collectionPoint;
            ViewBag.status          = status;
            int pageNumber = (page ?? 1);

            return(View("~/Views/Store/Clerk/GetPendingList.cshtml", requisitions.ToPagedList(pageNumber, PAGE_SIZE)));
        }