Beispiel #1
0
        public int LoanDetailSaveFileId(LPWeb.Model.LoanDetails model)
        {
            int FileId = 0;

            FileId = dal.LoanDetailSaveFileId(model);
            return(FileId);
        }
Beispiel #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);
    }
Beispiel #3
0
    private int Save_LoanDetail()
    {
        ReassignProspect();

        #region gdc crm33
        int    iContactCoBoId = string.IsNullOrEmpty(hdnCoBorrowerID.Value) ? 0 : Convert.ToInt32(hdnCoBorrowerID.Value);
        string CBname         = txtCBFirstname.Text + txtCBMiddlename.Text + txtCBLastname.Text;

        if ((CBname != hdnCoBorrowerName.Value.Trim() || iContactCoBoId == 0) && !string.IsNullOrEmpty(CBname))
        {
            LPWeb.Model.Contacts contactRecCoBo = new LPWeb.Model.Contacts();
            Contacts             contactsbll    = new Contacts();//gdc crm33
            contactRecCoBo.ContactId  = 0;
            contactRecCoBo.FirstName  = txtCBFirstname.Text.Trim();
            contactRecCoBo.MiddleName = txtCBMiddlename.Text.Trim();
            contactRecCoBo.LastName   = txtCBLastname.Text.Trim();

            iContactCoBoId = contactsbll.AddClient(contactRecCoBo);//gdc crm33

            #region CoBo to loanContacts  gdc crm33
            LPWeb.BLL.LoanContacts loanContactsBll = new LoanContacts();


            LPWeb.BLL.ContactRoles contactRolesbll = new ContactRoles();
            int contactRoleID   = 0;
            var contactRoleList = contactRolesbll.GetModelList(" Name = 'CoBorrower' ");
            if (contactRoleList != null && contactRoleList.Count > 0 && contactRoleList.FirstOrDefault() != null)
            {
                contactRoleID = contactRoleList.FirstOrDefault().ContactRoleId;
            }

            if (contactRoleID != 0)
            {
                LPWeb.Model.LoanContacts loanContactModel = new LPWeb.Model.LoanContacts();
                loanContactModel.FileId        = iFileID;
                loanContactModel.ContactRoleId = contactRoleID;
                loanContactModel.ContactId     = iContactCoBoId;

                loanContactsBll.Add(loanContactModel);
            }

            #endregion
        }
        #endregion

        LPWeb.Model.LoanDetails model = new LPWeb.Model.LoanDetails();
        model.FileId = iFileID;
        if (ddlBorrower.Items.Count < 1)
        {
            model.BoID = 0;
        }
        else
        {
            model.BoID = int.Parse(ddlBorrower.SelectedValue);
        }
        //if (ddlCoBorrower.Items.Count < 1)
        //{
        //    model.CoBoID = 0;
        //}
        //else
        //{
        //    model.CoBoID = int.Parse(ddlCoBorrower.SelectedValue);
        //}

        if (iContactCoBoId != 0)
        {
            model.CoBoID = iContactCoBoId;
        }


        model.Created    = DateTime.Now;
        model.CreatedBy  = loginUser.iUserID;
        model.Modifed    = DateTime.Now;
        model.ModifiedBy = loginUser.iUserID;
        if (txbAmount.Text.Trim().Length < 1)
        {
            model.LoanAmount = 0;
        }
        else
        {
            model.LoanAmount = decimal.Parse(txbAmount.Text.Trim());
        }

        if (txbEstimatedDate.Text.Trim().Length > 5)
        {
            model.EstCloseDate = DateTime.Parse(txbEstimatedDate.Text.Trim());
        }
        else
        {
            model.EstCloseDate = DateTime.Parse("1900-1-1");
        }
        if (ddlRanking.SelectedIndex >= 0)
        {
            model.Ranking = ddlRanking.SelectedValue;
        }
        model.UserId = CurrUser.iUserID;
        if (ddlLoanOfficer.Items.Count < 1)
        {
            model.LoanOfficerId = 0;
        }
        else
        {
            model.LoanOfficerId = int.Parse(ddlLoanOfficer.SelectedValue);
        }
        if (txbInterestRate.Text.Trim().Length < 1)
        {
            model.Rate = 0;
        }
        else
        {
            model.Rate = decimal.Parse(txbInterestRate.Text.Trim());
        }

        if (ddlLoanProgram.SelectedIndex == 0)
        {
            model.Program = "";
        }
        else
        {
            model.Program = ddlLoanProgram.SelectedItem.Text;
        }
        if (ddlPurpose.SelectedIndex == 0)
        {
            model.Purpose = "";
        }
        else
        {
            model.Purpose = ddlPurpose.SelectedItem.Text.Trim();
        }

        model.Lien          = ddlLienPosition.SelectedItem.Value.Trim();
        model.PropertyAddr  = txbPropertyAddress.Text.Trim();
        model.PropertyCity  = txbCity.Text.Trim();
        model.PropertyState = ddlState.SelectedValue;
        model.PropertyZip   = txbZip.Text.Trim();
        if (ddlPointFolder.Items.Count < 1)
        {
            model.FolderId = 0;
        }
        else
        {
            model.FolderId = int.Parse(ddlPointFolder.SelectedValue);
        }
        model.FileName           = txbPointFileName.Text.Trim();
        model.Status             = "Prospect";
        model.ProspectLoanStatus = "Active";

        model.PropertyType   = txbPropetyType.Text.Trim();
        model.HousingStatus  = txbHousingStatus.Text.Trim();
        model.IncludeEscrows = cbIncludeEscrows.Checked;
        model.InterestOnly   = cbInterestOnly.Checked;
        model.RentAmount     = string.IsNullOrEmpty(txbRentAmount.Text.Trim()) ? 0 : Convert.ToDecimal(txbRentAmount.Text.Trim());
        model.CoborrowerType = txbCoborrowerType.Text.Trim();
        iFileID = loan.LoanDetailSaveFileId(model);


        #region Referral
        LPWeb.Model.Prospect modelProspect = new LPWeb.Model.Prospect();

        LPWeb.BLL.Prospect bllProspect = new Prospect();
        modelProspect = bllProspect.GetModel(iContactID);

        modelProspect.LeadSource = ddlLeadSource.SelectedValue; //gdc CR40

        int referralIDNew = string.IsNullOrEmpty(hdnReferralID.Value.Trim()) ? 0 : Convert.ToInt32(hdnReferralID.Value.Trim());

        if (referralIDNew > 0 && referralIDNew.ToString() != modelProspect.Referral.ToString())
        {
            int referralIDOld = modelProspect.Referral == null ? 0 : Convert.ToInt32(modelProspect.Referral);

            modelProspect.Referral = referralIDNew;

            #region Referral to loanContacts  gdc crm33
            LPWeb.BLL.LoanContacts loanContactsBll = new LoanContacts();

            LPWeb.BLL.ContactRoles contactRolesbll = new ContactRoles();
            int refrralRoleID    = 0;
            var referralRoleList = contactRolesbll.GetModelList(" Name = 'Referral' ");
            if (referralRoleList != null && referralRoleList.Count > 0 && referralRoleList.FirstOrDefault() != null)
            {
                refrralRoleID = referralRoleList.FirstOrDefault().ContactRoleId;
            }

            if (refrralRoleID != 0)
            {
                LPWeb.Model.LoanContacts loanContactModel = new LPWeb.Model.LoanContacts();
                loanContactModel.FileId        = iFileID;
                loanContactModel.ContactRoleId = refrralRoleID;
                loanContactModel.ContactId     = referralIDNew;

                loanContactsBll.Add(loanContactModel);
            }

            #endregion


            #region Del Old loanContacts

            try
            {
                if (referralIDOld > 0)
                {
                    loanContactsBll.Delete(iFileID, refrralRoleID, referralIDOld);
                }
            }
            catch { }

            #endregion
        }

        bllProspect.Update(modelProspect); //gdc CR40

        #endregion

        return(iFileID);
    }
Beispiel #4
0
    protected int CreateLoan(int iBorrowerID, int iCoBorrowerID, string sHousingStatus, string sRentAmount,
                             string sPropertyStreetAddress1, string sPropertyStreetAddress2, string sPropertyCity, string sPropertyState,
                             string sPropertyZip, string sPropertyValue, string sPurpose, string sLoanType, string sProgram, string sAmount,
                             string sRate, string sPMI, string sPMITax, string sTerm, string sStartYear, string sStartMonth, bool bSubordinate, bool b2nd, string s2ndAmount, string sRanking)
    {
        int iFolderId = 0;

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

        LoanDetailsModel.FileId             = 0;
        LoanDetailsModel.FolderId           = iFolderId;
        LoanDetailsModel.Status             = "Prospect";
        LoanDetailsModel.ProspectLoanStatus = "Active";
        LoanDetailsModel.Ranking            = sRanking; //"Hot";
        LoanDetailsModel.BoID          = iBorrowerID;
        LoanDetailsModel.CoBoID        = iCoBorrowerID;
        LoanDetailsModel.HousingStatus = sHousingStatus;
        if (sRentAmount == string.Empty)
        {
            LoanDetailsModel.RentAmount = 0;
        }
        else
        {
            LoanDetailsModel.RentAmount = Convert.ToDecimal(sRentAmount);
        }
        LoanDetailsModel.PropertyAddr  = (sPropertyStreetAddress1 + " " + sPropertyStreetAddress2).Trim();
        LoanDetailsModel.PropertyCity  = sPropertyCity;
        LoanDetailsModel.PropertyState = sPropertyState;
        LoanDetailsModel.PropertyZip   = sPropertyZip;

        if (sPropertyValue == string.Empty)
        {
            LoanDetailsModel.SalesPrice = null;
        }
        else
        {
            LoanDetailsModel.SalesPrice = Convert.ToDecimal(sPropertyValue);
        }

        LoanDetailsModel.Purpose  = sPurpose;
        LoanDetailsModel.LoanType = sLoanType;
        LoanDetailsModel.Program  = sProgram;
        if (sAmount == "")
        {
            LoanDetailsModel.LoanAmount = null;
        }
        else
        {
            LoanDetailsModel.LoanAmount = Convert.ToDecimal(sAmount);
        }

        if (sRate == string.Empty)
        {
            LoanDetailsModel.Rate = null;
        }
        else
        {
            LoanDetailsModel.Rate = Convert.ToDecimal(sRate);
        }

        if (sPMI == string.Empty)
        {
            LoanDetailsModel.MonthlyPMI = null;
        }
        else
        {
            LoanDetailsModel.MonthlyPMI = Convert.ToDecimal(sPMI);
        }

        if (sPMITax == string.Empty)
        {
            LoanDetailsModel.MonthlyPMITax = null;
        }
        else
        {
            LoanDetailsModel.MonthlyPMITax = Convert.ToDecimal(sPMITax);
        }

        if (sTerm == string.Empty)
        {
            LoanDetailsModel.Term = null;
        }
        else
        {
            LoanDetailsModel.Term = Convert.ToInt16(sTerm);
        }

        // StartDate=MM/yyyy/01
        LoanDetailsModel.EstCloseDate = this.GetStartDate(sStartYear, sStartMonth);

        LoanDetailsModel.TD_2 = b2nd;
        Decimal it = 0;

        if (LoanDetailsModel.TD_2 == true)
        {
            if (Decimal.TryParse(s2ndAmount, out it))
            {
                LoanDetailsModel.TD_2Amount = it;
            }
            else
            {
                LoanDetailsModel.TD_2Amount = null;
            }
        }
        else
        {
            LoanDetailsModel.TD_2Amount = null;
        }

        LoanDetailsModel.Subordinate = bSubordinate;

        LoanDetailsModel.Created       = DateTime.Now;
        LoanDetailsModel.CreatedBy     = this.CurrUser.iUserID;
        LoanDetailsModel.Modifed       = null;
        LoanDetailsModel.ModifiedBy    = null;
        LoanDetailsModel.UserId        = this.CurrUser.iUserID;
        LoanDetailsModel.LoanOfficerId = this.CurrUser.iUserID;

        LoanDetailsModel.Lien           = string.Empty;
        LoanDetailsModel.FileName       = string.Empty;
        LoanDetailsModel.IncludeEscrows = false;
        LoanDetailsModel.InterestOnly   = false;
        LoanDetailsModel.CoborrowerType = string.Empty;

        int iFileID = this.LoansMgr.LoanDetailSaveFileId(LoanDetailsModel);

        return(iFileID);
    }
Beispiel #5
0
 public void LoanDetailSave(LPWeb.Model.LoanDetails model)
 {
     dal.LoanDetailSave(model);
 }