public PopulateStatusCodes ( string>.IRepositoryWithTypedId |
||
statusCodeRepository | string>.IRepositoryWithTypedId | |
orderStatusCodes | string>.List | |
return | void |
public ActionResult AccountsPayableOrders(string selectedOrderStatus, DateTime? startDate, DateTime? endDate, DateTime? startLastActionDate, DateTime? endLastActionDate) { if (selectedOrderStatus == null && startDate == null && endDate == null && startLastActionDate == null && endLastActionDate == null) { startLastActionDate = DateTime.UtcNow.ToPacificTime().AddDays(-121); } if (selectedOrderStatus == "All") { selectedOrderStatus = null; } string received = null; if (selectedOrderStatus == "Received" || selectedOrderStatus == "UnReceived") { if (selectedOrderStatus == "Received") { received = "yes"; } else if (selectedOrderStatus == "UnReceived") { received = "no"; } selectedOrderStatus = OrderStatusCode.Codes.Complete; } string paid = null; if (selectedOrderStatus == "Paid" || selectedOrderStatus == "UnPaid") { if (selectedOrderStatus == "Paid") { paid = "yes"; } else if (selectedOrderStatus == "UnPaid") { paid = "no"; } selectedOrderStatus = OrderStatusCode.Codes.Complete; } var ordersIndexed = _orderService.GetAccountsPayableIndexedListofOrders(received, paid, selectedOrderStatus, startDate, endDate, startLastActionDate, endLastActionDate); ViewBag.IndexLastModified = ordersIndexed.LastModified; var orders = ordersIndexed.Results.AsQueryable(); var model = new FilteredOrderListModelDto { SelectedOrderStatus = selectedOrderStatus, StartDate = startDate, EndDate = endDate, StartLastActionDate = startLastActionDate, EndLastActionDate = endLastActionDate, ShowPending = false, ColumnPreferences = _repositoryFactory.ColumnPreferencesRepository.GetNullableById( CurrentUser.Identity.Name) ?? new ColumnPreferences(CurrentUser.Identity.Name) }; ViewBag.DataTablesPageSize = model.ColumnPreferences.DisplayRows; PopulateModel(orders.ToList(), model); model.PopulateStatusCodes(null, new List<Tuple<string, string>> { new Tuple<string, string>("All", "All"), new Tuple<string, string>("Received", "Received"), new Tuple<string, string>("UnReceived", "UnReceived"), new Tuple<string, string>("Paid", "Paid"), new Tuple<string, string>("UnPaid", "UnPaid") }); if (model.OrderHistory.Count >= 1000) { Message = "We are only displaying the 1,000 most recently acted on orders, so there may be older orders which are not included. Adjust your filters to be more specific or use the “Search Your Orders” feature to find those much older orders if necessary."; } return View("AccountsPayableOrders", model); }
private void PopulateModel(List<OrderHistory> orders, FilteredOrderListModelDto model) { model.OrderHistory = orders; model.PopulateStatusCodes(_repositoryFactory.OrderStatusCodeRepository); }