예제 #1
0
        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);
        }
예제 #2
0
        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();
            }
        }