public void Execute() { String searchValue = CommonHelper.GetSearchValue(_httpContext); /* State retrieval */ PendingApprovalViewModel pendingApprovalViewModel = null; if (_httpContext.Session[SessionHelper.PendingApprovalViewModel] != null) { pendingApprovalViewModel = new PendingApprovalViewModel().FromXml(_httpContext.Session[SessionHelper.PendingApprovalViewModel].ToString()); } else { pendingApprovalViewModel = new PendingApprovalViewModel(); } PendingApprovalListState pendingApprovalListState = null; if (_httpContext.Session[SessionHelper.PendingApprovalListState] != null) { pendingApprovalListState = ( PendingApprovalListState )_httpContext.Session[SessionHelper.PendingApprovalListState]; } else { pendingApprovalListState = new PendingApprovalListState(); } UserAccount user = null; if (_httpContext.Session[SessionHelper.UserData] != null && ((UserAccount)_httpContext.Session[SessionHelper.UserData]).Username == _httpContext.User.Identity.Name) { user = (UserAccount)_httpContext.Session[SessionHelper.UserData]; } else { user = UserAccountServiceFacade.GetUserByName(_httpContext.User.Identity.Name); } if (user == null) { throw new InvalidOperationException("User is null"); } /* parameter processing */ Int32 newPageNumber = 0; if (!InputParameters.ContainsKey("Page")) { throw new ArgumentException("Page number was expected!"); } else { newPageNumber = Convert.ToInt32(InputParameters["Page"]); } pendingApprovalListState.CurrentPage = newPageNumber; FilterViewModel userFilterViewModel = null; if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null)) { userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString()); } else { userFilterViewModel = new FilterViewModel(); } pendingApprovalViewModel = PendingApprovalDataHelper.RetrievePendingApprovalViewModel(pendingApprovalListState, _httpContext.Session[SessionHelper.UserAccountIds] != null ? (List <int>)_httpContext.Session[SessionHelper.UserAccountIds] : new List <int> { }, user.UserAccountId, searchValue, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId); _viewName = "Queues/_pendingapproval"; _viewModel = pendingApprovalViewModel; /* Persist new state */ _httpContext.Session[SessionHelper.PendingApprovalViewModel] = pendingApprovalViewModel.ToXml(); _httpContext.Session[SessionHelper.PendingApprovalListState] = pendingApprovalListState; }
public void Execute() { String searchValue = CommonHelper.GetSearchValue(_httpContext); PendingApprovalListState pendingApprovalListState = null; if ((_httpContext != null) && (_httpContext.Session[SessionHelper.PendingApprovalListState] != null)) { pendingApprovalListState = ( PendingApprovalListState )_httpContext.Session[SessionHelper.PendingApprovalListState]; } else { pendingApprovalListState = new PendingApprovalListState(); } FilterViewModel userFilterViewModel = null; if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null)) { userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString()); userFilterViewModel.FilterContext = FilterContextEnum.PendingApproval; } else { // possible state retrieval? userFilterViewModel = new FilterViewModel { FilterContext = FilterContextEnum.PendingApproval }; } Boolean refresh = InputParameters != null && InputParameters.ContainsKey("Refresh") && InputParameters["Refresh"].ToString().Trim() == "true"; // reset Page Number to 1st on Tab change if (!refresh) { pendingApprovalListState.CurrentPage = 1; } UserAccount user = null; if (_httpContext.Session[SessionHelper.UserData] != null) { user = ( UserAccount )_httpContext.Session[SessionHelper.UserData]; } else { throw new InvalidOperationException("UserData is null"); } var pendingApprovalViewModel = new PendingApprovalViewModel(); pendingApprovalViewModel = PendingApprovalDataHelper.RetrievePendingApprovalViewModel(pendingApprovalListState, _httpContext.Session[SessionHelper.UserAccountIds] != null ? (List <int>)_httpContext.Session[SessionHelper.UserAccountIds] : new List <int> { }, user.UserAccountId, searchValue, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId); _viewName = "Queues/_pendingapproval"; _viewModel = pendingApprovalViewModel; /* Persist new state */ _httpContext.Session[SessionHelper.PendingApprovalViewModel] = pendingApprovalViewModel.ToXml(); _httpContext.Session[SessionHelper.PendingApprovalListState] = pendingApprovalListState; _httpContext.Session[SessionHelper.FilterViewModel] = userFilterViewModel.ToXml(); _httpContext.Session[SessionHelper.CurrentTab] = LoanCenterTab.PendingApproval; }
public void Execute() { String searchValue = CommonHelper.GetSearchValue(_httpContext); /* State retrieval */ PendingApprovalViewModel pendingApprovalViewModel = null; if (_httpContext.Session[SessionHelper.PendingApprovalViewModel] != null) { pendingApprovalViewModel = new PendingApprovalViewModel().FromXml(_httpContext.Session[SessionHelper.PendingApprovalViewModel].ToString()); } else { pendingApprovalViewModel = new PendingApprovalViewModel(); } PendingApprovalListState pendingApprovalListState = null; if (_httpContext.Session[SessionHelper.PendingApprovalListState] != null) { pendingApprovalListState = ( PendingApprovalListState )_httpContext.Session[SessionHelper.PendingApprovalListState]; } else { pendingApprovalListState = new PendingApprovalListState(); } UserAccount user = null; if (_httpContext.Session[SessionHelper.UserData] != null && ((UserAccount)_httpContext.Session[SessionHelper.UserData]).Username == _httpContext.User.Identity.Name) { user = ( UserAccount )_httpContext.Session[SessionHelper.UserData]; } else { user = UserAccountServiceFacade.GetUserByName(_httpContext.User.Identity.Name); } if (user == null) { throw new InvalidOperationException("User is null"); } /* parameter processing */ PendingApprovalAttribute newSortColumn; if (!InputParameters.ContainsKey("Column")) { throw new ArgumentException("Column value was expected!"); } else { newSortColumn = ( PendingApprovalAttribute )Enum.Parse(typeof(PendingApprovalAttribute), InputParameters["Column"].ToString()); } // switch direction if (pendingApprovalListState.SortColumn == newSortColumn && pendingApprovalListState.SortDirection == "ASC") { pendingApprovalListState.SortDirection = "DESC"; } else { pendingApprovalListState.SortDirection = "ASC"; } pendingApprovalListState.SortColumn = newSortColumn; pendingApprovalListState.CurrentPage = 1; /* Command processing */ FilterViewModel userFilterViewModel = null; if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null)) { userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString()); } else { userFilterViewModel = new FilterViewModel(); } var pendingApprovalViewData = PendingApprovalDataHelper.RetrievePendingApprovalViewModel(pendingApprovalListState, _httpContext.Session[SessionHelper.UserAccountIds] != null ? (List <int>) _httpContext.Session[ SessionHelper.UserAccountIds] : new List <int> { }, user.UserAccountId, searchValue, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId); if (pendingApprovalViewModel != null) { pendingApprovalViewModel.PendingApprovalItems = pendingApprovalViewData.PendingApprovalItems; pendingApprovalViewModel.PageCount = pendingApprovalViewData.PageCount; pendingApprovalViewModel.TotalItems = pendingApprovalViewData.TotalItems; PendingApprovalGridHelper.ProcessPagingOptions(pendingApprovalListState, pendingApprovalViewModel); } _viewName = "Queues/_pendingapproval"; _viewModel = pendingApprovalViewModel; /* Persist new state */ _httpContext.Session[SessionHelper.PendingApprovalViewModel] = pendingApprovalViewModel.ToXml(); _httpContext.Session[SessionHelper.PendingApprovalListState] = pendingApprovalListState; }
public void Execute() { String searchValue = CommonHelper.GetSearchValue(_httpContext); /* State retrieval */ PendingApprovalViewModel pendingApprovalViewModel = null; if (_httpContext.Session[SessionHelper.PendingApprovalViewModel] != null) { pendingApprovalViewModel = new PendingApprovalViewModel().FromXml(_httpContext.Session[SessionHelper.PendingApprovalViewModel].ToString()); } else { pendingApprovalViewModel = new PendingApprovalViewModel(); } PendingApprovalListState pendingApprovalListState = null; if (_httpContext.Session[SessionHelper.PendingApprovalListState] != null) { pendingApprovalListState = ( PendingApprovalListState )_httpContext.Session[SessionHelper.PendingApprovalListState]; } else { pendingApprovalListState = new PendingApprovalListState(); } UserAccount user = null; if (_httpContext.Session[SessionHelper.UserData] != null && ((UserAccount)_httpContext.Session[SessionHelper.UserData]).Username == _httpContext.User.Identity.Name) { user = ( UserAccount )_httpContext.Session[SessionHelper.UserData]; } else { user = UserAccountServiceFacade.GetUserByName(_httpContext.User.Identity.Name); } if (user == null) { throw new InvalidOperationException("User is null"); } /* parameter processing */ if (!InputParameters.ContainsKey("ActivityFilter")) { throw new ArgumentException("ActivityFilter value was expected!"); } var newActivityFilterValue = ( GridActivityTypeFilter )Enum.Parse(typeof(GridActivityTypeFilter), InputParameters["ActivityFilter"].ToString()); pendingApprovalListState.ActivityType = newActivityFilterValue; // on date filter change, reset page number pendingApprovalListState.CurrentPage = 1; /* Command processing */ FilterViewModel userFilterViewModel = null; if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null)) { userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString()); } else { userFilterViewModel = new FilterViewModel(); } pendingApprovalViewModel = PendingApprovalDataHelper.RetrievePendingApprovalViewModel(pendingApprovalListState, _httpContext.Session[SessionHelper.UserAccountIds] != null ? (List <int>) _httpContext.Session[SessionHelper.UserAccountIds] : new List <int> { }, user.UserAccountId, searchValue, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId); _viewName = "Queues/_pendingApproval"; _viewModel = pendingApprovalViewModel; /* Persist new state */ _httpContext.Session[SessionHelper.PendingApprovalViewModel] = pendingApprovalViewModel.ToXml(); _httpContext.Session[SessionHelper.PendingApprovalListState] = pendingApprovalListState; }