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;
        }
Example #2
0
        /// <summary>
        /// Based on Type calls different methods for retreiving data
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="listState"></param>
        /// <param name="userAccounts"></param>
        /// <param name="userId"></param>
        /// <param name="searchValue"></param>
        /// <returns></returns>
        private object HandleRetrieveQueueLoans <T>(T listState, List <int> userAccounts, int userId, String searchValue)
        {
            FilterViewModel userFilterViewModel = null;

            if ((base.HttpContext != null) && (base.HttpContext.Session[SessionHelper.FilterViewModel] != null))
            {
                userFilterViewModel = new FilterViewModel().FromXml(base.HttpContext.Session[SessionHelper.FilterViewModel].ToString());
            }
            else
            {
                userFilterViewModel = new FilterViewModel();
            }

            if (listState is NewLoanApplicationListState)
            {
                return(( object )NewLoanApplicationDataHelper.RetrieveNewApplicationViewModel((listState as NewLoanApplicationListState), userAccounts, userId, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId, searchValue));
            }
            if (listState is OrderExceptionListState)
            {
                return(( object )OrderExceptionDataHelper.RetrieveOrderExceptionViewModel((listState as OrderExceptionListState), userAccounts, userId, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId, searchValue));
            }
            if (listState is OrderDeliveredForReviewListState)
            {
                return(( object )OrderDeliveredForReviewDataHelper.RetrieveOrderDeliveredForReviewViewModel((listState as OrderDeliveredForReviewListState), userAccounts, userId, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId, searchValue));
            }
            if (listState is OrderProcessedListState)
            {
                return(( object )OrderProcessedDataHelper.RetrieveOrderProcessedViewModel((listState as OrderProcessedListState), userAccounts, userId, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId, searchValue));
            }
            if (listState is OrderRequestedListState)
            {
                return(( object )OrderRequestedDataHelper.RetrieveOrderRequestedViewModel((listState as OrderRequestedListState), userAccounts, userId, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId, searchValue));
            }
            if (listState is CompletedLoansListState)
            {
                return(( object )CompletedLoansDataHelper.RetrieveCompletedLoansViewModel((listState as CompletedLoansListState), userAccounts, userId, searchValue, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId));
            }
            if (listState is CancelLoanListState)
            {
                return(( object )CancelDataHelper.RetrieveCancelViewModel((listState as CancelLoanListState), userAccounts,
                                                                          ((listState as CancelLoanListState)).BoundDate, userId, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId, searchValue));
            }
            if (listState is AlertsListState)
            {
                return(( object )AlertsDataHelper.RetrieveAlertViewModel((listState as AlertsListState), userAccounts,
                                                                         (listState as AlertsListState).BoundDate, userId, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId));
            }
            if (listState is PendingApprovalListState)
            {
                return(( object )PendingApprovalDataHelper.RetrievePendingApprovalViewModel((listState as PendingApprovalListState), userAccounts, userId, searchValue, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId
                                                                                            ));
            }
            if (listState is PreApprovalListState)
            {
                return(( object )PreApprovalDataHelper.RetrievePreApprovalViewModel((listState as PreApprovalListState), userAccounts, userId, searchValue, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId));
            }
            if (listState is PipelineListState)
            {
                return(( object )PipelineDataHelper.RetrievePipelineViewModel((listState as PipelineListState), userAccounts, userId, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId, searchValue));
            }

            if (listState is MailRoomListState)
            {
                return(( object )MailRoomDataHelper.RetrieveMailRoomViewModel((listState as MailRoomListState), userAccounts, userId, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId, searchValue));
            }

            return(null);
        }
Example #3
0
        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;
        }
Example #4
0
        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;
        }