public ActionResult ShowPodAll(ShowPodAllViewModel vm, int?PageIndex) { vm.SearchCondition.UserType = base.UserInfo.UserType; if (vm.SearchCondition.UserType == 2) { vm.SearchCondition.CustomerIDs = ApplicationConfigHelper.GetProjectUserCustomers(base.UserInfo.ProjectID, base.UserInfo.ID).Select(c => c.CustomerID); } else if (vm.SearchCondition.UserType == 0) { vm.SearchCondition.Types = new List <int>(); vm.SearchCondition.Types.Add(0); vm.SearchCondition.Types.Add(2); } else { vm.SearchCondition.Types = new List <int>(); vm.SearchCondition.Types.Add(1); vm.SearchCondition.Types.Add(2); } var result = new PodReportService().QueryPodAndInvoiceAndReceiveOrPayOrders(new QueryPodAndInvoiceAndReceiveOrPayOrdersRequest() { PageSize = 10, PageIndex = PageIndex ?? 0, SearchCondition = vm.SearchCondition, ProjectID = base.UserInfo.ProjectID }).Result; vm.PodInvoiceReceiveOrPayOrders = result.PodInvoiceReceiveOrPayOrders; vm.PageIndex = result.PageIndex; vm.PageCount = result.PageCount; this.GenQueryPodViewModel(vm); return(View(vm)); }
private void GenQueryPodViewModel(ShowPodAllViewModel vm) { vm.Config = ((Projects)ApplicationConfigHelper.GetApplicationConfig()).ProjectCollection.First(p => p.Id == base.UserInfo.ProjectID.ToString()).ModuleCollection.First(m => m.Id == "M001").Tables.TableCollection.First(t => t.Name == "Pod"); vm.ShipperTypes = ApplicationConfigHelper.GetSystemConfigs(base.UserInfo.ProjectID, WebConstants.SHIPPERTYPE) .Select(c => new SelectListItem() { Value = c.ID.ToString(), Text = c.Name }); vm.PodStates = ApplicationConfigHelper.GetApplicationConfigs(WebConstants.PODSTATE) .Select(c => new SelectListItem() { Value = c.ID.ToString(), Text = c.Name }); if (base.UserInfo.UserType == 2) { vm.Customers = ApplicationConfigHelper.GetProjectUserCustomers(base.UserInfo.ProjectID, base.UserInfo.ID) .Select(c => new SelectListItem() { Value = c.CustomerID.ToString(), Text = c.CustomerName }); } else if (base.UserInfo.UserType == 0) { vm.Customers = new List <SelectListItem>() { new SelectListItem() { Value = base.UserInfo.CustomerOrShipperID.ToString(), Text = ApplicationConfigHelper.GetApplicationCustomers().First(c => c.ID == base.UserInfo.CustomerOrShipperID).Name } }; } else { vm.Customers = Enumerable.Empty <SelectListItem>(); } vm.Shippers = ApplicationConfigHelper.GetProjectShippers(base.UserInfo.ProjectID) .Select(c => new SelectListItem() { Value = c.ShipperID.ToString(), Text = c.Name }); vm.PODTypes = ApplicationConfigHelper.GetSystemConfigs(base.UserInfo.ProjectID, WebConstants.PODTYPE) .Select(c => new SelectListItem() { Value = c.ID.ToString(), Text = c.Name }); vm.TtlOrTpls = ApplicationConfigHelper.GetSystemConfigs(base.UserInfo.ProjectID, WebConstants.TTLORTPL) .Select(c => new SelectListItem() { Value = c.ID.ToString(), Text = c.Name }); }
public ActionResult ShowPodAll(long?customerID) { ShowPodAllViewModel vm = new ShowPodAllViewModel(); vm.SearchCondition = new PodSearchCondition(); vm.PageIndex = 0; vm.PageCount = 0; vm.ProjectRoleID = base.UserInfo.ProjectRoleID; vm.IsInnerUser = base.UserInfo.UserType == 2; if (base.UserInfo.UserType == 0) { vm.SearchCondition.CustomerID = base.UserInfo.CustomerOrShipperID; } else if (base.UserInfo.UserType == 1) { vm.SearchCondition.ShipperID = base.UserInfo.CustomerOrShipperID; } else if (base.UserInfo.UserType == 2) { if (customerID.HasValue) { vm.SearchCondition.CustomerID = customerID; } else { var customerIDs = ApplicationConfigHelper.GetProjectUserCustomers(base.UserInfo.ProjectID, base.UserInfo.ID).Select(c => c.CustomerID); if (customerIDs != null && customerIDs.Count() == 1) { vm.SearchCondition.CustomerID = customerIDs.First(); } } } this.GenQueryPodViewModel(vm); return(View(vm)); }