コード例 #1
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);
        }
        public override void Execute()
        {
            var searchValue = CommonHelper.GetSearchValue(base.HttpContext);

            /* State retrieval */
            var orderProcessedViewModel =
                base.HttpContext.Session[SessionHelper.OrderProcessedViewModel] != null ?
                new OrderProcessedViewModel().FromXml(base.HttpContext.Session[SessionHelper.OrderProcessedViewModel].ToString()) :
                new OrderProcessedViewModel();

            OrderProcessedListState orderProcessedListState;

            if (base.HttpContext.Session[SessionHelper.OrderProcessedListState] != null)
            {
                orderProcessedListState = ( OrderProcessedListState )base.HttpContext.Session[SessionHelper.OrderProcessedListState];
            }
            else
            {
                orderProcessedListState = new OrderProcessedListState();
            }

            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.OrderProcessed;
            }
            else
            {
                filterViewModel = new FilterViewModel();
                filterViewModel.FilterContext = Helpers.Enums.FilterContextEnum.OrderProcessed;
            }

            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 */
            OrderProcessedAttribute newSortColumn;

            if (!InputParameters.ContainsKey("Column"))
            {
                throw new ArgumentException("Column value was expected!");
            }

            newSortColumn = ( OrderProcessedAttribute )Enum.Parse(typeof(OrderProcessedAttribute), InputParameters["Column"].ToString());

            // switch direction
            if (orderProcessedListState.SortColumn == newSortColumn && orderProcessedListState.SortDirection == "ASC")
            {
                orderProcessedListState.SortDirection = "DESC";
            }
            else
            {
                orderProcessedListState.SortDirection = "ASC";
            }

            orderProcessedListState.SortColumn  = newSortColumn;
            orderProcessedListState.CurrentPage = 1;

            /* Command processing */

            var orderProcessedViewData = OrderProcessedDataHelper.RetrieveOrderProcessedViewModel(orderProcessedListState,
                                                                                                  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);


            if (orderProcessedViewModel != null)
            {
                orderProcessedViewModel.ProcessedOrders = orderProcessedViewData.ProcessedOrders;
                orderProcessedViewModel.PageCount       = orderProcessedViewData.PageCount;
                orderProcessedViewModel.TotalItems      = orderProcessedViewData.TotalItems;

                OrderProcessedGridHelper.ProcessPagingOptions(orderProcessedListState, orderProcessedViewModel);
            }


            ViewName = "Queues/_orderProcessed";
            ViewData = orderProcessedViewModel;

            /* Persist new state */
            base.HttpContext.Session[SessionHelper.OrderProcessedViewModel] = orderProcessedViewModel.ToXml();
            base.HttpContext.Session[SessionHelper.OrderProcessedListState] = orderProcessedListState;
        }
コード例 #3
0
        public override void Execute()
        {
            String serarchValue = CommonHelper.GetSearchValue(base.HttpContext);

            OrderProcessedListState orderProcessedListState = null;

            if (base.HttpContext != null && base.HttpContext.Session[SessionHelper.OrderProcessedListState] != null)
            {
                orderProcessedListState = ( OrderProcessedListState )base.HttpContext.Session[SessionHelper.OrderProcessedListState];
            }
            else
            {
                orderProcessedListState = new OrderProcessedListState();
            }

            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.OrderProcessed;
            }
            else
            {
                filterViewModel = new FilterViewModel();
                filterViewModel.FilterContext = Helpers.Enums.FilterContextEnum.OrderProcessed;
            }

            Boolean refresh = InputParameters != null && InputParameters.ContainsKey("Refresh") && InputParameters["Refresh"].ToString().Trim() == "true";

            if (!refresh)
            {
                orderProcessedListState.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");
            }

            OrderProcessedViewModel orderProcessedViewModel = new OrderProcessedViewModel();

            orderProcessedViewModel = OrderProcessedDataHelper.RetrieveOrderProcessedViewModel(orderProcessedListState,
                                                                                               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);

            OrderProcessedGridHelper.ProcessPagingOptions(orderProcessedListState, orderProcessedViewModel);
            OrderProcessedGridHelper.ApplyClassCollection(orderProcessedViewModel);

            ViewName = "Queues/_orderProcessed";
            ViewData = orderProcessedViewModel;

            /* Persist new state */
            base.HttpContext.Session[SessionHelper.OrderProcessedViewModel] = orderProcessedViewModel.ToXml();
            base.HttpContext.Session[SessionHelper.OrderProcessedListState] = orderProcessedListState;
            base.HttpContext.Session[SessionHelper.FilterViewModel]         = filterViewModel.ToXml();
            base.HttpContext.Session[SessionHelper.CurrentTab] = LoanCenterTab.OrderProcessed;
        }
        public override void Execute()
        {
            var searchValue = CommonHelper.GetSearchValue(base.HttpContext);

            OrderProcessedListState orderProcessedListState;

            if (base.HttpContext.Session[SessionHelper.OrderProcessedListState] != null)
            {
                orderProcessedListState = ( OrderProcessedListState )base.HttpContext.Session[SessionHelper.OrderProcessedListState];
            }
            else
            {
                orderProcessedListState = new OrderProcessedListState();
            }

            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.OrderProcessed;
            }
            else
            {
                filterViewModel = new FilterViewModel();
                filterViewModel.FilterContext = Helpers.Enums.FilterContextEnum.OrderProcessed;
            }

            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("Page"))
            {
                throw new ArgumentException("Page number was expected!");
            }

            var newPageNumber = Convert.ToInt32(InputParameters["Page"]);

            orderProcessedListState.CurrentPage = newPageNumber;

            OrderProcessedViewModel orderProcessedViewModel = OrderProcessedDataHelper.RetrieveOrderProcessedViewModel(orderProcessedListState,
                                                                                                                       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/_orderProcessed";
            ViewData = orderProcessedViewModel;

            /* Persist new state */
            base.HttpContext.Session[SessionHelper.OrderProcessedViewModel] = orderProcessedViewModel.ToXml();
            base.HttpContext.Session[SessionHelper.OrderProcessedListState] = orderProcessedListState;
        }