Example #1
0
        public void Execute()
        {
            String searchValue = CommonHelper.GetSearchValue(_httpContext);

            ContactListState contactListState;

            if ((_httpContext != null) && (_httpContext.Session[SessionHelper.ContactListState] != null))
            {
                contactListState = ( ContactListState )_httpContext.Session[SessionHelper.ContactListState];
            }
            else
            {
                contactListState = new ContactListState();
            }

            FilterViewModel userFilterViewModel;

            if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null))
            {
                userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString());
                userFilterViewModel.FilterContext = FilterContextEnum.Contact;
            }
            else
            {
                // possible state retrieval?
                userFilterViewModel = new FilterViewModel {
                    FilterContext = FilterContextEnum.Contact
                };
            }

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

            // reset Page Number to 1st on Tab change
            if (!refresh)
            {
                contactListState.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 isCallCenter   = false;
            var userAccountIds = new List <Int32>();

            if (user.Roles != null)
            {
                var filteredRoles = user.Roles.Where(
                    r => r.RoleName.Equals(RoleName.LoanProcessor) || r.RoleName.Equals(RoleName.Concierge) || r.RoleName.Equals(RoleName.LoanOfficerAssistant) || r.RoleName.Equals(RoleName.Administrator)
                    ).OrderBy(r => r.RolePriority);
                if (filteredRoles != null && filteredRoles.FirstOrDefault() != null)
                {
                    var topPriorityRole = filteredRoles.FirstOrDefault().RoleName;
                    isCallCenter = topPriorityRole.Equals(RoleName.LoanProcessor);
                }
            }

            if (isCallCenter)
            {
                userAccountIds.Add(user.UserAccountId);
            }
            else
            {
                if (_httpContext.Session[SessionHelper.UserAccountIds] != null)
                {
                    userAccountIds = (List <int>)_httpContext.Session[SessionHelper.UserAccountIds];
                }
            }

            var contactViewData = ContactServiceFacade.RetrieveContactsView(_httpContext.Session[SessionHelper.UserAccountIds] != null ? (List <int>)_httpContext.Session[SessionHelper.UserAccountIds] : new List <int> {
            },
                                                                            contactListState.BoundDate,
                                                                            contactListState.CurrentPage,
                                                                            contactListState.SortColumn.GetStringValue(),
                                                                            contactListState.SortDirection,
                                                                            user.UserAccountId,
                                                                            searchValue, contactListState.ContactStatusFilter,
                                                                            userFilterViewModel.CompanyId,
                                                                            userFilterViewModel.ChannelId,
                                                                            userFilterViewModel.DivisionId,
                                                                            contactListState.LoanPurposeFilter,
                                                                            userFilterViewModel.BranchId,
                                                                            contactListState.ConciergeFilter
                                                                            );

            var contactViewModel = new ContactViewModel();

            if (contactViewData != null)
            {
                contactViewModel.Contacts   = contactViewData.ContactsItems;
                contactViewModel.PageCount  = contactViewData.TotalPages;
                contactViewModel.TotalItems = contactViewData.TotalItems;
                ContactGridHelper.ApplyClassCollection(contactViewModel);
                ContactGridHelper.ProcessPagingOptions(contactListState, contactViewModel);
            }

            contactViewModel.ProspectLOConciergeList = ContactViewModelHelper.PopulateProspectLoanOfficers(userFilterViewModel, _httpContext);

            // populate prospect statuses
            ContactViewModelHelper.PopulateProspectStatuses(contactViewModel);

            contactViewModel.ProspectStatusList = ContactViewModelHelper.PopulateProspectStatusList(contactViewModel);

            contactViewModel.LoanPurposeList = new List <LoanTransactionType>(Enum.GetValues(typeof(LoanTransactionType)).Cast <LoanTransactionType>().Skip(1));

            ContactDataHelper contactDataHelper = new ContactDataHelper();

            contactDataHelper.PopulateConciergeFilterList(contactListState, _httpContext, contactViewModel);

            _viewName  = "Queues/_contact";
            _viewModel = contactViewModel;

            /* Persist new state */
            _httpContext.Session[SessionHelper.ContactViewModel] = contactViewModel.ToXml();
            _httpContext.Session[SessionHelper.ContactListState] = contactListState;
            _httpContext.Session[SessionHelper.FilterViewModel]  = userFilterViewModel.ToXml();
            _httpContext.Session[SessionHelper.CurrentTab]       = LoanCenterTab.Prospect;
        }
Example #2
0
        private void RetrieveContacts(List <int> newUserAccountIds, String searchValue)
        {
            ContactListState contactListState = null;

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

            // reset page to 1st on user change
            FilterViewModel userFilterViewModel = null;

            if ((base.HttpContext != null) && (base.HttpContext.Session[SessionHelper.FilterViewModel] != null))
            {
                userFilterViewModel = new FilterViewModel().FromXml(base.HttpContext.Session[SessionHelper.FilterViewModel].ToString());
                userFilterViewModel.FilterContext = FilterContextEnum.Contact;
            }
            else
            {
                // possible state retrieval?
                userFilterViewModel = new FilterViewModel();
                userFilterViewModel.FilterContext = FilterContextEnum.Contact;
            }

            contactListState.CurrentPage = 1;

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

            var contactViewData = ContactServiceFacade.RetrieveContactsView(newUserAccountIds,
                                                                            contactListState.BoundDate,
                                                                            contactListState.CurrentPage,
                                                                            EnumHelper.GetStringValue(contactListState.SortColumn),
                                                                            contactListState.SortDirection, user.UserAccountId, searchValue, contactListState.ContactStatusFilter,
                                                                            userFilterViewModel.CompanyId,
                                                                            userFilterViewModel.ChannelId,
                                                                            userFilterViewModel.DivisionId,
                                                                            contactListState.LoanPurposeFilter,
                                                                            userFilterViewModel.BranchId,
                                                                            contactListState.ConciergeFilter
                                                                            );



            ContactViewModel contactViewModel = new ContactViewModel();

            if (contactViewData != null)
            {
                contactViewModel.Contacts   = contactViewData.ContactsItems;
                contactViewModel.PageCount  = contactViewData.TotalPages;
                contactViewModel.TotalItems = contactViewData.TotalItems;
                ContactGridHelper.ApplyClassCollection(contactViewModel);
                ContactGridHelper.ProcessPagingOptions(contactListState, contactViewModel);
            }

            contactViewModel.ProspectLOConciergeList = ContactViewModelHelper.PopulateProspectLoanOfficers(userFilterViewModel, base.HttpContext);

            // populate prospect statuses
            ContactViewModelHelper.PopulateProspectStatuses(contactViewModel);

            contactViewModel.ProspectStatusList = ContactViewModelHelper.PopulateProspectStatusList(contactViewModel);
            contactViewModel.LoanPurposeList    = new List <LoanTransactionType>(Enum.GetValues(typeof(LoanTransactionType)).Cast <LoanTransactionType>().Skip(1));

            ContactDataHelper contactDataHelper = new ContactDataHelper();

            contactDataHelper.PopulateConciergeFilterList(contactListState, base.HttpContext, contactViewModel);

            base.ViewName = "Queues/_contact";
            base.ViewData = contactViewModel;

            /* Persist new state */
            base.HttpContext.Session[SessionHelper.ContactViewModel] = contactViewModel.ToXml();
            base.HttpContext.Session[SessionHelper.ContactListState] = contactListState;
            base.HttpContext.Session[SessionHelper.FilterViewModel]  = userFilterViewModel.ToXml();
        }
Example #3
0
        public void Execute()
        {
            String searchValue = CommonHelper.GetSearchValue(_httpContext);

            /* State retrieval */


            ContactListState contactListState;

            if (_httpContext.Session[SessionHelper.ContactListState] != null)
            {
                contactListState = (ContactListState)_httpContext.Session[SessionHelper.ContactListState];
            }
            else
            {
                contactListState = new ContactListState();
            }

            UserAccount user;

            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;

            if (!InputParameters.ContainsKey("Page"))
            {
                throw new ArgumentException("Page number was expected!");
            }
            else
            {
                newPageNumber = Convert.ToInt32(InputParameters["Page"]);
            }

            contactListState.CurrentPage = newPageNumber;

            /* Command processing */
            FilterViewModel userFilterViewModel;

            if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null))
            {
                userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString());
                userFilterViewModel.FilterContext = FilterContextEnum.Contact;
            }
            else
            {
                // possible state retrieval?
                userFilterViewModel = new FilterViewModel();
                userFilterViewModel.FilterContext = FilterContextEnum.Contact;
            }

            var contactViewData = ContactServiceFacade.RetrieveContactsView(_httpContext.Session[SessionHelper.UserAccountIds] != null ? (List <int>)_httpContext.Session[SessionHelper.UserAccountIds] : new List <int> {
            },
                                                                            contactListState.BoundDate,
                                                                            contactListState.CurrentPage,
                                                                            contactListState.SortColumn.GetStringValue(),
                                                                            contactListState.SortDirection,
                                                                            user.UserAccountId,
                                                                            searchValue, contactListState.ContactStatusFilter,
                                                                            userFilterViewModel.CompanyId,
                                                                            userFilterViewModel.ChannelId,
                                                                            userFilterViewModel.DivisionId,
                                                                            contactListState.LoanPurposeFilter,
                                                                            userFilterViewModel.BranchId,
                                                                            contactListState.ConciergeFilter
                                                                            );



            ContactViewModel contactViewModel = new ContactViewModel();

            if (contactViewData != null)
            {
                contactViewModel.Contacts   = contactViewData.ContactsItems;
                contactViewModel.PageCount  = contactViewData.TotalPages;
                contactViewModel.TotalItems = contactViewData.TotalItems;
                ContactGridHelper.ApplyClassCollection(contactViewModel);
                ContactGridHelper.ProcessPagingOptions(contactListState, contactViewModel);
            }

            contactViewModel.ProspectLOConciergeList = ContactViewModelHelper.PopulateProspectLoanOfficers(userFilterViewModel, _httpContext);

            // populate prospect statuses
            ContactViewModelHelper.PopulateProspectStatuses(contactViewModel);

            contactViewModel.ProspectStatusList = ContactViewModelHelper.PopulateProspectStatusList(contactViewModel);

            contactViewModel.LoanPurposeList = new List <LoanTransactionType>(Enum.GetValues(typeof(LoanTransactionType)).Cast <LoanTransactionType>().Skip(1));

            ContactDataHelper contactDataHelper = new ContactDataHelper();

            contactDataHelper.PopulateConciergeFilterList(contactListState, _httpContext, contactViewModel);

            _viewName  = "Queues/_contact";
            _viewModel = contactViewModel;

            /* Persist new state */
            _httpContext.Session[SessionHelper.ContactViewModel] = contactViewModel.ToXml();
            _httpContext.Session[SessionHelper.ContactListState] = contactListState;
            _httpContext.Session[SessionHelper.FilterViewModel]  = userFilterViewModel.ToXml();
            _httpContext.Session[SessionHelper.CurrentTab]       = LoanCenterTab.Prospect;
        }