Beispiel #1
0
        private static void InsertStatusToSQL(Applicant2 applicant2)
        {
            OpenSQLConnection();
            try
            {
                string sqlCommand = "INSERT INTO [dbo].[communications] " +
                                    "([customer_id], [account_id], [loan_id], [type_activity], [date_activity],  " +
                                    "[activity_category], [activity_description], [date_activity_backup]) " +
                                    "VALUES (" + applicant2.LAS_Customer_Id__c + ", null," + applicant2.LAS_Loan_Id__c + ",'2', CURRENT_TIMESTAMP, '12', 'loan_to_SF', null)";

                SqlCommand myCommand = new SqlCommand(sqlCommand, myConnection);
                //myCommand.Connection.Open();
                myCommand.ExecuteNonQuery();

                LogMessage(sw, applicant2.LAS_Loan_Id__c + " inserted in communication");
            }
            catch (Exception e)
            {
                LogErrorMessage(sw, e.ToString());
            }
        }
Beispiel #2
0
        private static void InsertLoanToSalesforce(EnterpriseWsdl.SoapClient apiClient, Applicant2 applicant2, string applicantId)
        {
            EnterpriseWsdl.Loan__c loan2 = new EnterpriseWsdl.Loan__c();

            loan2.Applicant__c = applicantId;

            loan2.LAS_Loan_Id__c = applicant2.LAS_Loan_Id__c;

            loan2.Bank_Account__c = applicant2.Bank_Account__c.Replace("-", "").Replace(" ", "").Trim();
            loan2.Sort_Code__c    = applicant2.Sort_Code__c.Replace("-", "").Replace(" ", "").Trim();

            if (!String.IsNullOrEmpty(applicant2.Loan_Amount__c))
            {
                loan2.Loan_Amount__c          = double.Parse(applicant2.Loan_Amount__c);
                loan2.Loan_Amount__cSpecified = true;
            }

            if (!String.IsNullOrEmpty(applicant2.Loan_Days__c))
            {
                loan2.Loan_Days__c          = double.Parse(applicant2.Loan_Days__c);
                loan2.Loan_Days__cSpecified = true;
            }

            if (!String.IsNullOrEmpty(applicant2.Monthly_Net_Income__c))
            {
                loan2.Monthly_Net_Income__c          = double.Parse(applicant2.Monthly_Net_Income__c);
                loan2.Monthly_Net_Income__cSpecified = true;
            }

            if (!String.IsNullOrEmpty(applicant2.AppliedOn__c))
            {
                string appliedOn = DateFormat(applicant2.AppliedOn__c);
                //DateTime dt2 = Convert.ToDateTime(appliedOn);
                loan2.AppliedOn__c          = DateTime.ParseExact(appliedOn, "d/M/yyyy", CultureInfo.InvariantCulture);
                loan2.AppliedOn__cSpecified = true;
            }

            EnterpriseWsdl.sObject[] outreachArray2 = new EnterpriseWsdl.sObject[] { loan2 };

            EnterpriseWsdl.SaveResult[] createResult2;
            EnterpriseWsdl.LimitInfo[]  limitInfo2;

            apiClient.create(header, null, null, null, null, null, null, null, null, null, null, outreachArray2, out limitInfo2, out createResult2);

            if (createResult2[0].success)
            {
                LogLoanInformation(sw, applicant2);
            }
            else
            {
                LogErrorMessage(sw, "Loan insertion failed due to : " + createResult2[0].errors[0].statusCode);
            }
        }
Beispiel #3
0
 private static void LogLoanInformation(StreamWriter sw, Applicant2 applicant2)
 {
     sw.WriteLine("Log time " + String.Format("{0:dd.MM.yyyy hh:mm:ss}", DateTime.Now));
     sw.WriteLine("Loan Amount : " + applicant2.Loan_Amount__c + " Loan Days : " + applicant2.Loan_Days__c + " added successfully.");
     sw.WriteLine("");
 }
Beispiel #4
0
        //private static void InsertApplicantsTosalesForce(EnterpriseWsdl.SoapClient apiClient)
        private static void InsertApplicantToSalesForce(EnterpriseWsdl.SoapClient apiClient, Applicant2 applicant2)
        {
            EnterpriseWsdl.Applicant__c applic2 = new EnterpriseWsdl.Applicant__c();

            if (!String.IsNullOrEmpty(applicant2.LAS_Customer_Id__c))
            {
                applic2.LAS_Customer_Id__c = applicant2.LAS_Customer_Id__c;
            }

            if (!String.IsNullOrEmpty(applicant2.LAS_User_Name__c))
            {
                applic2.LAS_User_Name__c = applicant2.LAS_User_Name__c;
            }

            if (!String.IsNullOrEmpty(applicant2.Title__c))
            {
                applic2.Title__c = applicant2.Title__c;
            }

            if (!String.IsNullOrEmpty(applicant2.First_Name__c))
            {
                applic2.First_Name__c = applicant2.First_Name__c.Replace("'", " ").Replace("-", "");
            }

            if (!String.IsNullOrEmpty(applicant2.Middle_Name__c))
            {
                applic2.Middle_Name__c = applicant2.Middle_Name__c.Replace("'", " ").Replace("-", "");
            }

            if (!String.IsNullOrEmpty(applicant2.Last_Name__c))
            {
                applic2.Last_Name__c = applicant2.Last_Name__c.Replace("'", " ").Replace("-", "");
            }

            if (!String.IsNullOrEmpty(applicant2.Email__c))
            {
                applic2.Email__c = applicant2.Email__c;
            }

            if (!String.IsNullOrEmpty(applicant2.Mobile__c))
            {
                applic2.Mobile__c = PhoneFormat(applicant2.Mobile__c);
            }

            if (!String.IsNullOrEmpty(applicant2.Date_Of_Birth__c))
            {
                string dateofbirth = DateFormat(applicant2.Date_Of_Birth__c);
                //DateTime dt = DateTime.Parse(dateofbirth);
                applic2.Date_Of_Birth__c          = DateTime.ParseExact(dateofbirth, "d/M/yyyy", CultureInfo.InvariantCulture);
                applic2.Date_Of_Birth__cSpecified = true;
            }

            if (!String.IsNullOrEmpty(applicant2.Residential_Status__c))
            {
                applic2.Residential_Status__c = applicant2.Residential_Status__c;
            }

            if (!String.IsNullOrEmpty(applicant2.Marital_Status__c))
            {
                applic2.Marital_Status__c = applicant2.Marital_Status__c;
            }

            if (!String.IsNullOrEmpty(applicant2.Postal_Code__c))
            {
                applic2.Postal_Code__c = applicant2.Postal_Code__c;
            }

            if (!String.IsNullOrEmpty(applicant2.Mobile__c))
            {
                applic2.Street__c = applicant2.Street__c;
            }

            if (!String.IsNullOrEmpty(applicant2.County__c))
            {
                applic2.County__c = applicant2.County__c;
            }

            if (!String.IsNullOrEmpty(applicant2.Landline__c))
            {
                applic2.Landline__c = PhoneFormat(applicant2.Landline__c);
            }

            if (!String.IsNullOrEmpty(applicant2.Flat_Number__c))
            {
                applic2.Flat_Number__c = applicant2.Flat_Number__c;
            }

            if (!String.IsNullOrEmpty(applicant2.Town__c))
            {
                applic2.Town__c = applicant2.Town__c;
            }

            if (!String.IsNullOrEmpty(applicant2.Password__c))
            {
                applic2.Password__c = applicant2.Password__c;
            }

            EnterpriseWsdl.sObject[] outreachArray = new EnterpriseWsdl.sObject[] { applic2 };

            EnterpriseWsdl.SaveResult[] createResult;
            EnterpriseWsdl.LimitInfo[]  limitInfo;

            apiClient.create(header, null, null, null, null, null, null, null, null, null, null, outreachArray, out limitInfo, out createResult);

            if (createResult[0].success)
            {
                LogApplicantInformation(sw, applicant2);

                InsertLoanToSalesforce(apiClient, applicant2, createResult[0].id);
            }
            else
            {
                LogErrorMessage(sw, "Applicant insertion failed due to : " + createResult[0].errors[0].statusCode);
            }
        }
Beispiel #5
0
 private static void LogApplicantInformation(StreamWriter sw, Applicant2 applicant2)
 {
     sw.WriteLine("Log time " + String.Format("{0:dd.MM.yyyy hh:mm:ss}", DateTime.Now));
     sw.WriteLine("App Id : " + applicant2.LAS_Loan_Id__c + " DOB : " + applicant2.Date_Of_Birth__c + " Email : " + applicant2.Email__c + " Mobile : " + applicant2.Mobile__c + " added successfully.");
     sw.WriteLine("");
 }