Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        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 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;
        }
Esempio n. 4
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 orderRequestedViewModel =
                base.HttpContext.Session[SessionHelper.OrderRequestedViewModel] != null ?
                new OrderRequestedViewModel().FromXml(base.HttpContext.Session[SessionHelper.OrderRequestedViewModel].ToString()) :
                new OrderRequestedViewModel();

            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");
            }

            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;
            }

            /* parameter processing */
            OrderRequestedAttribute newSortColumn;

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

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

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

            orderRequestedListState.SortColumn  = newSortColumn;
            orderRequestedListState.CurrentPage = 1;

            /* Command processing */

            var orderRequestedViewData = 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);


            if (orderRequestedViewModel != null)
            {
                orderRequestedViewModel.RequestedOrders = orderRequestedViewData.RequestedOrders;
                orderRequestedViewModel.PageCount       = orderRequestedViewData.PageCount;
                orderRequestedViewModel.TotalItems      = orderRequestedViewData.TotalItems;

                OrderRequestedGridHelper.ProcessPagingOptions(orderRequestedListState, orderRequestedViewModel);
            }


            ViewName = "Queues/_orderRequested";
            ViewData = orderRequestedViewModel;

            /* Persist new state */
            base.HttpContext.Session[SessionHelper.OrderRequestedViewModel] = orderRequestedViewModel.ToXml();
            base.HttpContext.Session[SessionHelper.OrderRequestedListState] = orderRequestedListState;
        }