public void Execute() { //bool hasPrivilegeForManagingQueues = ( base.HttpContext.Session[ SessionHelper.PrivilegeForManagingQueues ] is bool && ( bool )base.HttpContext.Session[ SessionHelper.PrivilegeForManagingQueues ] ); if (!InputParameters.ContainsKey("LoanId")) { throw new ArgumentException("LoanId value was expected!"); } Guid loanId = Guid.Parse(InputParameters["LoanId"].ToString().TrimEnd()); UserAccount user = null; if (_httpContext.Session[SessionHelper.UserData] != null) { user = ( UserAccount )_httpContext.Session[SessionHelper.UserData]; } BasicLoanData loan = LoanServiceFacade.RetrieveBasicLoanData(loanId, user.UserAccountId); var assignLoanInfoViewModel = new AssignLoanInfoViewModel { LosFolders = new List <LosFolder>() }; bool importToLosInProgress = LoanServiceFacade.ImportToFNMInProgress(loanId); Boolean userCanChangeLoanNumber = UserAccountServiceFacade.IsUserAuthorizedForAction(user.UserAccountId, ActionCategory.ChangeLoanNumber); if (loan != null) { assignLoanInfoViewModel = new AssignLoanInfoViewModel { ConciergeId = loan.ConciergeId, EnableDigitalDocsCall = loan.EnableDigitalDocsCall, LoanId = loan.LoanId, LoanNumber = loan.LoanNumber, LoaId = loan.LoaId, LosFolders = LoanServiceFacade.RetrieveLosFolders(user.UserAccountId).OrderBy(l => l.FolderName).ToList(), ImportToLosInProgress = importToLosInProgress, UserCanChangeLoanNumber = userCanChangeLoanNumber, CompanyId = loan.CompanyId != Guid.Empty ? loan.CompanyId.ToString() : "0", ChannelId = loan.ChannelId != null ? (Int32)loan.ChannelId : 0, DivisionId = loan.DivisionId != null ? (Int32)loan.DivisionId : 0, BranchId = loan.BranchId != Guid.Empty ? ( Guid )loan.BranchId : Guid.Empty, CallCenterId = loan.CallCenterId }; } var losFolder = LoanServiceFacade.RetrieveLosFolder(loanId, user.UserAccountId); if (!String.IsNullOrEmpty(losFolder)) { assignLoanInfoViewModel.LosFolder = losFolder; } else { String defaultLosFolder = LoanServiceFacade.RetrieveDefaultLosFolder(user.UserAccountId); if (!String.IsNullOrEmpty(defaultLosFolder)) { assignLoanInfoViewModel.LosFolder = defaultLosFolder; } } var isLoa = false; if (user.Roles != null && user.Roles.Any(r => r.RoleName == RoleName.LoanOfficerAssistant && r.IsActive)) { isLoa = true; } LoadCompanies(assignLoanInfoViewModel); LoadChannels(assignLoanInfoViewModel); LoadDivisions(assignLoanInfoViewModel); LoadBranches(assignLoanInfoViewModel); LoadRelatedConciergeList(assignLoanInfoViewModel, user, loan, loanId, null, isLoa); LoadRelatedLoaList(assignLoanInfoViewModel, user, loan, loanId, null, isLoa); LoadCallCenterList(assignLoanInfoViewModel, loan); if (user.Roles.Any(r => r.RoleName.Equals(RoleName.Administrator))) { //base.HttpContext.Session[ SessionHelper.UserAccountIds ] = null; // start filling user filters by loading companies } else if (user.Roles.Any(r => r.RoleName.Equals(RoleName.BranchManager)) || user.Roles.Any(r => r.RoleName.Equals(RoleName.TeamLeader))) { // load only related users //LoadRelatedUsers( assignLoanInfoViewModel, base.User ); } var currentStep = LoanServiceFacade.RetrieveCurrentActivityNameAndLoanStatus(loanId, user.UserAccountId); assignLoanInfoViewModel.EnableDownload = (currentStep != null ? currentStep.PositionIndex > 1 : false); var urlaDeliveryMethod = new List <DropDownItem>(); urlaDeliveryMethod.Add(new DropDownItem() { Selected = true, Text = "FannieMae32", Value = "0" }); urlaDeliveryMethod.Add(new DropDownItem() { Selected = false, Text = "Mismo23", Value = "1" }); assignLoanInfoViewModel.DownloadLink = String.Format("/Downloader.axd?documentType=urla&loanId={0}&selectedFormatValue=0", _httpContext.Server.UrlEncode(EncryptionHelper.EncryptRijndael(loanId.ToString(), EncriptionKeys.Default))); assignLoanInfoViewModel.UrlaDeliveryMethod = urlaDeliveryMethod; if (currentStep != null) { assignLoanInfoViewModel.ActivityName = currentStep.ActivityName; } var leadSourceInformation = LoanServiceFacade.RetrieveHearAboutUs(loanId); if (leadSourceInformation != null) { if (leadSourceInformation.AffinityGroup == Contracts.Affiliate.AffinityGroup.PartnersProfiles) { if (leadSourceInformation.HBMId != null && leadSourceInformation.HBMId != Guid.Empty) { assignLoanInfoViewModel.LeadSourceInformation = leadSourceInformation.LeadSourceId + " Realtor-HBM"; } else { assignLoanInfoViewModel.LeadSourceInformation = leadSourceInformation.LeadSourceId + " Realtor"; } } else { assignLoanInfoViewModel.LeadSourceInformation = leadSourceInformation.LeadSourceId + " " + leadSourceInformation.Description; } } assignLoanInfoViewModel.TitleInformation = ConciergeWorkQueueServiceFacade.ExecuteSPGetBorrowerData("GetBorrowerData", loanId, user.UserAccountId); _viewName = "_assignloaninfo"; _viewModel = assignLoanInfoViewModel; /* Persist new state */ HttpContext.Session[SessionHelper.AssignLoanInfo] = assignLoanInfoViewModel.ToXml(); }
private void LoadCallCenterList(AssignLoanInfoViewModel assignLoanInfoViewModel, BasicLoanData loan) { assignLoanInfoViewModel.CallCenterInfoList = new Collection <CallCenterInfo>(); // Get Call Center/Loan Processor Officers var callCenterInfos = UserAccountServiceFacade.RetrieveCallCenterInfo(); if (callCenterInfos != null) { callCenterInfos = new Collection <CallCenterInfo>(callCenterInfos.OrderBy(l => l.CallCenterName).ToList()); callCenterInfos.Insert(0, new CallCenterInfo() { UserAccountId = 0, CallCenterName = "Select One" }); assignLoanInfoViewModel.CallCenterInfoList = callCenterInfos; } if (loan != null) { if (loan.CallCenterId != null && loan.CallCenterId != -1) { assignLoanInfoViewModel.SelectedCallCenter = assignLoanInfoViewModel.CallCenterInfoList.FirstOrDefault(c => c.UserAccountId.Equals(loan.CallCenterId)).UserAccountId.ToString(); } } }
private void LoadRelatedLoaList(AssignLoanInfoViewModel assignLoanInfoViewModel, UserAccount user, BasicLoanData loan, Guid loanId, int?contactId = null, Boolean?isLoa = null) { Guid companyId = Guid.Empty; int channelId = 0; int divisionId = 0; if (assignLoanInfoViewModel.CompanyId != null && assignLoanInfoViewModel.CompanyId != "-1" && assignLoanInfoViewModel.CompanyId != "0") { companyId = Guid.Parse(assignLoanInfoViewModel.CompanyId); } if (assignLoanInfoViewModel.ChannelId > 0) { channelId = assignLoanInfoViewModel.ChannelId; } if (assignLoanInfoViewModel.DivisionId > 0) { divisionId = assignLoanInfoViewModel.DivisionId; } var loaList = UserAccountServiceFacade.RetrieveLOAInfo(companyId, channelId, divisionId, assignLoanInfoViewModel.BranchId, 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; }
private void LoadRelatedConciergeList(AssignLoanInfoViewModel assignLoanInfoViewModel, UserAccount user, BasicLoanData loan, Guid loanId, int?contactId = null, Boolean?isLoa = null) { Guid companyId = Guid.Empty; int channelId = 0; int divisionId = 0; if (assignLoanInfoViewModel.CompanyId != null && assignLoanInfoViewModel.CompanyId != "-1" && assignLoanInfoViewModel.CompanyId != "0") { companyId = Guid.Parse(assignLoanInfoViewModel.CompanyId); } if (assignLoanInfoViewModel.ChannelId > 0) { channelId = assignLoanInfoViewModel.ChannelId; } if (assignLoanInfoViewModel.DivisionId > 0) { divisionId = assignLoanInfoViewModel.DivisionId; } var conciergeList = !WebCommonHelper.LicensingEnabled() ? UserAccountServiceFacade.RetrieveConciergeInfo(null, null, null, null, companyId, channelId, divisionId, assignLoanInfoViewModel.BranchId) : UserAccountServiceFacade.RetrieveConciergeInfo(loanId, null, isLoa, user.UserAccountId, companyId, channelId, divisionId, assignLoanInfoViewModel.BranchId); if (conciergeList != null) { conciergeList.Insert(0, new ConciergeInfo() { NMLSNumber = "", ConciergeName = "Select One", UserAccountId = 0 }); } assignLoanInfoViewModel.ConciergeList = conciergeList; if (loan != null) { assignLoanInfoViewModel.ConciergeNMLS = conciergeList.FirstOrDefault(d => d.UserAccountId.Equals(loan.ConciergeId)) != null ? conciergeList.FirstOrDefault(d => d.UserAccountId.Equals(loan.ConciergeId)).NMLSNumber : ""; } }
public void Execute() { #region Check and convert input parameters if (!InputParameters.ContainsKey("LoanId")) { throw new ArgumentException("LoanId value was expected!"); } if (!InputParameters.ContainsKey("ProspectId")) { throw new ArgumentException("ProspectId value was expected!"); } var user = AccountHelper.GetUserAccount(HttpContext); if (user == null) { throw new InvalidOperationException("UserData is null"); } #endregion #region Update title information Guid loanId = Guid.Parse(InputParameters["LoanId"].ToString().TrimEnd()); Int32 prospectId = Int32.Parse(InputParameters["ProspectId"].ToString().TrimEnd()); BasicLoanData loan = LoanServiceFacade.RetrieveBasicLoanData(loanId, user.UserAccountId); ManageProspectsViewModel model = new ManageProspectsViewModel(); model.ProspectId = prospectId; model.LoanId = loanId; if (loan != null) { model.CompanyId = loan.CompanyId != Guid.Empty ? loan.CompanyId.ToString() : "0"; model.ChannelId = loan.ChannelId != null ? ( Int32 )loan.ChannelId : 0; model.DivisionId = loan.DivisionId != null ? ( Int32 )loan.DivisionId : 0; model.BranchId = loan.BranchId != Guid.Empty ? ( Guid )loan.BranchId : Guid.Empty; } else { Contact contactData = ContactServiceFacade.RetrieveContactByContactId(prospectId); if (contactData != null) { model.CompanyId = contactData.CompanyProfileId != Guid.Empty ? contactData.CompanyProfileId.ToString() : "0"; model.ChannelId = contactData.ChannelId != null ? ( Int32 )contactData.ChannelId : 0; model.DivisionId = contactData.DivisionId != null ? ( Int32 )contactData.DivisionId : 0; model.BranchId = contactData.BranchId != Guid.Empty ? ( Guid )contactData.BranchId : Guid.Empty; } } //var leadSource = ContactServiceFacade.RetrieveLeadSourceByContactIdAndLoanId( prospectId, loanId, user.UserAccountId ); //model.LeadSourceInformation = leadSource != null ? leadSource.LeadSourceId + " " + leadSource.Description : String.Empty; LeadSource hearAboutUs = LoanServiceFacade.RetrieveHearAboutUs(loanId); if (hearAboutUs != null) { if (hearAboutUs.AffinityGroup == Contracts.Affiliate.AffinityGroup.PartnersProfiles) { if (hearAboutUs.HBMId != null && hearAboutUs.HBMId != Guid.Empty) { model.HearAboutUs = hearAboutUs.LeadSourceId + " Realtor-HBM"; } else { model.HearAboutUs = hearAboutUs.LeadSourceId + " Realtor"; } } else { model.HearAboutUs = hearAboutUs.LeadSourceId + " " + hearAboutUs.Description; } } model.TitleInformation = ConciergeWorkQueueServiceFacade.ExecuteSPGetBorrowerData("GetBorrowerData", loanId, user.UserAccountId); #endregion #region Update emails var emailList = ContactServiceFacade.RetrieveSentEmailItems(prospectId, user.UserAccountId); if (emailList != null && emailList.Count > 0) { model.Emails = emailList; } #endregion #region Update Lists bool isLoa = false; if (user.Roles != null && user.Roles.Any(r => r.RoleName == RoleName.LoanOfficerAssistant && r.IsActive)) { isLoa = true; } LoadCompanies(model); LoadChannels(model); LoadDivisions(model); LoadBranches(model); LoadRelatedConciergeList(model, user, loan, loanId, null, isLoa); LoadRelatedLoaList(model, user, loan, loanId, null, isLoa); // Get Call Center/Loan Processor Officers var callCenterInfos = UserAccountServiceFacade.RetrieveCallCenterInfo(); if (callCenterInfos != null) { callCenterInfos = new Collection <CallCenterInfo>(callCenterInfos.OrderBy(l => l.CallCenterName).ToList()); callCenterInfos.Insert(0, new CallCenterInfo() { UserAccountId = 0, CallCenterName = "Select One" }); } model.CallCenterInfoList = new Collection <CallCenterInfo>(); model.CallCenterInfoList = callCenterInfos; #endregion #region Get Highest priority role if (user.Roles != null && user.Roles.Count() > 0) { var filteredRoles = user.Roles.OrderBy(r => r.RolePriority); if (filteredRoles != null && filteredRoles.FirstOrDefault() != null) { var topPriorityRole = filteredRoles.FirstOrDefault().RoleName; var retrievedProspectData = ContactServiceFacade.RetrieveContactProspect(prospectId); if (retrievedProspectData != null) { model.SelectedStatus = retrievedProspectData.Status.ToString(); model.SelectedConcierge = retrievedProspectData.Concierge.ToString(); model.SelectedLoa = retrievedProspectData.Loa.ToString(); if (model.CallCenterInfoList.FirstOrDefault(c => c.UserAccountId.Equals(retrievedProspectData.CallCenter)) != null) { model.SelectedCallCenter = model.CallCenterInfoList.FirstOrDefault(c => c.UserAccountId.Equals(retrievedProspectData.CallCenter)).UserAccountId.ToString(); } if (model.ConciergeInfoList.FirstOrDefault(c => c.UserAccountId.Equals(retrievedProspectData.Concierge)) != null) { model.NMLSNumber = model.ConciergeInfoList.FirstOrDefault(c => c.UserAccountId.Equals(retrievedProspectData.Concierge)).NMLSNumber; } } } } #endregion //TODO: Move this in Lookup model.Statuses = new Collection <KeyValuePair <String, String> >(); foreach (ContactStatus contactStatus in Enum.GetValues(typeof(ContactStatus))) { if (contactStatus != ContactStatus.None) { model.Statuses.Add(new KeyValuePair <String, String>((( int )contactStatus).ToString(), MML.Web.LoanCenter.Helpers.LoanCenterEnumHelper.ContactStatusToString(contactStatus))); } } model.Statuses = new Collection <KeyValuePair <String, String> >(model.Statuses.OrderBy(s => s.Value).ToList()); ViewName = "Commands/_manageprospects"; ViewData = model; if (HttpContext == null || HttpContext.Session == null) { throw new NullReferenceException("Session is empty!"); } HttpContext.Session[SessionHelper.ManageProspects] = model.ToXml(); }
private void LoadRelatedConciergeList(ManageProspectsViewModel manageProspectViewModel, UserAccount user, BasicLoanData loan, Guid loanId, int?contactId = null, Boolean?isLoa = null) { Guid companyId = Guid.Empty; int channelId = 0; int divisionId = 0; if (manageProspectViewModel.CompanyId != null && manageProspectViewModel.CompanyId != "-1" && manageProspectViewModel.CompanyId != "0") { companyId = Guid.Parse(manageProspectViewModel.CompanyId); } if (manageProspectViewModel.ChannelId > 0) { channelId = manageProspectViewModel.ChannelId; } if (manageProspectViewModel.DivisionId > 0) { divisionId = manageProspectViewModel.DivisionId; } var conciergeList = !WebCommonHelper.LicensingEnabled() ? UserAccountServiceFacade.RetrieveConciergeInfo(null, null, null, null, companyId, channelId, divisionId, manageProspectViewModel.BranchId) : UserAccountServiceFacade.RetrieveConciergeInfo(loanId, manageProspectViewModel.ProspectId, isLoa, user.UserAccountId, companyId, channelId, divisionId, manageProspectViewModel.BranchId); if (conciergeList != null) { conciergeList.Insert(0, new ConciergeInfo() { NMLSNumber = "", ConciergeName = "Select One", UserAccountId = 0 }); } manageProspectViewModel.ConciergeInfoList = conciergeList; }