示例#1
0
    protected int CreateContactAndProspect(string sFirstName, string sLastName, string sEmail, string sType, string sPhone, string sDOB, string sSSN, int iUserID, string Purpose)
    {
        #region create new contact

        LPWeb.Model.Contacts ContactsModel = new LPWeb.Model.Contacts();
        ContactsModel.ContactId = 0;
        ContactsModel.FirstName = sFirstName;
        ContactsModel.LastName  = sLastName;
        ContactsModel.Email     = sEmail;

        if (sType == "Cell Phone")
        {
            ContactsModel.CellPhone     = sPhone;
            ContactsModel.HomePhone     = string.Empty;
            ContactsModel.BusinessPhone = string.Empty;
        }
        else if (sType == "Home Phone")
        {
            ContactsModel.CellPhone     = string.Empty;
            ContactsModel.HomePhone     = sPhone;
            ContactsModel.BusinessPhone = string.Empty;
        }
        else if (sType == "Work Phone")
        {
            ContactsModel.CellPhone     = string.Empty;
            ContactsModel.HomePhone     = string.Empty;
            ContactsModel.BusinessPhone = sPhone;
        }

        if (sDOB == string.Empty)
        {
            ContactsModel.DOB = null;
        }
        else
        {
            ContactsModel.DOB = Convert.ToDateTime(sDOB);
        }

        ContactsModel.SSN = sSSN;

        ContactsModel.MiddleName     = string.Empty;
        ContactsModel.NickName       = txtFirstName.Text.Trim();
        ContactsModel.Title          = string.Empty;
        ContactsModel.GenerationCode = string.Empty;
        ContactsModel.Fax            = string.Empty;
        ContactsModel.MailingAddr    = string.Empty;
        ContactsModel.MailingCity    = string.Empty;
        ContactsModel.MailingState   = string.Empty;
        ContactsModel.MailingZip     = string.Empty;

        #endregion

        #region create new prospect

        LPWeb.Model.Prospect ProspectModel = new LPWeb.Model.Prospect();

        ProspectModel.PreferredContact = sType;

        ProspectModel.Contactid  = 0;
        ProspectModel.Created    = DateTime.Now;
        ProspectModel.CreatedBy  = iUserID;
        ProspectModel.LeadSource = ddlLeadSource.SelectedValue.ToString() == "0" ? "" : this.ddlLeadSource.SelectedItem.Text;

        string sLoanOfficerID = ddlLoanOfficer.SelectedValue;
        iLoanOfficerID = 0;
        if (sLoanOfficerID == "-1" || sLoanOfficerID == "-2")
        {
            //Nobody
        }
        else if (sLoanOfficerID == "0")
        {
            //Lead Routing Engine
            try
            {
                ServiceManager sm = new ServiceManager();
                using (LP2ServiceClient client = sm.StartServiceClient())
                {
                    //invoke the WCF API GetNextLoanOfficer
                    LR_GetNextLoanOfficerReq req = new LR_GetNextLoanOfficerReq();
                    req.LeadSource           = ddlLeadSource.SelectedItem.Text;
                    req.Purpose              = Purpose;
                    req.ReqHdr               = new ReqHdr();
                    req.ReqHdr.UserId        = CurrUser.iUserID;
                    req.ReqHdr.SecurityToken = "SecurityToken";
                    LR_GetNextLoanOfficerResp response = client.LeadRouting_GetNextLoanofficer(req);
                    if (response.RespHdr.Successful)
                    {
                        iLoanOfficerID = response.NextLoanOfficerID;
                    }
                    else
                    {
                        Company_Lead_Sources LeadSourceMgr     = new Company_Lead_Sources();
                        DataTable            SelLeadSourceList = LeadSourceMgr.GetList("LeadSourceID='" + ddlLeadSource.SelectedValue + "'").Tables[0];
                        if (SelLeadSourceList != null && SelLeadSourceList.Rows.Count > 0)
                        {
                            iLoanOfficerID = SelLeadSourceList.Rows[0]["DefaultUserId"] == DBNull.Value ? 0 : Convert.ToInt32(SelLeadSourceList.Rows[0]["DefaultUserId"]);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Company_Lead_Sources LeadSourceMgr     = new Company_Lead_Sources();
                DataTable            SelLeadSourceList = LeadSourceMgr.GetList("LeadSourceID='" + ddlLeadSource.SelectedValue + "'").Tables[0];
                if (SelLeadSourceList != null && SelLeadSourceList.Rows.Count > 0)
                {
                    iLoanOfficerID = SelLeadSourceList.Rows[0]["DefaultUserId"] == DBNull.Value ? 0 : Convert.ToInt32(SelLeadSourceList.Rows[0]["DefaultUserId"]);
                }
            }
        }
        else
        {
            iLoanOfficerID = Convert.ToInt32(sLoanOfficerID);
        }


        ProspectModel.Loanofficer   = iLoanOfficerID;
        ProspectModel.ReferenceCode = string.Empty;
        ProspectModel.Status        = "Active";
        ProspectModel.CreditRanking = string.Empty;
        ProspectModel.Referral      = null;

        Prospect ProspectManager = new Prospect();

        int iContactId = ProspectManager.CreateContactAndProspect(ContactsModel, ProspectModel);


        #endregion

        return(iContactId);
    }
示例#2
0
    protected int CreateLoan(int iContactId, decimal LoanAmount, string Purpose)
    {
        int iFolderId = 0;

        LPWeb.Model.LoanDetails LoanDetailsModel = new LPWeb.Model.LoanDetails();

        LoanDetailsModel.FileId             = 0;
        LoanDetailsModel.FolderId           = iFolderId;
        LoanDetailsModel.Status             = "Prospect";
        LoanDetailsModel.ProspectLoanStatus = "Active";

        LoanDetailsModel.BoID   = iContactId;
        LoanDetailsModel.CoBoID = 0;

        LoanDetailsModel.Created    = DateTime.Now;
        LoanDetailsModel.CreatedBy  = CurrUser.iUserID;
        LoanDetailsModel.Modifed    = DateTime.Now;
        LoanDetailsModel.ModifiedBy = CurrUser.iUserID;

        LoanDetailsModel.LoanAmount   = LoanAmount;
        LoanDetailsModel.EstCloseDate = null;
        LoanDetailsModel.Ranking      = string.Empty;
        LoanDetailsModel.UserId       = CurrUser.iUserID;

        string sLoanOfficerID = ddlLoanOfficer.SelectedValue;

        iLoanOfficerID = 0;
        if (sLoanOfficerID == "-1" || sLoanOfficerID == "-2")
        {
            //Nobody
        }
        else if (sLoanOfficerID == "0")
        {
            //Lead Routing Engine
            try
            {
                ServiceManager sm = new ServiceManager();
                using (LP2ServiceClient client = sm.StartServiceClient())
                {
                    //invoke the WCF API GetNextLoanOfficer
                    LR_GetNextLoanOfficerReq req = new LR_GetNextLoanOfficerReq();
                    req.LeadSource           = ddlLeadSource.SelectedItem.Text;
                    req.Purpose              = Purpose;
                    req.ReqHdr               = new ReqHdr();
                    req.ReqHdr.UserId        = CurrUser.iUserID;
                    req.ReqHdr.SecurityToken = "SecurityToken";
                    LR_GetNextLoanOfficerResp response = client.LeadRouting_GetNextLoanofficer(req);
                    if (response.RespHdr.Successful)
                    {
                        iLoanOfficerID = response.NextLoanOfficerID;
                    }
                    else
                    {
                        Company_Lead_Sources LeadSourceMgr     = new Company_Lead_Sources();
                        DataTable            SelLeadSourceList = LeadSourceMgr.GetList("LeadSourceID='" + ddlLeadSource.SelectedValue + "'").Tables[0];
                        if (SelLeadSourceList != null && SelLeadSourceList.Rows.Count > 0)
                        {
                            iLoanOfficerID = SelLeadSourceList.Rows[0]["DefaultUserId"] == DBNull.Value ? 0 : Convert.ToInt32(SelLeadSourceList.Rows[0]["DefaultUserId"]);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Company_Lead_Sources LeadSourceMgr     = new Company_Lead_Sources();
                DataTable            SelLeadSourceList = LeadSourceMgr.GetList("LeadSourceID='" + ddlLeadSource.SelectedValue + "'").Tables[0];
                if (SelLeadSourceList != null && SelLeadSourceList.Rows.Count > 0)
                {
                    iLoanOfficerID = SelLeadSourceList.Rows[0]["DefaultUserId"] == DBNull.Value ? 0 : Convert.ToInt32(SelLeadSourceList.Rows[0]["DefaultUserId"]);
                }
            }
        }
        else
        {
            iLoanOfficerID = Convert.ToInt32(sLoanOfficerID);
        }

        LoanDetailsModel.LoanOfficerId = iLoanOfficerID;
        LoanDetailsModel.Rate          = null;
        LoanDetailsModel.Program       = string.Empty;
        LoanDetailsModel.Purpose       = Purpose;
        LoanDetailsModel.Lien          = string.Empty;

        LoanDetailsModel.PropertyAddr  = string.Empty;
        LoanDetailsModel.PropertyCity  = string.Empty;
        LoanDetailsModel.PropertyState = string.Empty;
        LoanDetailsModel.PropertyZip   = string.Empty;

        LoanDetailsModel.FileName       = string.Empty;
        LoanDetailsModel.PropertyType   = string.Empty;
        LoanDetailsModel.HousingStatus  = string.Empty;
        LoanDetailsModel.IncludeEscrows = false;
        LoanDetailsModel.InterestOnly   = false;
        LoanDetailsModel.RentAmount     = 0;
        LoanDetailsModel.CoborrowerType = string.Empty;

        Loans LoansMgr = new Loans();

        int iFileID = LoansMgr.LoanDetailSaveFileId(LoanDetailsModel);

        return(iFileID);
    }