示例#1
0
 private void LoadBranches(AssignLoanInfoViewModel assignLoanInfoViewModel)
 {
     if (assignLoanInfoViewModel.DivisionId > 0)
     {
         var result = UserAccountServiceFacade.GetBranches(assignLoanInfoViewModel.DivisionId);
         if (result != null)
         {
             foreach (Branch branch in result.OrderBy(r => r.Name))
             {
                 assignLoanInfoViewModel.Branches.Add(new DropDownItem()
                 {
                     Text     = branch.Name,
                     Value    = branch.BranchId.ToString(),
                     Selected = (branch.BranchId == assignLoanInfoViewModel.BranchId)
                 });
             }
         }
     }
 }
        public void Execute()
        {
            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");
            }

            FilterViewModel userFilterViewModel;

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

            /* parameter processing */
            Int32 divisionId = 0;

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

            bool regionsResetOccurred = false;

            if (InputParameters["DivisionId"].ToString() == "0" || InputParameters["DivisionId"].ToString().Equals("-1"))
            {
                regionsResetOccurred = true;
            }
            else
            {
                divisionId = Int32.Parse(InputParameters["DivisionId"].ToString());
            }

            // Select region
            userFilterViewModel.DivisionId = divisionId;

            userFilterViewModel.Branches.Clear();
            userFilterViewModel.Branches.Add(_genericItemGuid);
            userFilterViewModel.BranchId = Guid.Empty;

            userFilterViewModel.Users.Clear();
            userFilterViewModel.Users.Add(_genericItem);
            userFilterViewModel.UserId = 0;

            if (!regionsResetOccurred)
            {
                /* Command processing */
                var result = UserAccountServiceFacade.GetBranches(divisionId);
                if (result != null)
                {
                    foreach (Branch branch in result.OrderBy(r => r.Name))
                    {
                        userFilterViewModel.Branches.Add(new SelectListItem()
                        {
                            Text     = branch.Name,
                            Value    = branch.BranchId.ToString(),
                            Selected = (branch.BranchId == userFilterViewModel.BranchId)
                        });
                    }
                }
            }

            _viewName  = "_userfilter";
            _viewModel = userFilterViewModel;

            /* Persist new state */
            _httpContext.Session[SessionHelper.FilterViewModel] = userFilterViewModel.ToXml();
        }
        public override void Execute()
        {
            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 userFilterViewModel;

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

            /* parameter processing */
            Int32 channelId = 0;

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

            bool divisionResetOccurred = false;

            if (InputParameters["ChannelId"].ToString() == "0" || InputParameters["ChannelId"].ToString().Equals("-1"))
            {
                divisionResetOccurred = true;
            }
            else
            {
                channelId = Int32.Parse(InputParameters["ChannelId"].ToString());
            }

            userFilterViewModel.ChannelId = channelId;

            userFilterViewModel.Divisions.Clear();
            userFilterViewModel.Divisions.Add(_viewAllItem);
            userFilterViewModel.DivisionId = 0;

            userFilterViewModel.Branches.Clear();
            userFilterViewModel.Branches.Add(_viewAllItemGuid);
            userFilterViewModel.BranchId = Guid.Empty;

            userFilterViewModel.Users.Clear();
            userFilterViewModel.Users.Add(_viewAllItem);
            userFilterViewModel.UserId = 0;

            if (!divisionResetOccurred)
            {
                /* Command processing */
                var result = UserAccountServiceFacade.GetDivisions(channelId);
                if (result != null)
                {
                    foreach (Division division in result.OrderBy(r => r.DivisionName))
                    {
                        userFilterViewModel.Divisions.Add(new SelectListItem()
                        {
                            Text     = division.DivisionName,
                            Value    = division.DivisionId.ToString(),
                            Selected = false
                        });

                        if (base.HttpContext.Session[SessionHelper.CurrentTab] != null &&
                            ((LoanCenterTab)base.HttpContext.Session[SessionHelper.CurrentTab] == LoanCenterTab.OrderRequested ||
                             (LoanCenterTab)base.HttpContext.Session[SessionHelper.CurrentTab] == LoanCenterTab.OrderProcessed ||
                             (LoanCenterTab)base.HttpContext.Session[SessionHelper.CurrentTab] == LoanCenterTab.OrderDeliveredForReview ||
                             (LoanCenterTab)base.HttpContext.Session[SessionHelper.CurrentTab] == LoanCenterTab.OrderException))
                        {
                            var branches = UserAccountServiceFacade.GetBranches(division.DivisionId);
                            foreach (var branch in branches)
                            {
                                var users = UserAccountServiceFacade.GetUsersFullName(branch.BranchId, false);

                                var usersList = new List <int>();

                                foreach (var userAccount in users.OrderBy(r => r.FullName))
                                {
                                    userFilterViewModel.Users.Add(new SelectListItem()
                                    {
                                        Text     = userAccount.FullName,
                                        Value    = userAccount.UserAccountId.ToString(),
                                        Selected = (userAccount.UserAccountId == userFilterViewModel.UserId)
                                    });

                                    usersList.Add(userAccount.UserAccountId);
                                }
                            }
                        }
                    }
                }
                userFilterViewModel.Users.Add(_viewAllItem);
            }

            ViewName = "_userfilter";
            ViewData = userFilterViewModel;

            /* Persist new state */
            base.HttpContext.Session[SessionHelper.FilterViewModel] = userFilterViewModel.ToXml();
        }
示例#4
0
        public override void Execute()
        {
            base.Execute();

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

            ManageProspectsViewModel manageProspectViewModel = null;

            if ((base.HttpContext != null) && (base.HttpContext.Session[SessionHelper.ManageProspects] != null))
            {
                manageProspectViewModel = new ManageProspectsViewModel().FromXml(base.HttpContext.Session[SessionHelper.ManageProspects].ToString());
            }
            else
            {
                // possible state retrieval?
                manageProspectViewModel = new ManageProspectsViewModel();
            }


            /* parameter processing */
            Int32 divisionId = 0;

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

            bool regionsResetOccurred = false;

            if (InputParameters["DivisionId"].ToString() == "0" || InputParameters["DivisionId"].ToString() == "-1")
            {
                regionsResetOccurred = true;
            }
            else
            {
                divisionId = Int32.Parse(InputParameters["DivisionId"].ToString());
            }

            // Select region
            manageProspectViewModel.DivisionId = divisionId;

            manageProspectViewModel.Branches.Clear();
            manageProspectViewModel.Branches.Add(_viewAllItem);
            manageProspectViewModel.BranchId = Guid.Empty;

            manageProspectViewModel.ConciergeInfoList.Clear();
            manageProspectViewModel.SelectedConcierge = null;


            var isLoa = false;

            if (user.Roles != null && user.Roles.Any(r => r.RoleName == RoleName.LoanOfficerAssistant && r.IsActive))
            {
                isLoa = true;
            }


            /* Command processing */
            Guid _compId;

            Guid.TryParse(manageProspectViewModel.CompanyId, out _compId);


            var conciergeList = !WebCommonHelper.LicensingEnabled() ?
                                UserAccountServiceFacade.RetrieveConciergeInfo(null, null, null, null, _compId, manageProspectViewModel.ChannelId, manageProspectViewModel.DivisionId, null) :
                                UserAccountServiceFacade.RetrieveConciergeInfo(manageProspectViewModel.LoanId, null, isLoa, user.UserAccountId, _compId, manageProspectViewModel.ChannelId, manageProspectViewModel.DivisionId, null);

            if (conciergeList != null && !conciergeList.Any(d => d.ConciergeName == "Select One"))
            {
                conciergeList.Insert(0, new ConciergeInfo()
                {
                    NMLSNumber = "", ConciergeName = "Select One", UserAccountId = 0
                });
            }

            manageProspectViewModel.ConciergeInfoList = conciergeList;



            var loaList = UserAccountServiceFacade.RetrieveLOAInfo(_compId, manageProspectViewModel.ChannelId, manageProspectViewModel.DivisionId, null, true);

            if (loaList != null && !loaList.Any(d => d.ConciergeName == "Select One"))
            {
                loaList.Insert(0, new ConciergeInfo()
                {
                    NMLSNumber = "", ConciergeName = "Select One", UserAccountId = 0
                });
            }

            manageProspectViewModel.LoaInfoList = loaList;

            if (!regionsResetOccurred)
            {
                /* Command processing */
                var result = UserAccountServiceFacade.GetBranches(divisionId);
                if (result != null)
                {
                    foreach (Branch branch in result.OrderBy(r => r.Name))
                    {
                        manageProspectViewModel.Branches.Add(new DropDownItem()
                        {
                            Text     = branch.Name,
                            Value    = branch.BranchId.ToString(),
                            Selected = (branch.BranchId == manageProspectViewModel.BranchId)
                        });
                    }
                }
            }

            manageProspectViewModel.Statuses = new Collection <KeyValuePair <String, String> >();
            foreach (ContactStatus contactStatus in Enum.GetValues(typeof(ContactStatus)))
            {
                if (contactStatus != ContactStatus.None)
                {
                    manageProspectViewModel.Statuses.Add(new KeyValuePair <String, String>((( int )contactStatus).ToString(),
                                                                                           MML.Web.LoanCenter.Helpers.LoanCenterEnumHelper.ContactStatusToString(contactStatus)));
                }
            }

            manageProspectViewModel.Statuses = new Collection <KeyValuePair <String, String> >(manageProspectViewModel.Statuses.OrderBy(s => s.Value).ToList());

            ViewName = "Commands/_manageprospects";
            ViewData = manageProspectViewModel;

            /* Persist new state */
            base.HttpContext.Session[SessionHelper.ManageProspects] = manageProspectViewModel.ToXml();
        }
        public override void Execute()
        {
            base.Execute();

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

            AssignLoanInfoViewModel assignLoanInfoViewModel = null;

            if ((base.HttpContext != null) && (base.HttpContext.Session[SessionHelper.AssignLoanInfo] != null))
            {
                assignLoanInfoViewModel = new AssignLoanInfoViewModel().FromXml(base.HttpContext.Session[SessionHelper.AssignLoanInfo].ToString());
            }
            else
            {
                // possible state retrieval?
                assignLoanInfoViewModel = new AssignLoanInfoViewModel();
            }


            /* parameter processing */
            Int32 divisionId = 0;

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

            bool regionsResetOccurred = false;

            if (InputParameters["DivisionId"].ToString() == "0" || InputParameters["DivisionId"].ToString() == "-1")
            {
                regionsResetOccurred = true;
            }
            else
            {
                divisionId = Int32.Parse(InputParameters["DivisionId"].ToString());
            }

            // Select region
            assignLoanInfoViewModel.DivisionId = divisionId;

            assignLoanInfoViewModel.Branches.Clear();
            assignLoanInfoViewModel.Branches.Add(_viewAllItem);
            assignLoanInfoViewModel.BranchId = Guid.Empty;

            assignLoanInfoViewModel.ConciergeList.Clear();
            assignLoanInfoViewModel.ConciergeId = null;


            var isLoa = false;

            if (user.Roles != null && user.Roles.Any(r => r.RoleName == RoleName.LoanOfficerAssistant && r.IsActive))
            {
                isLoa = true;
            }


            /* Command processing */
            Guid _compId;

            Guid.TryParse(assignLoanInfoViewModel.CompanyId, out _compId);


            var conciergeList = !WebCommonHelper.LicensingEnabled() ?
                                UserAccountServiceFacade.RetrieveConciergeInfo(null, null, null, null, _compId, assignLoanInfoViewModel.ChannelId, assignLoanInfoViewModel.DivisionId, null) :
                                UserAccountServiceFacade.RetrieveConciergeInfo(assignLoanInfoViewModel.LoanId, null, isLoa, user.UserAccountId, _compId, assignLoanInfoViewModel.ChannelId, assignLoanInfoViewModel.DivisionId, null);

            if (conciergeList != null && !conciergeList.Any(d => d.ConciergeName == "Select One"))
            {
                conciergeList.Insert(0, new ConciergeInfo()
                {
                    NMLSNumber = "", ConciergeName = "Select One", UserAccountId = 0
                });
            }

            assignLoanInfoViewModel.ConciergeList = conciergeList;



            var loaList = UserAccountServiceFacade.RetrieveLOAInfo(_compId, assignLoanInfoViewModel.ChannelId, assignLoanInfoViewModel.DivisionId, null, true);

            if (loaList != null && !loaList.Any(d => d.ConciergeName == "Select One"))
            {
                loaList.Insert(0, new ConciergeInfo()
                {
                    NMLSNumber = "", ConciergeName = "Select One", UserAccountId = 0
                });
            }

            assignLoanInfoViewModel.LoaList = loaList;

            if (!regionsResetOccurred)
            {
                /* Command processing */
                var result = UserAccountServiceFacade.GetBranches(divisionId);
                if (result != null)
                {
                    foreach (Branch branch in result.OrderBy(r => r.Name))
                    {
                        assignLoanInfoViewModel.Branches.Add(new DropDownItem()
                        {
                            Text     = branch.Name,
                            Value    = branch.BranchId.ToString(),
                            Selected = (branch.BranchId == assignLoanInfoViewModel.BranchId)
                        });
                    }
                }
            }

            ViewName = "_assignloaninfo";
            ViewData = assignLoanInfoViewModel;

            /* Persist new state */
            base.HttpContext.Session[SessionHelper.AssignLoanInfo] = assignLoanInfoViewModel.ToXml();
            //base.HttpContext.Session[ SessionHelper.UserAccountIds ] = new List<int>();
        }