// GET: ProgressCheckDto public async Task <ActionResult> Index(string PONumberSearch = null, string ItemSearch = null, string Suppliers = null, string Factories = null, string Origins = null, string OriginPorts = null, string Depts = null) { GetItemSearchDto getSearchItem = await _prcService.SearchItem(); ViewBag.Suppliers = getSearchItem.Suppliers; ViewBag.Origins = getSearchItem.Origins; ViewBag.OriginPorts = getSearchItem.OriginPorts; ViewBag.Factories = getSearchItem.Factories; ViewBag.Depts = getSearchItem.Depts; ViewBag.ErrorList = "No result match, please try again"; PagedListResult <ProgressCheckDto> lstPrc = await _prcService.ListProgressCheckDtoAsync(); List <ProgressCheckDto> progressCheckDtos = lstPrc.Items; if (PONumberSearch != null) { progressCheckDtos = progressCheckDtos.Where(p => p.PONumber == PONumberSearch).ToList(); } if (!String.IsNullOrEmpty(Suppliers) || !String.IsNullOrEmpty(Factories)) { progressCheckDtos = progressCheckDtos.Where(p => p.Supplier == Suppliers || p.Factory == Factories).ToList(); } if (!String.IsNullOrEmpty(Origins) || !String.IsNullOrEmpty(OriginPorts)) { progressCheckDtos = progressCheckDtos.Where(p => p.Origin == Origins || p.OriginPort == OriginPorts).ToList(); } List <ProgressCheckDto> model = progressCheckDtos; return(View("Index", model)); }
// GET: ProgressCheckDto public async Task <ActionResult> Index(int?pageIndex, string PONumberSearch = null, string ItemSearch = null, string Vendor = null, string Factories = null, string Origins = "Hong Kong", string OriginPorts = null, string Depts = null, string Status = null, bool?checkClick = null) { string check = PONumberSearch + ItemSearch + Vendor + Factories + Origins + OriginPorts + Depts + Status; GetItemSearchDto getSearchItem = await _prcService.SearchItem(); ViewBag.Suppliers = getSearchItem.Suppliers; ViewBag.VNPorts = new List <string> { "Cam Pha", "Cua Lo", "Hai Phong", "Hon Gai", "Nghi Son" }; ViewBag.HKPorts = new List <string> { "Aberdeen", "Crooked Harbour", "Double Haven", "Gin Drinkers Bay", "Inner Port Shelter" }; ViewBag.Origins = new List <string> { "Hong Kong", "Vietnam" }; ViewBag.Factories = getSearchItem.Factories; ViewBag.Depts = getSearchItem.Depts; ViewBag.Status = getSearchItem.Status; int current = pageIndex ?? 1; ViewBag.pageIndex = current; if (Origins == null) { Origins = "Hong Kong"; } PagedListResult <ProgressCheckDto> lstPrc = await _prcService.ListProgressCheckDtoAsync(current, 2, PONumberSearch, ItemSearch, Vendor, Factories, Origins, OriginPorts, Depts, Status); lstPrc.CurrentFilter = current.ToString(); foreach (var item in lstPrc.Items) { item.ListOrderDetailDto.OrderBy(p => p.ItemNumber); } if (checkClick == true) { return(PartialView("_SearchingPartial", lstPrc)); } return(View("Index", lstPrc)); }