public override void Execute() { base.Execute(); var searchValue = CommonHelper.GetSearchValue(base.HttpContext); FilterViewModel filterViewModel = null; if (base.HttpContext != null && base.HttpContext.Session[SessionHelper.FilterViewModel] != null) { filterViewModel = new FilterViewModel().FromXml(base.HttpContext.Session[SessionHelper.FilterViewModel].ToString()); filterViewModel.FilterContext = Helpers.Enums.FilterContextEnum.OrderRequested; } else { filterViewModel = new FilterViewModel(); filterViewModel.FilterContext = Helpers.Enums.FilterContextEnum.OrderRequested; } OrderRequestedListState orderRequestedListState; if (base.HttpContext.Session[SessionHelper.OrderRequestedListState] != null) { orderRequestedListState = ( OrderRequestedListState )base.HttpContext.Session[SessionHelper.OrderRequestedListState]; } else { orderRequestedListState = new OrderRequestedListState(); } if (!InputParameters.ContainsKey("NonConforming")) { throw new ArgumentException("NonConforming was expected!"); } orderRequestedListState.NonConformingFilter = InputParameters["NonConforming"].ToString() == "-1" ? null : InputParameters["NonConforming"].ToString(); orderRequestedListState.CurrentPage = 1; OrderRequestedViewModel orderRequestedViewModel = OrderRequestedDataHelper.RetrieveOrderRequestedViewModel(orderRequestedListState, base.HttpContext.Session[SessionHelper.UserAccountIds] != null ? (List <int>)base.HttpContext.Session[SessionHelper.UserAccountIds] : new List <int> { }, base.User.UserAccountId, filterViewModel.CompanyId, filterViewModel.ChannelId, filterViewModel.DivisionId, filterViewModel.BranchId, CommonHelper.GetSearchValue(base.HttpContext)); base.ViewName = "Queues/_orderRequested"; base.ViewData = orderRequestedViewModel; /* Persist new state */ base.HttpContext.Session[SessionHelper.OrderRequestedViewModel] = orderRequestedViewModel.ToXml(); base.HttpContext.Session[SessionHelper.OrderRequestedListState] = orderRequestedListState; }
public static OrderRequestedViewModel RetrieveOrderRequestedViewModel(OrderRequestedListState orderRequestedListState, List <int> userAccountIds, int userAccountId, Guid companyId, int channelId, int divisionId, Guid branchId, string searchTerm = null) { if (orderRequestedListState == null) { orderRequestedListState = new OrderRequestedListState(); } if (userAccountIds == null) { userAccountIds = new List <Int32>(); } OrderRequestedViewData orderRequestedViewData = LoanServiceFacade.RetrieveOrderRequestedLoans(userAccountIds, orderRequestedListState.CurrentPage, orderRequestedListState.SortColumn.GetStringValue(), orderRequestedListState.SortDirection, orderRequestedListState.BoundDate, orderRequestedListState.OrderType, orderRequestedListState.NonConforming, orderRequestedListState.Rush, orderRequestedListState.LoanPurposeFilter, orderRequestedListState.NonConformingFilter, orderRequestedListState.RushFilter, userAccountId, searchTerm, companyId, channelId, divisionId, branchId); if (orderRequestedViewData == null) { orderRequestedViewData = new OrderRequestedViewData { RequestedOrders = new List <RequestedOrdersView>(), TotalItems = 0, TotalPages = 0 }; } OrderRequestedViewModel orderRequestedViewModel = new OrderRequestedViewModel { RequestedOrders = orderRequestedViewData.RequestedOrders, PageCount = orderRequestedViewData.TotalPages, LoanPurposeList = new List <LoanTransactionType>(Enum.GetValues(typeof(LoanTransactionType)).Cast <LoanTransactionType>().Skip(1)), TotalItems = orderRequestedViewData.TotalItems }; OrderRequestedGridHelper.ProcessPagingOptions(orderRequestedListState, orderRequestedViewModel); OrderRequestedGridHelper.ApplyClassCollection(orderRequestedViewModel); return(orderRequestedViewModel); }
public static void ApplyClassCollection(OrderRequestedViewModel orderRequestedViewModel) { if (orderRequestedViewModel.RequestedOrders != null) { foreach (var item in orderRequestedViewModel.RequestedOrders) { item.ClassCollection = "orderrequestedtablelist"; if (item.ExceptionItemMaxWeight != -1) { item.ExceptionClassCollection = item.ExceptionItemMaxWeight < 300 ? "exceptionIcon exceptionIcon0" : "exceptionIcon exceptionIcon1"; } } } }
public override void Execute() { var searchValue = CommonHelper.GetSearchValue(base.HttpContext); FilterViewModel filterViewModel = null; if (base.HttpContext != null && base.HttpContext.Session[SessionHelper.FilterViewModel] != null) { filterViewModel = new FilterViewModel().FromXml(base.HttpContext.Session[SessionHelper.FilterViewModel].ToString()); filterViewModel.FilterContext = Helpers.Enums.FilterContextEnum.OrderRequested; } else { filterViewModel = new FilterViewModel(); filterViewModel.FilterContext = Helpers.Enums.FilterContextEnum.OrderRequested; } OrderRequestedListState orderRequestedListState; if (base.HttpContext.Session[SessionHelper.OrderRequestedListState] != null) { orderRequestedListState = ( OrderRequestedListState )base.HttpContext.Session[SessionHelper.OrderRequestedListState]; } else { orderRequestedListState = new OrderRequestedListState(); } UserAccount user; if (base.HttpContext.Session[SessionHelper.UserData] != null && (( UserAccount )base.HttpContext.Session[SessionHelper.UserData]).Username == base.HttpContext.User.Identity.Name) { user = ( UserAccount )base.HttpContext.Session[SessionHelper.UserData]; } else { user = UserAccountServiceFacade.GetUserByName(base.HttpContext.User.Identity.Name); } if (user == null) { throw new InvalidOperationException("User is null"); } /* parameter processing */ if (!InputParameters.ContainsKey("DateFilter")) { throw new ArgumentException("DateFilter value was expected!"); } var newDateFilterValue = ( GridDateFilter )Enum.Parse(typeof(GridDateFilter), InputParameters["DateFilter"].ToString()); orderRequestedListState.BoundDate = newDateFilterValue; // on date filter change, reset page number orderRequestedListState.CurrentPage = 1; /* Command processing */ OrderRequestedViewModel orderRequestedViewModel = OrderRequestedDataHelper.RetrieveOrderRequestedViewModel(orderRequestedListState, base.HttpContext.Session[SessionHelper.UserAccountIds] != null ? (List <int>) base.HttpContext.Session[SessionHelper.UserAccountIds] : new List <int> { }, user.UserAccountId, filterViewModel.CompanyId, filterViewModel.ChannelId, filterViewModel.DivisionId, filterViewModel.BranchId, searchValue); ViewName = "Queues/_orderRequested"; ViewData = orderRequestedViewModel; /* Persist new state */ base.HttpContext.Session[SessionHelper.OrderRequestedViewModel] = orderRequestedViewModel.ToXml(); base.HttpContext.Session[SessionHelper.OrderRequestedListState] = orderRequestedListState; }
public static void ProcessPagingOptions(OrderRequestedListState orderRequestedListState, OrderRequestedViewModel orderRequestedViewModel) { if (orderRequestedViewModel.PageCount % 10 == 0) { orderRequestedViewModel.PageGroups = (orderRequestedViewModel.PageCount / 10); } else { orderRequestedViewModel.PageGroups = (orderRequestedViewModel.PageCount / 10) + 1; } orderRequestedViewModel.PageGroups = ( int )orderRequestedViewModel.PageGroups; if (orderRequestedViewModel.PageCount % 10 != 0) { orderRequestedViewModel.LastPageItems = orderRequestedViewModel.PageCount % 10; } else { orderRequestedViewModel.LastPageItems = 10; } orderRequestedViewModel.CurrentPage = orderRequestedListState.CurrentPage; if (orderRequestedViewModel.CurrentPage % 10 != 0) { orderRequestedViewModel.StartPage = ( int )(orderRequestedViewModel.CurrentPage / 10) * 10 + 1; if ((( int )((orderRequestedViewModel.CurrentPage) / 10) + 1) == orderRequestedViewModel.PageGroups) { orderRequestedViewModel.EndPage = ( int )(orderRequestedViewModel.CurrentPage / 10) * 10 + orderRequestedViewModel.LastPageItems; orderRequestedViewModel.LastPageDots = true; } else { orderRequestedViewModel.EndPage = ( int )(orderRequestedViewModel.CurrentPage / 10) * 10 + 10; orderRequestedViewModel.LastPageDots = false; } } else { orderRequestedViewModel.StartPage = ( int )((orderRequestedViewModel.CurrentPage - 1) / 10) * 10 + 1; if ((( int )((orderRequestedViewModel.CurrentPage - 1) / 10) + 1) == orderRequestedViewModel.PageGroups) { orderRequestedViewModel.EndPage = ( int )(orderRequestedViewModel.CurrentPage / 10) * 10; orderRequestedViewModel.LastPageDots = true; } else { orderRequestedViewModel.EndPage = ( int )((orderRequestedViewModel.CurrentPage - 1) / 10) * 10 + 10; orderRequestedViewModel.LastPageDots = false; } } }
public override void Execute() { String serarchValue = CommonHelper.GetSearchValue(base.HttpContext); OrderRequestedListState orderRequestedListState = null; if (base.HttpContext != null && base.HttpContext.Session[SessionHelper.OrderRequestedListState] != null) { orderRequestedListState = ( OrderRequestedListState )base.HttpContext.Session[SessionHelper.OrderRequestedListState]; } else { orderRequestedListState = new OrderRequestedListState(); } FilterViewModel filterViewModel = null; if (base.HttpContext != null && base.HttpContext.Session[SessionHelper.FilterViewModel] != null) { filterViewModel = new FilterViewModel().FromXml(base.HttpContext.Session[SessionHelper.FilterViewModel].ToString()); filterViewModel.FilterContext = Helpers.Enums.FilterContextEnum.OrderRequested; } else { filterViewModel = new FilterViewModel(); filterViewModel.FilterContext = Helpers.Enums.FilterContextEnum.OrderRequested; } Boolean refresh = InputParameters != null && InputParameters.ContainsKey("Refresh") && InputParameters["Refresh"].ToString().Trim() == "true"; if (!refresh) { orderRequestedListState.CurrentPage = 1; } UserAccount user = null; if (base.HttpContext.Session[SessionHelper.UserData] != null) { user = ( UserAccount )base.HttpContext.Session[SessionHelper.UserData]; } else { throw new InvalidOperationException("UserData is null"); } OrderRequestedViewModel orderRequestedViewModel = new OrderRequestedViewModel(); orderRequestedViewModel = OrderRequestedDataHelper.RetrieveOrderRequestedViewModel(orderRequestedListState, base.HttpContext.Session[SessionHelper.UserAccountIds] != null ? (List <int>)base.HttpContext.Session[SessionHelper.UserAccountIds] : new List <int> { }, user.UserAccountId, filterViewModel.CompanyId, filterViewModel.ChannelId, filterViewModel.DivisionId, filterViewModel.BranchId, serarchValue); OrderRequestedGridHelper.ProcessPagingOptions(orderRequestedListState, orderRequestedViewModel); OrderRequestedGridHelper.ApplyClassCollection(orderRequestedViewModel); ViewName = "Queues/_orderRequested"; ViewData = orderRequestedViewModel; /* Persist new state */ base.HttpContext.Session[SessionHelper.OrderRequestedViewModel] = orderRequestedViewModel.ToXml(); base.HttpContext.Session[SessionHelper.OrderRequestedListState] = orderRequestedListState; base.HttpContext.Session[SessionHelper.FilterViewModel] = filterViewModel.ToXml(); base.HttpContext.Session[SessionHelper.CurrentTab] = LoanCenterTab.OrderRequested; }