private void LoadChannels(AssignLoanInfoViewModel assignLoanInfoViewModel) { if (assignLoanInfoViewModel.CompanyId != null && assignLoanInfoViewModel.CompanyId != "-1" && assignLoanInfoViewModel.CompanyId != "0" && assignLoanInfoViewModel.CompanyId != Guid.Empty.ToString()) { Guid companyId = Guid.Empty; companyId = Guid.Parse(assignLoanInfoViewModel.CompanyId); var result = UserAccountServiceFacade.GetChannels(companyId); if (result != null) { foreach (Channel channel in result.OrderBy(r => r.Name)) { assignLoanInfoViewModel.Channels.Add(new DropDownItem() { Text = channel.Name, Value = channel.ChannelId.ToString(), Selected = false }); } } } }
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 */ Guid companyId = Guid.Empty; if (!InputParameters.ContainsKey("CompanyId")) { throw new ArgumentException("CompanyId was expected!"); } bool channelResetOccurred = false; if (InputParameters["CompanyId"].ToString().Equals("0") || InputParameters["CompanyId"].ToString().Equals("-1")) { channelResetOccurred = true; } else { companyId = Guid.Parse(InputParameters["CompanyId"].ToString()); } manageProspectViewModel.CompanyId = companyId.ToString(); manageProspectViewModel.Channels.Clear(); manageProspectViewModel.Channels.Add(_viewAllItem); manageProspectViewModel.ChannelId = 0; manageProspectViewModel.Divisions.Clear(); manageProspectViewModel.Divisions.Add(_viewAllItem); manageProspectViewModel.DivisionId = 0; 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, null, null, null) : UserAccountServiceFacade.RetrieveConciergeInfo(manageProspectViewModel.LoanId, null, isLoa, user.UserAccountId, _compId, null, null, 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, null, null, 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 (!channelResetOccurred) { /* Command processing */ var result = UserAccountServiceFacade.GetChannels(companyId); if (result != null) { foreach (Channel channel in result.OrderBy(r => r.Name)) { manageProspectViewModel.Channels.Add(new DropDownItem() { Text = channel.Name, Value = channel.ChannelId.ToString(), Selected = false }); } } } 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(); }
private void LoadCompanies(FilterViewModel userFilterViewModel) { userFilterViewModel.Companies.Clear(); if (!userFilterViewModel.Companies.Any(c => c.Text.Equals(base.ViewAllItemGuid.Text))) { userFilterViewModel.Companies.Add(base.ViewAllItemGuid); } if (!userFilterViewModel.Channels.Any(ch => ch.Text.Equals(base.ViewAllItem.Text))) { userFilterViewModel.Channels.Add(base.ViewAllItem); } if (!userFilterViewModel.Divisions.Any(d => d.Text.Equals(base.ViewAllItem.Text))) { userFilterViewModel.Divisions.Add(base.ViewAllItem); } if (!userFilterViewModel.Branches.Any(b => b.Text.Equals(base.ViewAllItemGuid.Text))) { userFilterViewModel.Branches.Add(base.ViewAllItemGuid); } if (!userFilterViewModel.Users.Any(u => u.Text.Equals(base.ViewAllItem.Text))) { userFilterViewModel.Users.Add(base.ViewAllItem); } // for administrator role, we need to fetch all companies from the system var companies = MML.Web.Facade.UserAccountServiceFacade.GetAllCompanies(); if (companies == null) { return; } foreach (Company c in companies.OrderBy(c => c.Name)) { userFilterViewModel.Companies.Add(new SelectListItem() { Text = c.Name, Value = c.CompanyId.ToString(), Selected = (HttpContext.Session[SessionHelper.CompanyProfileId] != null && c.CompanyId.Equals(( Guid )HttpContext.Session[SessionHelper.CompanyProfileId])) }); } if (userFilterViewModel.CompanyId == null || userFilterViewModel.CompanyId == Guid.Empty) { CompanyProfile companyProfile = CompanyProfileServiceFacade.RetrieveCompanyProfile(); if (companyProfile != null) { userFilterViewModel.CompanyId = companyProfile.CompanyProfileId; } } var resultChannels = UserAccountServiceFacade.GetChannels(userFilterViewModel.CompanyId); if (resultChannels != null) { foreach (Channel channel in resultChannels.OrderBy(r => r.Name)) { userFilterViewModel.Channels.Add(new SelectListItem() { Text = channel.Name, Value = channel.ChannelId.ToString(), Selected = false }); } } }
public override void Execute() { base.Execute(); 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 */ Guid companyId = Guid.Empty; if (!InputParameters.ContainsKey("CompanyId")) { throw new ArgumentException("CompanyId was expected!"); } bool channelResetOccurred = false; if (InputParameters["CompanyId"].ToString().Equals("0") || InputParameters["CompanyId"].ToString().Equals("-1") || InputParameters["CompanyId"].ToString().Equals(Guid.Empty.ToString())) { channelResetOccurred = true; } else { companyId = Guid.Parse(InputParameters["CompanyId"].ToString()); } userFilterViewModel.CompanyId = companyId; userFilterViewModel.Channels.Clear(); userFilterViewModel.Channels.Add(_genericItem); userFilterViewModel.ChannelId = 0; userFilterViewModel.Divisions.Clear(); userFilterViewModel.Divisions.Add(_genericItem); userFilterViewModel.DivisionId = 0; userFilterViewModel.Branches.Clear(); userFilterViewModel.Branches.Add(_genericItemGuid); userFilterViewModel.BranchId = Guid.Empty; userFilterViewModel.Users.Clear(); userFilterViewModel.Users.Add(_genericItem); userFilterViewModel.UserId = 0; if (!channelResetOccurred) { /* Command processing */ var result = UserAccountServiceFacade.GetChannels(companyId); if (result != null) { foreach (Channel channel in result.OrderBy(r => r.Name)) { userFilterViewModel.Channels.Add(new SelectListItem() { Text = channel.Name, Value = channel.ChannelId.ToString(), Selected = false }); } } } ViewName = "_userfilter"; ViewData = userFilterViewModel; /* Persist new state */ base.HttpContext.Session[SessionHelper.FilterViewModel] = userFilterViewModel.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 */ Guid companyId = Guid.Empty; if (!InputParameters.ContainsKey("CompanyId")) { throw new ArgumentException("CompanyId was expected!"); } bool channelResetOccurred = false; if (InputParameters["CompanyId"].ToString().Equals("0") || InputParameters["CompanyId"].ToString().Equals("-1")) { channelResetOccurred = true; } else { companyId = Guid.Parse(InputParameters["CompanyId"].ToString()); } assignLoanInfoViewModel.CompanyId = companyId.ToString(); assignLoanInfoViewModel.Channels.Clear(); assignLoanInfoViewModel.Channels.Add(_viewAllItem); assignLoanInfoViewModel.ChannelId = 0; assignLoanInfoViewModel.Divisions.Clear(); assignLoanInfoViewModel.Divisions.Add(_viewAllItem); assignLoanInfoViewModel.DivisionId = 0; 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, null, null, null) : UserAccountServiceFacade.RetrieveConciergeInfo(assignLoanInfoViewModel.LoanId, null, isLoa, user.UserAccountId, _compId, null, null, 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, null, null, 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 (!channelResetOccurred) { /* Command processing */ var result = UserAccountServiceFacade.GetChannels(companyId); if (result != null) { foreach (Channel channel in result.OrderBy(r => r.Name)) { assignLoanInfoViewModel.Channels.Add(new DropDownItem() { Text = channel.Name, Value = channel.ChannelId.ToString(), Selected = false }); } } } ViewName = "_assignloaninfo"; ViewData = assignLoanInfoViewModel; /* Persist new state */ base.HttpContext.Session[SessionHelper.AssignLoanInfo] = assignLoanInfoViewModel.ToXml(); //base.HttpContext.Session[ SessionHelper.UserAccountIds ] = new List<int>(); }