public string ProcessLead() { string messageJson = "{\"type\":\"{0}\",\"data\":\"{1}\"}"; bool isErr = false; string LoanOfficerFirstName = string.Empty; string LoanOfficerLastName = string.Empty; string LeadSource = string.Empty; string errorMessage = string.Empty; try { #region LoanOfficer And LeadSource if (!string.IsNullOrEmpty(GetForm("LeadSource")) && !string.IsNullOrEmpty(GetForm("LoanOfficerFirstName")) && !string.IsNullOrEmpty(GetForm("LoanOfficerLastName")) ) { LoanOfficerFirstName = GetForm("LoanOfficerFirstName"); LoanOfficerLastName = GetForm("LoanOfficerLastName"); LeadSource = GetForm("LeadSource"); } else { return("{\"type\":\"fatal\",\"data\":\"Missing required query string(LoanOfficer/LeadSource).\"}"); } #endregion #region Post Loan To Service string serviceUrl = System.Configuration.ConfigurationManager.AppSettings["PulseLeadServiceURL"].ToString(); if (string.IsNullOrEmpty(serviceUrl)) { return("{\"type\":\"fatal\",\"data\":\"Service URl Error.\"}"); } using (PulseLeadServiceClient client = new PulseLeadServiceClient()) { PostLoanAppRequest PostLoanApp_req = new PostLoanAppRequest(); PostLoanApp_req.RequestHeader = new ReqHdr(); PostLoanApp_req.RequestHeader.SecurityToken = System.Configuration.ConfigurationManager.AppSettings["SecurityToken"].ToString(); #region LoanOfficer / Branch PostLoanApp_req.LoanOfficerFirstName = LoanOfficerFirstName; PostLoanApp_req.LoanOfficerLastName = LoanOfficerLastName; //PostLoanApp_req.BranchName = BranchName; PostLoanApp_req.LeadSource = LeadSource; #endregion #region Borrower Information PostLoanApp_req.BorrowerFirstName = GetForm("txtFirstName"); PostLoanApp_req.BorrowerMiddleName = ""; PostLoanApp_req.BorrowerLastName = GetForm("txtLastName"); PostLoanApp_req.HomePhone = GetForm("txtPhone"); PostLoanApp_req.Email = GetForm("txtEmail"); PostLoanApp_req.CreditRanking = CreditRanking.Good; PostLoanApp_req.PreferredContactMethod = PreferredContactMethod.Email; #endregion #region LoanAmount / PurposeOfLoan PostLoanApp_req.LoanAmount = 0; PostLoanApp_req.PurposeOfLoan = PurposeOfLoan.Other; #endregion #region Comments/Notes string comment = GetForm("txtComments"); string area = GetForm("selArea"); if (!string.IsNullOrEmpty(area)) { if (!area.Contains("--Select an area")) { PostLoanApp_req.Notes = string.Format("Area Of Interest={0}", area, comment); } } if (!string.IsNullOrEmpty(comment)) { if (!string.IsNullOrEmpty(PostLoanApp_req.Notes)) { PostLoanApp_req.Notes += "&"; } PostLoanApp_req.Notes += string.Format("Comments={0}", comment); } #endregion PostLoanApp_req.OccupancyType = OccupancyType.PrimaryResidence; RespHdr resp1 = null; //resp1 = client.PostLoanApp2(PostLoanApp_req); resp1 = client.PostLoanApp(PostLoanApp_req); if (!resp1.Successful) { isErr = true; errorMessage = resp1.Error; messageJson = "{\"type\":\"fatal\",\"data\":\"" + errorMessage + "\"}";//error } else { messageJson = "{\"type\":\"success\",\"data\":\"Your application has been receieved. Your Loan Officer will contact you shortly.\"}"; } } #endregion } catch (Exception ex) { isErr = true; errorMessage = "Server exception:" + ex.Message; messageJson = "{\"type\":\"fatal\",\"data\":\"" + errorMessage + "\"}"; } finally { } return(messageJson); }
//private const string EventLogName = "PulseLeadService-LT_PostLeads"; protected void Page_Load(object sender, EventArgs e) { #region for test if (Request.QueryString["test"] != null && Request.QueryString["test"].ToString() == "1") { return; } #endregion Response.Clear(); if (Request.InputStream.Length == 0) { Log("No XML data.", 0); WriteStatus(0, "No XML data."); return; } string token = string.Empty; try { string sqlCmd = "Select top 1 GlobalID from Company_General"; object obj = focusIT.DbHelperSQL.GetSingle(sqlCmd); token = (obj == null || obj == DBNull.Value) ? string.Empty : (string)obj; } catch (Exception ex) { } if (string.IsNullOrEmpty(token)) { token = System.Configuration.ConfigurationManager.AppSettings["SecurityToken"] == null ? "" : System.Configuration.ConfigurationManager.AppSettings["SecurityToken"].ToString(); if (string.IsNullOrEmpty(token)) { Log("SecurityToken is Empty!", 0); WriteStatus(0, "SecurityToken is Empty!"); return; } } PostLeadRequest req_lead = new PostLeadRequest(); req_lead.RequestHeader = new PostLeadWeb.LP2Service.Lead_ReqHdr(); req_lead.RequestHeader.SecurityToken = token; string err = string.Empty; bool checkDuplicates = false; #region mapping field try { var streamReader = new StreamReader(Request.InputStream); //string str = streamReader.ReadToEnd(); XDocument xmlDoc = XDocument.Load(streamReader); var leadApp = xmlDoc.Elements("LeadInformation").Elements("LeadApplication"); var applicantID = leadApp.Elements("ApplicantID").FirstOrDefault().Value; req_lead.LeadId = applicantID; if (ConfigurationManager.AppSettings["CheckDuplicates"] != null) { Boolean.TryParse(ConfigurationManager.AppSettings["CheckDuplicates"].ToString(), out checkDuplicates); } if (!string.IsNullOrEmpty(req_lead.LeadId)) { req_lead.CheckDuplicate = checkDuplicates; } PostLeadWeb.LP2Service.Address address = new PostLeadWeb.LP2Service.Address(); address.City = leadApp.Elements("City").FirstOrDefault().Value; address.State = leadApp.Elements("State").FirstOrDefault().Value; address.Zip = leadApp.Elements("Zip").FirstOrDefault().Value; address.Street = leadApp.Elements("Address1").FirstOrDefault().Value; req_lead.MailingAddress = address; req_lead.Email = leadApp.Elements("EmailAddress").FirstOrDefault().Value; req_lead.HomePhone = leadApp.Elements("HomePhone").FirstOrDefault().Value; req_lead.BusinessPhone = leadApp.Elements("WorkPhone").FirstOrDefault().Value; req_lead.BorrowerFirstName = leadApp.Elements("FirstName").FirstOrDefault().Value; req_lead.BorrowerLastName = leadApp.Elements("LastName").FirstOrDefault().Value; req_lead.BorrowerMiddleName = ""; req_lead.SSN = leadApp.Elements("SSN").FirstOrDefault().Value; req_lead.PreferredContactMethod = PreferredContactMethod.Email; //var oIncomeList = new List<OtherIncome>(); //if (!string.IsNullOrEmpty(leadApp.Elements("MonthlyIncome").FirstOrDefault().Value)) //{ // OtherIncome oIncome = new OtherIncome(); // oIncome.Amount = Convert.ToDecimal(leadApp.Elements("MonthlyIncome").FirstOrDefault().Value); // oIncomeList.Add(oIncome); //} //req_lead.OtherIncome = oIncomeList.ToArray(); // into loannotes #region CreditRating switch (leadApp.Elements("CreditRating").FirstOrDefault().Value.ToLower()) { case "good": req_lead.CreditRanking = PostLeadWeb.LP2Service.CreditRanking.Good; break; case "excellent": req_lead.CreditRanking = PostLeadWeb.LP2Service.CreditRanking.Excellent; break; case "fair": req_lead.CreditRanking = PostLeadWeb.LP2Service.CreditRanking.Fair; break; case "poor": req_lead.CreditRanking = PostLeadWeb.LP2Service.CreditRanking.Poor; break; case "verygood": req_lead.CreditRanking = PostLeadWeb.LP2Service.CreditRanking.VeryGood; break; default: req_lead.CreditRanking = PostLeadWeb.LP2Service.CreditRanking.Good; break; } #endregion //IsMilitary //TimeToContact //WorkingWithRealtor #region PropertyType switch (leadApp.Elements("PropertyType").FirstOrDefault().Value.ToLower()) { case "single-family": req_lead.PropertyType = "SFR"; break; case "town home": req_lead.PropertyType = "Townhome"; break; case "condominium": req_lead.PropertyType = "Condo"; break; case "Cooperative": req_lead.PropertyType = "Other"; break; case "multiple-family": req_lead.PropertyType = "TwotoFourUnit"; break; case "mobile home": req_lead.PropertyType = "Other"; break; default: req_lead.PropertyType = "Other"; break; } #endregion switch (leadApp.Elements("PropertyUse").FirstOrDefault().Value.ToLower()) { case "primary residence": req_lead.OccupancyType = PostLeadWeb.LP2Service.OccupancyType.PrimaryResidence; break; case "vacation property ": req_lead.OccupancyType = PostLeadWeb.LP2Service.OccupancyType.SecondHome; break; case "investment property": req_lead.OccupancyType = PostLeadWeb.LP2Service.OccupancyType.InvestmentProperty; break; } //PropertyCounty req_lead.Property_Zip = leadApp.Elements("PropertyZip").FirstOrDefault().Value; //PropertyMSA req_lead.Property_State = leadApp.Elements("PropertyState").FirstOrDefault().Value; //LoanType if (!string.IsNullOrEmpty(leadApp.Elements("LoansToBeFinanced").FirstOrDefault().Value)) { req_lead.Notes += "Loans to be financed=" + leadApp.Elements("LoansToBeFinanced").FirstOrDefault().Value; } //DownPayment req_lead.LoanAmount = string.IsNullOrEmpty(leadApp.Elements("LoanAmount").FirstOrDefault().Value) ? 0 : Convert.ToInt32(leadApp.Elements("LoanAmount").FirstOrDefault().Value); req_lead.PropertyValue = string.IsNullOrEmpty(leadApp.Elements("PropertyPrice").FirstOrDefault().Value) ? 0 : Convert.ToInt32(leadApp.Elements("PropertyPrice").FirstOrDefault().Value); //AddlCashOut if (!string.IsNullOrEmpty(leadApp.Elements("AddlCashOut").FirstOrDefault().Value)) { req_lead.Notes += "\r\n AdditionalCashout=" + leadApp.Elements("AddlCashOut").FirstOrDefault().Value; } //MortgageType if (!string.IsNullOrEmpty(leadApp.Elements("MortgageType").FirstOrDefault().Value)) { req_lead.Notes += "\r\n MortgageType=" + leadApp.Elements("MortgageType").FirstOrDefault().Value; } //TimeLine if (!string.IsNullOrEmpty(leadApp.Elements("TimeLine").FirstOrDefault().Value)) { req_lead.Notes += "\r\n TimeLine=" + leadApp.Elements("TimeLine").FirstOrDefault().Value; } //<AnnualIncome/> if (!string.IsNullOrEmpty(leadApp.Elements("AnnualIncome").FirstOrDefault().Value)) { req_lead.Notes += "\r\n AnnualIncome=" + leadApp.Elements("AnnualIncome").FirstOrDefault().Value; } //MonthlyPayment //req_lead.MonthlyPayment = string.IsNullOrEmpty(leadApp.Elements("MonthlyPayment").FirstOrDefault().Value) ? 0 : Convert.ToDecimal(leadApp.Elements("MonthlyPayment").FirstOrDefault().Value); //FirstMortgageMonthlyPayment = leadApp.Elements("FirstMortgageBalance").FirstOrDefault().Value; //FirstMortgageBalance if (!string.IsNullOrEmpty(leadApp.Elements("FirstMortgageBalance").FirstOrDefault().Value)) { req_lead.Notes += "\r\n FirstMortgageBalance=" + leadApp.Elements("FirstMortgageBalance").FirstOrDefault().Value; } //SecondMortgageBalance if (!string.IsNullOrEmpty(leadApp.Elements("SecondMortgageBalance").FirstOrDefault().Value)) { req_lead.Notes += "\r\n SecondMortgageBalance=" + leadApp.Elements("SecondMortgageBalance").FirstOrDefault().Value; } //AddlMortgagePayment if (!string.IsNullOrEmpty(leadApp.Elements("AddlMortgagePayment").FirstOrDefault().Value)) { req_lead.Notes += "\r\n AddlMortgagePayment=" + leadApp.Elements("AddlMortgagePayment").FirstOrDefault().Value; } //MonthlyObligations if (!string.IsNullOrEmpty(leadApp.Elements("MonthlyObligations").FirstOrDefault().Value)) { req_lead.Notes += "\r\n MonthlyObligations=" + leadApp.Elements("MonthlyObligations").FirstOrDefault().Value; } //Bankruptcy if (!string.IsNullOrEmpty(leadApp.Elements("Bankruptcy").FirstOrDefault().Value)) { req_lead.Notes += "\r\n Bankruptcy=" + leadApp.Elements("Bankruptcy").FirstOrDefault().Value; } #region LoanRequested switch (leadApp.Elements("LoanRequested").FirstOrDefault().Value.ToLower()) { case "purchase": req_lead.PurposeOfLoan = PostLeadWeb.LP2Service.PurposeOfLoan.Purchase; break; case "refinance": if (string.IsNullOrEmpty(leadApp.Elements("AddlCashOut").FirstOrDefault().Value)) { req_lead.PurposeOfLoan = PostLeadWeb.LP2Service.PurposeOfLoan.Refinance_Cashout; } else { req_lead.PurposeOfLoan = PostLeadWeb.LP2Service.PurposeOfLoan.Refinance_No_Cashout; } break; } #endregion //req_lead.LoanProgram = leadApp.Elements("LoanProgram").FirstOrDefault().Value; //MonthlyIncome-->LoanNotes if (!string.IsNullOrEmpty(leadApp.Elements("MonthlyIncome").FirstOrDefault().Value)) { req_lead.Notes += "\r\n MonthlyIncome=" + leadApp.Elements("MonthlyIncome").FirstOrDefault().Value; } //AnnualIncome-->LoanNotes if (!string.IsNullOrEmpty(leadApp.Elements("AnnualIncome").FirstOrDefault().Value)) { req_lead.Notes += "\r\n AnnualIncome=" + leadApp.Elements("AnnualIncome").FirstOrDefault().Value; } //IsMilitary-->LoanNotes if (!string.IsNullOrEmpty(leadApp.Elements("IsMilitary").FirstOrDefault().Value)) { req_lead.Notes += "\r\n IsMilitary=" + leadApp.Elements("IsMilitary").FirstOrDefault().Value; } //TimeToContact-->LoanNotes if (!string.IsNullOrEmpty(leadApp.Elements("IsMilitary").FirstOrDefault().Value)) { req_lead.Notes += "\r\n TimeToContact=" + leadApp.Elements("IsMilitary").FirstOrDefault().Value; } //WorkingWithRealtor-->LoanNotes if (!string.IsNullOrEmpty(leadApp.Elements("WorkingWithRealtor").FirstOrDefault().Value)) { req_lead.Notes += "\r\n WorkingWithRealtor=" + leadApp.Elements("WorkingWithRealtor").FirstOrDefault().Value; } //PropertyMSA-->LoanNotes if (!string.IsNullOrEmpty(leadApp.Elements("PropertyMSA").FirstOrDefault().Value)) { req_lead.Notes += "\r\n PropertyMSA=" + leadApp.Elements("PropertyMSA").FirstOrDefault().Value; } //PropertyCounty-->Loans.County if (!string.IsNullOrEmpty(leadApp.Elements("PropertyCounty").FirstOrDefault().Value)) { req_lead.County = leadApp.Elements("PropertyCounty").FirstOrDefault().Value; } //LoanType-->Loans.LoanType if (!string.IsNullOrEmpty(leadApp.Elements("LoanType").FirstOrDefault().Value)) { req_lead.LoanType = leadApp.Elements("LoanType").FirstOrDefault().Value; } //MortgageTerm-->Loans.Term int tempInt = 0; if (int.TryParse(leadApp.Elements("MortgageTerm").FirstOrDefault().Value, out tempInt)) { req_lead.Term = tempInt; } //CurrentLoanRate-->Loans.Rate decimal tempDecimal = 0; if (decimal.TryParse(leadApp.Elements("CurrentLoanRate").FirstOrDefault().Value, out tempDecimal)) { req_lead.Rate = tempDecimal; } //PartnerUID //NameOfPartner-->LoanNote if (!string.IsNullOrEmpty(leadApp.Elements("NameOfPartner").FirstOrDefault().Value)) { req_lead.Notes += "\r\n NameOfPartner=" + leadApp.Elements("NameOfPartner").FirstOrDefault().Value; } //TrackingNumber //DTI-->LoanNotes if (!string.IsNullOrEmpty(leadApp.Elements("DTI").FirstOrDefault().Value)) { req_lead.Notes += "\r\n DTI=" + leadApp.Elements("DTI").FirstOrDefault().Value; } //LTV-->Loans.LTV if (!string.IsNullOrEmpty(leadApp.Elements("LTV").FirstOrDefault().Value)) { req_lead.Notes += "\r\n LTV=" + leadApp.Elements("LTV").FirstOrDefault().Value; } //ApplicationDate //SourceID //FilterClass //FilterName //IsVerified //VerifiedHomePhone //PromotionalProgram-->LoanNotes if (!string.IsNullOrEmpty(leadApp.Elements("PromotionalProgram").FirstOrDefault().Value)) { req_lead.Notes += "\r\n PromotionalProgram=" + leadApp.Elements("PromotionalProgram").FirstOrDefault().Value; } string leadSource = ConfigurationManager.AppSettings["LeadSource"] == null ? string.Empty : ConfigurationManager.AppSettings["LeadSource"].ToString(); req_lead.LeadSource = string.IsNullOrEmpty(leadSource) ? "Lending Tree" : leadSource; //OtherLoanProgram //MatchFee //FilterRoutingID #endregion ServiceManager sm = new ServiceManager(); using (PostLeadWeb.LP2Service.LP2ServiceClient client = sm.StartServiceClient()) { err = string.Empty; RespHdr resp = client.PostLead(req_lead); if (resp == null) { WriteStatus(99, "Failed to Post Lead, Service returned no response."); return; } if (!resp.Successful) { //Log("Pulse Service Post Lead Result:" + err, 0); err = "Failed to Post Lead, Service error: " + resp.StatusInfo; WriteStatus(1, err); } else { WriteStatus(0, "Success"); } } } catch (Exception ex) { //Log(ex.Message, 0); WriteStatus(0, ex.ToString()); } }
private bool Save() { #region get user input string sFirstName = this.txtFirstName.Text.Trim(); string sLastName = this.txtLastName.Text.Trim(); string sEmail = this.txtEmail.Text.Trim(); string sPhone = this.txtPhone.Text.Trim(); string sType = this.ddlType.SelectedValue; string sDOB = this.txtBirthday.Text.Trim(); if (!string.IsNullOrEmpty(sDOB)) { DateTime DOB; if (DateTime.TryParse(sDOB, out DOB) == false) { //PageCommon.AlertMsg(this, "Date of Birth is not a invalid date format."); PageCommon.WriteJsEnd(this, "Date of Birth is not a invalid date format.", PageCommon.Js_RefreshSelf); return(false); } } string sSSN = this.txtSSN.Text.Trim(); string sWorkflow = this.ddlWorkflow.SelectedValue; int iWflTempID = 0; int.TryParse(sWorkflow, out iWflTempID); string sMarketing = this.ddlMarketing.SelectedValue; // MailChimpList ID // Task Name string sTaskName = string.Empty; if (this.radTaskList.Checked == true) { if (this.ddlTaskList.SelectedValue == "-- select --") { sTaskName = string.Empty; } else { sTaskName = this.ddlTaskList.SelectedValue; } } else { sTaskName = this.txtTaskName.Text.Trim(); } // Due Date string sDueDate = this.txtDueDate.Text.Trim(); DateTime DueDate; if (sDueDate != string.Empty) { if (DateTime.TryParse(sDueDate, out DueDate) == false) { //PageCommon.AlertMsg(this, "Due Date is not a invalid date format."); PageCommon.WriteJsEnd(this, "Due Date is not a invalid date format.", PageCommon.Js_RefreshSelf); return(false); } DueDate = DateTime.Parse(sDueDate); } // Due Time string sDueTime = ddlDueTime_hour.Text + ":" + ddlDueTime_min.Text; //this.txtDueTime.Text.Trim(); DateTime DTN = DateTime.Now; string sDueTime_Span = null; TimeSpan DueTime = new TimeSpan(); if (sDueTime != string.Empty) { if (DateTime.TryParse(sDueTime, out DTN) == true) { sDueTime_Span = DTN.ToString("HH:mm"); if (TimeSpan.TryParse(sDueTime_Span, out DueTime) == false) { //PageCommon.AlertMsg(this, "Invalid Due Time format."); PageCommon.WriteJsEnd(this, "Invalid Due Time format.", PageCommon.Js_RefreshSelf); return(false); } } else { //PageCommon.AlertMsg(this, "Invalid Due Time format."); PageCommon.WriteJsEnd(this, "Invalid Due Time format.", PageCommon.Js_RefreshSelf); return(false); } } string sReminderUser = string.Empty; string sReminderUserID = string.Empty; int iReminderUserID = 0; string sReminderInterval = string.Empty; if (this.chkReminder.Checked == true) { sReminderUser = this.txtReminderUser.Text.Trim(); sReminderUserID = this.hdnReminderUserID.Value; iReminderUserID = Convert.ToInt32(sReminderUserID); sReminderInterval = this.ddlReminderInterval.SelectedValue; } //CR53 decimal loanAmount = string.IsNullOrEmpty(txtLoanAmount.Text) ? 0M : Convert.ToDecimal(txtLoanAmount.Text.Trim()); string purpose = ddlPurpose.Text.Trim() == "- select -" ? "" : ddlPurpose.Text; #endregion #region create contact/prospect and loan int iContactId = 0; try { iContactId = this.CreateContactAndProspect(sFirstName, sLastName, sEmail, sType, sPhone, sDOB, sSSN, this.CurrUser.iUserID, purpose); } catch (Exception ex) { //PageCommon.AlertMsg(this, "Failed to save contact and prospect."); PageCommon.WriteJsEnd(this, "Failed to save contact and prospect." + ex.Message, PageCommon.Js_RefreshSelf); return(false); } #endregion #region create loan //int iFileID = 0; try { iFileID = this.CreateLoan(iContactId, loanAmount, purpose); } catch (Exception ex) { //PageCommon.AlertMsg(this, "Failed to save loan info."); PageCommon.WriteJsEnd(this, "Failed to save loan info.", PageCommon.Js_RefreshSelf); return(false); } #endregion #region Apply LoanWflTempl if (iWflTempID > 0) { try { this.ApplyLoanWflTempl(iFileID, iWflTempID, this.CurrUser.iUserID); } catch (Exception ex) { //PageCommon.AlertMsg(this, "Failed to apply workflow template to loan."); PageCommon.WriteJsEnd(this, "Failed to apply workflow template to loan.", PageCommon.Js_RefreshSelf); return(false); } } #endregion #region GenerateWorkflow and get iCurrentLoanStageId int iCurrentLoanStageId = 0; if (iWflTempID > 0) { string sError; bool bResult = this.GenerateWorkflow(iFileID, iWflTempID, this.CurrUser.iUserID, out sError); if (bResult == false) { //PageCommon.AlertMsg(this, "Failed to generate workflow template: " + sError); PageCommon.WriteJsEnd(this, "Failed to generate workflow template: " + sError, PageCommon.Js_RefreshSelf); return(false); } System.Threading.Thread.Sleep(2000); // get current loan stage id iCurrentLoanStageId = LPWeb.BLL.WorkflowManager.GetCurrentLoanStageId(iFileID); } else if (!string.IsNullOrEmpty(sTaskName)) { iWflTempID = LPWeb.BLL.WorkflowManager.GetDefaultWorkflowTemplate("Prospect"); if (iWflTempID < 1) { iCurrentLoanStageId = LPWeb.BLL.WorkflowManager.GenerateDefaultLoanStages(iFileID, "Prospect"); } } #endregion #region Create Task and Reminder if (!string.IsNullOrEmpty(sTaskName)) { #region create task if (iCurrentLoanStageId < 0) { //PageCommon.AlertMsg(this, "There is no loan stage available."); PageCommon.WriteJsEnd(this, "There is no loan stage available.", PageCommon.Js_RefreshSelf); return(false); } int iLoanTaskId = 0; try { iLoanTaskId = this.CreateLoanTask(iFileID, sTaskName, this.CurrUser.iUserID, sDueDate, sDueTime, iCurrentLoanStageId); } catch (Exception ex) { } #endregion #region reminder if (this.chkReminder.Checked == true) { string sReminderDueTime = string.Empty; if (sDueTime != string.Empty) { TimeSpan Interval = new TimeSpan(); if (sReminderInterval.Contains("minutes") == true) { string sMinutes = sReminderInterval.Replace(" minutes", ""); int iMinutes = Convert.ToInt32(sMinutes); Interval = new TimeSpan(0, iMinutes, 0); } else if (sReminderInterval.Contains("hours") == true) { string sHours = sReminderInterval.Replace(" hours", ""); int iHours = Convert.ToInt32(sHours); Interval = new TimeSpan(iHours, 0, 0); } TimeSpan ReminderDueTime = DueTime.Add(Interval); sReminderDueTime = ReminderDueTime.ToString(); } string sReminderTaskName = sTaskName + " - Quick Lead Form - Reminder"; if (iReminderUserID == this.CurrUser.iUserID && sDueDate == DateTime.Now.ToString("MM/dd/yyyy")) { this.CurrUser.InitTaskListDueToday(); } } #endregion } #endregion #region API MailChimp_Subscribe if (sMarketing != string.Empty) { string sError2 = string.Empty; bool bResult2 = this.MailChimp_Subscribe(iContactId, sMarketing, out sError2); if (bResult2 == false) { //PageCommon.AlertMsg(this, "Failed to invoke API MailChimp_Subscribe: " + sError2); PageCommon.WriteJsEnd(this, "Failed to invoke API MailChimp_Subscribe: " + sError2, PageCommon.Js_RefreshSelf); return(false); } } #endregion if (ddlLoanOfficer.SelectedValue == "0") //Lead Routing Engine { #region invoke the WCF API LeadRouting_AssignLoanOfficer try { ServiceManager sm = new ServiceManager(); using (LP2ServiceClient client = sm.StartServiceClient()) { LR_AssignLoanOfficerReq req = new LR_AssignLoanOfficerReq(); req.LoanId = iFileID; req.LoanOfficerId = iLoanOfficerID; req.BorrowerContactId = iContactId; req.CoBorrowerContactId = 0; req.ReqHdr = new ReqHdr(); req.ReqHdr.UserId = CurrUser.iUserID; req.ReqHdr.SecurityToken = "SecurityToken"; RespHdr resp = client.LeadRouting_AssignLoanOfficer(req); } } catch (Exception ex) { PageCommon.WriteJsEnd(this, "Pulse Lead Manager is not running. Please select a Loan Officer from the list and save the lead.", PageCommon.Js_RefreshSelf); return(false); } #endregion } return(true); }
static void MyTest(string[] args) { using (PulseLeadServiceClient.PulseLeadServiceClient client = new PulseLeadServiceClient.PulseLeadServiceClient()) { PostLeadRequest req = new PostLeadRequest(); req.BorrowerFirstName = "Peter"; req.BorrowerLastName = "FocusITestH"; req.HomePhone = "222-222-3333"; req.BusinessPhone = "233-333-4444"; req.CellPhone = "244-444-5555"; req.CreditRanking = CreditRanking.Good; req.Email = "*****@*****.**"; req.LoanProgram = "30-year fixed"; req.OccupancyType = OccupancyType.PrimaryResidence; req.LoanAmount = 200000; req.PurposeOfLoan = PurposeOfLoan.Refinance_Cashout; req.PreferredContactMethod = PreferredContactMethod.Email; //req.BranchName = "Atlanta"; //req.LoanOfficerFirstName = "Betty"; //req.LoanOfficerLastName = "Wilkinson"; req.MailingAddress = new Address() { City = "San Jose", State = "CA", Street = "123 Any Street", Zip = "95110" }; req.PropertyValue = 400000; req.Property_Street = "123 Any Street"; req.Property_City = "San Jose"; req.Property_State = "CA"; req.Property_Zip = "95110"; req.RequestHeader = new ReqHdr(); req.RequestHeader.SecurityToken = "90e588a7-df07-4abf-976c-ce655d6effa6"; RespHdr resp = null; resp = client.PostLead(req); if (resp.Successful) { Console.WriteLine("Successfully posted the lead to Pulse!"); } else { Console.WriteLine("Failed to post the lead to Pulse, reason:{0}.", resp.Error); } Console.ReadKey(); } using (PulseLeadServiceClient.PulseLeadServiceClient client = new PulseLeadServiceClient.PulseLeadServiceClient()) { PostLoanAppRequest req = new PostLoanAppRequest(); req.BorrowerFirstName = "PeterG"; req.BorrowerMiddleName = ""; req.BorrowerLastName = "TerrizziG"; //req.CoBorrowerFirstName //req.CoBorrowerMiddleName //req.CoBorrowerLastName //req.CoBorrowerType //req.CoBorrowerPhone //req.CoBorrowerCellPhone //req.CoBorrowerBusinessPhone //req.CoBorrowerEmail req.HomePhone = "203-221-3221"; req.BusinessPhone = "203-331-4441"; req.CellPhone = "203-441-5551"; //req.MailingAddress req.CreditRanking = CreditRanking.Good; req.Email = "*****@*****.**"; //req.HasDependents //req.DOB //req.BorrowerSSN //req.Employment //req.CoBorrowerEmployers //req.OtherIncome //req.CoBorrowerOtherIncome //req.LiquidAssets req.LoanProgram = "30-year fixed"; req.OccupancyType = OccupancyType.PrimaryResidence; req.LoanAmount = 300000; req.PurposeOfLoan = PurposeOfLoan.Purchase; req.PreferredContactMethod = PreferredContactMethod.Email; req.BranchName = "Atlanta"; //id=8 // "Branch1A1"; req.LoanOfficerFirstName = "Betty"; //"Frank" req.LoanOfficerLastName = "Wilkinson"; // "Smith"; req.PropertyValue = 300000; //req.PropertyType //req.HousingStatus //req.RentAmount //req.Property //req.InterestOnly //req.IncludeEscrows //req.Notes req.RequestHeader = new ReqHdr(); req.RequestHeader.SecurityToken = "ff5eaf4a-6c97-4a00-8252-9eec8bf2979b"; // "2934230595-324923804-2394923"; RespHdr resp = client.PostLoanApp(req); if (resp.Successful) { Console.WriteLine("Successfully posted the lead to Pulse!"); } else { Console.WriteLine("Failed to post the lead to Pulse, reason:{0}.", resp.Error); } Console.ReadKey(); } }