Esempio n. 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LPWeb.Model.LoanPointFields> DataTableToList(DataTable dt)
        {
            List <LPWeb.Model.LoanPointFields> modelList = new List <LPWeb.Model.LoanPointFields>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LPWeb.Model.LoanPointFields model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LPWeb.Model.LoanPointFields();
                    if (dt.Rows[n]["FileId"].ToString() != "")
                    {
                        model.FileId = int.Parse(dt.Rows[n]["FileId"].ToString());
                    }
                    if (dt.Rows[n]["PointFieldId"].ToString() != "")
                    {
                        model.PointFieldId = int.Parse(dt.Rows[n]["PointFieldId"].ToString());
                    }
                    model.PrevValue    = dt.Rows[n]["PrevValue"].ToString();
                    model.CurrentValue = dt.Rows[n]["CurrentValue"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 2
0
    private void AddLoanPointField(int iFileId, int iPointFieldId, string sCurrentValue)
    {
        LPWeb.Model.LoanPointFields LoanPointFieldsModel = new LPWeb.Model.LoanPointFields();
        LoanPointFieldsModel.FileId       = iFileId;
        LoanPointFieldsModel.PointFieldId = iPointFieldId;
        LoanPointFieldsModel.CurrentValue = sCurrentValue;

        if (LoanPointFieldsMgr == null)
        {
            LoanPointFieldsMgr = new LoanPointFields();
        }
        LoanPointFieldsMgr.Add(LoanPointFieldsModel);
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 检查权限

        SyncNow_Once = false;

        if (this.CurrUser.userRole.AccessProfitability == false)
        {
            this.Response.Redirect("../Unauthorize1.aspx");
            return;
        }

        // Rate Lock权限
        if (this.CurrUser.userRole.LockRate == false && this.CurrUser.userRole.ViewLockInfo == false)
        {
            this.hdnShowLockRatePopup.Value = "false";
        }
        else
        {
            this.hdnShowLockRatePopup.Value = "true";
        }

        // View Compensation权限
        if (this.CurrUser.userRole.ViewCompensation == true)
        {
            this.hdnShowCompensationDetailPopup.Value = "true";
        }
        else
        {
            this.hdnShowCompensationDetailPopup.Value = "false";
        }

        // Modify Loan Info权限
        if (this.CurrUser.userRole.Loans.Contains("B") == true)
        {
            this.hdnModifyLoan.Value = "true";
        }
        else
        {
            this.hdnModifyLoan.Value = "false";
        }

        #endregion

        #region 校验页面参数

        #region 校验FileId

        bool bValid = PageCommon.ValidateQueryString(this, "FileId", QueryStringType.ID);
        if (bValid == false)
        {
            PageCommon.WriteJsEnd(this, "Invalid file id.", "");
            return;
        }

        string sFileId = this.Request.QueryString["FileId"];
        this.iFileId = Convert.ToInt32(sFileId);

        #endregion

        #endregion

        #region 加载Loan Info

        Loans LoansMgr = new Loans();
        this.LoanInfo = LoansMgr.GetLoanInfo(this.iFileId);
        if (LoanInfo.Rows.Count == 0)
        {
            PageCommon.WriteJsEnd(this, "Invalid file id.", "");
            return;
        }

        #endregion

        #region 加载LoanProfit Info

        LoanProfit LoanProfitMgr = new LoanProfit();
        this.LoanProfitInfo = LoanProfitMgr.GetLoanProfitInfo(this.iFileId);

        #endregion

        #region 加载LoanLocks Info

        LoanLocks LoanLocksMgr = new LoanLocks();
        this.LoanLocksInfo = LoanLocksMgr.GetLoanLocksInfo(this.iFileId);

        #endregion

        if (this.IsPostBack == false)
        {
            #region Loan Amount
            decimal dPoints     = decimal.Zero;
            decimal dLoanAmount = 0;

            LoanPointFieldsMgr = new LoanPointFields();
            LPWeb.Model.LoanPointFields PointFieldInfo = LoanPointFieldsMgr.GetModel(this.iFileId, 21017);
            if (PointFieldInfo != null && !string.IsNullOrEmpty(PointFieldInfo.CurrentValue))
            {
                decimal.TryParse(PointFieldInfo.CurrentValue, out dLoanAmount);
            }
            if (dLoanAmount <= 0 && this.LoanInfo != null && this.LoanInfo.Rows.Count > 0)
            {
                dLoanAmount = this.LoanInfo.Rows[0]["LoanAmount"] == DBNull.Value ? 0 : (decimal)this.LoanInfo.Rows[0]["LoanAmount"];
            }
            this.txtLoanAmount.Text    = dLoanAmount.ToString("n2");
            this.txtLoanAmount.Enabled = false;

            #endregion

            #region Mandatory/Final Price

            decimal dMandatoryPrice      = decimal.Zero;
            decimal dMandatoryPricePoint = decimal.Zero;
            PointFieldInfo = LoanPointFieldsMgr.GetModel(this.iFileId, 11604);
            if (PointFieldInfo != null && !string.IsNullOrEmpty(PointFieldInfo.CurrentValue))
            {
                if (decimal.TryParse(PointFieldInfo.CurrentValue, out dMandatoryPricePoint))
                {
                    this.txtMandatory_Points.Text = dMandatoryPricePoint.ToString("n3");
                    dMandatoryPrice = dMandatoryPricePoint * dLoanAmount / 100;
                    this.txtMandatory_Amount.Text = dMandatoryPrice.ToString("n2");
                }
            }

            #endregion

            #region Best Effort Price

            decimal dBestEffortPrice      = decimal.Zero;
            decimal dBestEffortPricePoint = decimal.Zero;
            PointFieldInfo = LoanPointFieldsMgr.GetModel(this.iFileId, 12492);
            if (PointFieldInfo != null && !string.IsNullOrEmpty(PointFieldInfo.CurrentValue))
            {
                if (decimal.TryParse(PointFieldInfo.CurrentValue, out dBestEffortPricePoint))
                {
                    this.txtBestEffortPrice_Points.Text = (dBestEffortPricePoint).ToString("n3");
                    dBestEffortPrice = dBestEffortPricePoint * dLoanAmount / 100;
                    this.txtBestEffortPrice_Amount.Text = dBestEffortPrice.ToString("n2");
                }
            }

            #endregion

            #region Commission Total

            // CR67
            #region 获取Commission Total %

            LoanTeam  LoanTeamMgr     = new LoanTeam();
            DataTable LoanOfficerInfo = LoanTeamMgr.GetLoanOfficerInfo(this.iFileId);

            decimal dCommissionTotalPoint = decimal.Zero;
            if (LoanOfficerInfo.Rows.Count > 0)
            {
                DataRow LoanOfficerRow = LoanOfficerInfo.Rows[0];

                decimal dLOComp          = LoanOfficerRow["LOComp"] == DBNull.Value ? decimal.Zero : Convert.ToDecimal(LoanOfficerRow["LOComp"]);
                decimal dBranchMgrComp   = LoanOfficerRow["BranchMgrComp"] == DBNull.Value ? decimal.Zero : Convert.ToDecimal(LoanOfficerRow["BranchMgrComp"]);
                decimal dDivisionMgrComp = LoanOfficerRow["DivisionMgrComp"] == DBNull.Value ? decimal.Zero : Convert.ToDecimal(LoanOfficerRow["DivisionMgrComp"]);
                decimal dRegionMgrComp   = LoanOfficerRow["RegionMgrComp"] == DBNull.Value ? decimal.Zero : Convert.ToDecimal(LoanOfficerRow["RegionMgrComp"]);

                dCommissionTotalPoint = dLOComp + dBranchMgrComp + dDivisionMgrComp + dRegionMgrComp;
                this.txtCommissionTotal_Points.Text = dCommissionTotalPoint.ToString("n3");
            }

            #endregion

            // 计算Commission Total $
            decimal dCommissionTotalAmount = dLoanAmount * dCommissionTotalPoint / 100;
            this.txtCommissionTotal_Amount.Text = dCommissionTotalAmount.ToString("n2");

            #endregion

            #region Lender Credit

            // CR67
            // 获取Lender Credit %
            decimal dLenderCreditAmount = decimal.Zero;
            decimal dLenderCreditPoint  = decimal.Zero;
            // LW 08/30/2013 Changed Lender Credit 2284-->812
            PointFieldInfo = LoanPointFieldsMgr.GetModel(this.iFileId, 812);
            if (PointFieldInfo != null && !string.IsNullOrEmpty(PointFieldInfo.CurrentValue))
            {
                if (decimal.TryParse(PointFieldInfo.CurrentValue, out dLenderCreditAmount) == true)
                {
                    // Lender Credit %
                    this.txtLenderCredit_Amount.Text = dLenderCreditAmount.ToString("n2");

                    // 计算Lender Credit $
                    if (dLoanAmount > 0)
                    {
                        dLenderCreditPoint = dLenderCreditAmount * 100 / dLoanAmount;
                    }
                    else
                    {
                        dLenderCreditPoint = 0;
                    }
                    this.txtLenderCredit_Points.Text = dLenderCreditPoint.ToString("n3");
                }
            }

            #endregion

            #region LPMI

            decimal dLPMI      = decimal.Zero;
            decimal dLPMIPoint = decimal.Zero;
            PointFieldInfo = LoanPointFieldsMgr.GetModel(this.iFileId, 12973);
            if (PointFieldInfo != null && !string.IsNullOrEmpty(PointFieldInfo.CurrentValue))
            {
                if (decimal.TryParse(PointFieldInfo.CurrentValue, out dLPMIPoint))
                {
                    this.txtLPMI_Points.Text = dLPMIPoint.ToString("n3");
                    dLPMI = dLPMIPoint * dLoanAmount / 100;
                    this.txtLPMI_Amount.Text = dLPMI.ToString("n2");
                }
            }

            #endregion

            #region Best Effort Price to LO

            #region 注释代码
            //decimal dBestEffortPriceToLO = decimal.Zero;
            //PointFieldInfo = LoanPointFieldsMgr.GetPointFieldInfo(this.iFileId, 12495);
            //if (PointFieldInfo.Rows.Count > 0)
            //{
            //    string sAmount = PointFieldInfo.Rows[0]["CurrentValue"] == DBNull.Value ? string.Empty : PointFieldInfo.Rows[0]["CurrentValue"].ToString();
            //    if (sAmount != string.Empty)
            //    {
            //        decimal.TryParse(sAmount, out dBestEffortPriceToLO);
            //    }
            //    else
            //    {
            //        dBestEffortPriceToLO = dCommissionTotalAmount + dLenderCreditAmount + dLPMI;
            //    }

            //    this.txtBestEffortPriceToLO_Amount.Text = dBestEffortPriceToLO.ToString("n2");

            //    // Calc. Points
            //    dPoints = this.CalcPoints(dBestEffortPriceToLO, dLoanAmount);
            //    this.txtBestEffortPriceToLO_Points.Text = (dPoints * 100).ToString("n3");
            //}
            #endregion

            // // 计算Best Effort Price to LO %
            decimal dBestEffortPriceToLOPoint = dCommissionTotalPoint + dLenderCreditPoint + dLPMIPoint;
            this.txtBestEffortPriceToLO_Points.Text = dBestEffortPriceToLOPoint.ToString("n3");
            //this.Response.Write("dCommissionTotalPoint: " + dCommissionTotalPoint + "; dLenderCreditPoint: " + dLenderCreditPoint + "; dLPMIPoint" + dLPMIPoint);

            // 计算Best Effort Price to LO $
            decimal dBestEffortPriceToLOAmount = dLoanAmount * dBestEffortPriceToLOPoint / 100;
            this.txtBestEffortPriceToLO_Amount.Text = dBestEffortPriceToLOAmount.ToString("n2");

            #endregion

            #region Hedge Cost
            decimal dHedgeCost              = decimal.Zero;
            decimal dHedgeCostPoint         = decimal.Zero;
            decimal dHedgeCost_Reverse      = decimal.Zero;
            decimal dHedgeCostPoint_Reverse = decimal.Zero;
            PointFieldInfo = LoanPointFieldsMgr.GetModel(this.iFileId, 12974);
            if (PointFieldInfo != null && !string.IsNullOrEmpty(PointFieldInfo.CurrentValue))
            {
                if (decimal.TryParse(PointFieldInfo.CurrentValue, out dHedgeCostPoint))
                {
                    //dHedgeCostPoint_Reverse = 0 - dHedgeCostPoint;
                    this.txtHedgeCost_Points.Text = dHedgeCostPoint.ToString("n3");
                    dHedgeCost = dHedgeCostPoint * dLoanAmount / 100;
                    //dHedgeCost_Reverse = 0 - dHedgeCost;
                    this.txtHedgeCost_Amount.Text = dHedgeCost.ToString("n2");
                }
            }

            #endregion

            #region Cost on sale
            decimal dCostOnSale      = decimal.Zero;
            decimal dCostOnSalePoint = decimal.Zero;
            PointFieldInfo = LoanPointFieldsMgr.GetModel(this.iFileId, 12975);
            if (PointFieldInfo != null && !string.IsNullOrEmpty(PointFieldInfo.CurrentValue))
            {
                if (decimal.TryParse(PointFieldInfo.CurrentValue, out dCostOnSalePoint))
                {
                    this.txtCostOnSale_Points.Text = dCostOnSalePoint.ToString("n3");
                    dCostOnSale = dCostOnSalePoint * dLoanAmount / 100;
                    this.txtCostOnSale_Amount.Text = dCostOnSale.ToString("n2");
                }
            }

            #endregion

            #region Origination Pts
            decimal dOriginationPts        = decimal.Zero;
            decimal dOriginationPts_Amount = decimal.Zero;
            PointFieldInfo = LoanPointFieldsMgr.GetModel(this.iFileId, 11243);
            if (PointFieldInfo != null && !string.IsNullOrEmpty(PointFieldInfo.CurrentValue))
            {
                if (decimal.TryParse(PointFieldInfo.CurrentValue, out dOriginationPts))
                {
                    this.txtOriginationPts_Points.Text = dOriginationPts.ToString("n3");
                    dOriginationPts_Amount             = dOriginationPts * dLoanAmount / 100;
                    this.txtOriginationPts_Amount.Text = dOriginationPts_Amount.ToString("n2");
                }
            }

            #endregion

            #region Discount Pts
            decimal dDiscountPts        = decimal.Zero;
            decimal dDiscountPts_Amount = decimal.Zero;
            PointFieldInfo = LoanPointFieldsMgr.GetModel(this.iFileId, 11241);
            if (PointFieldInfo != null && !string.IsNullOrEmpty(PointFieldInfo.CurrentValue))
            {
                if (decimal.TryParse(PointFieldInfo.CurrentValue, out dDiscountPts))
                {
                    this.txtDiscountPts_Points.Text = dDiscountPts.ToString("n3");
                    dDiscountPts_Amount             = dDiscountPts * dLoanAmount / 100;
                    this.txtDiscountPts_Amount.Text = dDiscountPts_Amount.ToString("n2");
                }
            }

            #endregion

            //dBestEffortPrice = dBestEffortPriceToLOAmount + dHedgeCost + dCostOnSale + dOriginationPts_Amount + dDiscountPts_Amount;
            //this.txtBestEffortPrice_Amount.Text = dBestEffortPrice.ToString("n2");
            //dBestEffortPricePoint = dBestEffortPrice * 100 / dLoanAmount;
            //this.txtBestEffortPrice_Points.Text = (dBestEffortPricePoint).ToString("n3");

            #region Best Effort Margin
            // LCW 10-05-2013 Per MSA Request remove HedgeCost in the formula
            //decimal dBestEffortMargin = dBestEffortPrice - dBestEffortPriceToLOAmount - dHedgeCost + dCostOnSale + (dOriginationPts * dLoanAmount) + (dDiscountPts * dLoanAmount);
            decimal dBestEffortMargin = dBestEffortPrice - dBestEffortPriceToLOAmount + dCostOnSale + (dOriginationPts * dLoanAmount) + (dDiscountPts * dLoanAmount);
            this.txtBestEffortMargin_Amount.Text = dBestEffortMargin.ToString("n2");

            // Calc. Points
            decimal dBestEffortMargin_Points = this.CalcPoints(dBestEffortMargin, dLoanAmount);
            this.txtBestEffortMargin_Points.Text = (dBestEffortMargin_Points * 100).ToString("n3");

            #endregion

            #region Extension1
            decimal dExtension1      = decimal.Zero;
            decimal dExtension1Point = decimal.Zero;
            PointFieldInfo = LoanPointFieldsMgr.GetModel(this.iFileId, 12976);
            if (PointFieldInfo != null && !string.IsNullOrEmpty(PointFieldInfo.CurrentValue))
            {
                if (decimal.TryParse(PointFieldInfo.CurrentValue, out dExtension1Point))
                {
                    dExtension1 = dExtension1Point * dLoanAmount / 100;
                    this.txtExtension1_Amount.Text = dExtension1.ToString("n2");
                    this.txtExtension1_Points.Text = dExtension1Point.ToString("n3");
                }
            }

            #endregion

            #region Extension2
            decimal dExtension2      = decimal.Zero;
            decimal dExtension2Point = decimal.Zero;
            PointFieldInfo = LoanPointFieldsMgr.GetModel(this.iFileId, 12977);
            if (PointFieldInfo != null && !string.IsNullOrEmpty(PointFieldInfo.CurrentValue))
            {
                if (decimal.TryParse(PointFieldInfo.CurrentValue, out dExtension2Point))
                {
                    dExtension2 = dExtension2Point * dLoanAmount / 100;
                    this.txtExtension2_Amount.Text = dExtension2.ToString("n2");
                    this.txtExtension2_Points.Text = dExtension2Point.ToString("n3");
                }
            }

            #endregion

            #region Final Mandatory Margin

            decimal dFinalMandatoryMargin = dMandatoryPrice - dBestEffortPriceToLOAmount + dHedgeCost + dCostOnSale + (dOriginationPts * dLoanAmount) + (dDiscountPts * dLoanAmount);
            this.txtFinalMandatoryMargin_Amount.Text = dFinalMandatoryMargin.ToString("n2");

            // Calc. Points
            decimal dFinalMandatoryMargin_Points = this.CalcPoints(dFinalMandatoryMargin, dLoanAmount);
            this.txtFinalMandatoryMargin_Points.Text = (dFinalMandatoryMargin_Points * 100).ToString("n3");

            #endregion

            #region Final Best Effort Margin

            decimal dFinalBestEffortMargin = dBestEffortMargin + dExtension1 + dExtension2;
            this.txtFinalBestEffortMargin_Amount.Text = dFinalBestEffortMargin.ToString("n2");

            // Calc. Points
            decimal dFinalBestEffortMargin_Points = this.CalcPoints(dFinalBestEffortMargin, dLoanAmount);
            this.txtFinalBestEffortMargin_Points.Text = (dFinalBestEffortMargin_Points * 100).ToString("n3");

            #endregion

            #region Final Mandatory Pickup

            decimal dMandatoryPickup_Amount = dFinalMandatoryMargin - dFinalBestEffortMargin;
            this.txtMandatoryPickup_Amount.Text = dMandatoryPickup_Amount.ToString("n2");

            // Calc. Points
            decimal dMandatoryPickup_Points = this.CalcPoints(dMandatoryPickup_Amount, dLoanAmount);
            this.txtMandatoryPickup_Points.Text = (dMandatoryPickup_Points * 100).ToString("n3");

            #endregion

            #region Market to Market Daily Price
            // Loan Amount
            this.txtMM_LoanAmount.Text = dLoanAmount.ToString("n2");
            if (this.LoanProfitInfo.Rows.Count > 0)
            {
                // Net Sell
                decimal dNetSell = decimal.Zero;
                string  sAmount  = LoanProfitInfo.Rows[0]["NetSell"] == DBNull.Value ? string.Empty : LoanProfitInfo.Rows[0]["NetSell"].ToString();
                if (sAmount != string.Empty)
                {
                    if (decimal.TryParse(sAmount, out dNetSell))
                    {
                        this.txtMM_NetSell.Text = dNetSell.ToString("n2");
                    }
                }

                string sCommitmentNumber = LoanProfitInfo.Rows[0]["CommitmentNumber"] == DBNull.Value ? string.Empty : LoanProfitInfo.Rows[0]["CommitmentNumber"].ToString();
                this.txtCommitmentNumber.Text = sCommitmentNumber;

                this.txtCommitmentDate.Text = string.Empty;
                string   sCommitmentDate   = LoanProfitInfo.Rows[0]["CommitmentDate"] == DBNull.Value ? string.Empty : LoanProfitInfo.Rows[0]["CommitmentDate"].ToString();
                DateTime dt_CommitmentDate = DateTime.MinValue;
                if (sCommitmentDate != string.Empty)
                {
                    if (DateTime.TryParse(sCommitmentDate, out dt_CommitmentDate))
                    {
                        this.txtCommitmentDate.Text = dt_CommitmentDate.ToString("MM/dd/yyyy");
                    }
                }

                int    iCommitmentTerm = 0;
                string sCommitmentTerm = LoanProfitInfo.Rows[0]["CommitmentTerm"] == DBNull.Value ? string.Empty : LoanProfitInfo.Rows[0]["CommitmentTerm"].ToString();
                if (sCommitmentTerm != string.Empty)
                {
                    if (int.TryParse(sCommitmentTerm, out iCommitmentTerm))
                    {
                        this.txtCommitmentTerm.Text = iCommitmentTerm.ToString();
                    }
                }

                this.txtCommitmentExpirationDate.Text = string.Empty;
                string   sCommitmentExpirationDate   = LoanProfitInfo.Rows[0]["CommitmentExpDate"] == DBNull.Value ? string.Empty : LoanProfitInfo.Rows[0]["CommitmentExpDate"].ToString();
                DateTime dt_CommitmentExpirationDate = DateTime.MinValue;
                if (sCommitmentExpirationDate != string.Empty)
                {
                    if (DateTime.TryParse(sCommitmentExpirationDate, out dt_CommitmentExpirationDate))
                    {
                        this.txtCommitmentExpirationDate.Text = dt_CommitmentExpirationDate.ToString("MM/dd/yyyy");
                    }
                }

                // SRP
                decimal dSRP = decimal.Zero;
                sAmount = this.LoanProfitInfo.Rows[0]["SRP"] == DBNull.Value ? string.Empty : this.LoanProfitInfo.Rows[0]["SRP"].ToString();
                if (sAmount != string.Empty)
                {
                    if (decimal.TryParse(sAmount, out dSRP))
                    {
                        this.txtMM_SRP.Text = dSRP.ToString("n2");
                    }
                }

                // LLPA
                decimal dLLPA = decimal.Zero;
                sAmount = this.LoanProfitInfo.Rows[0]["LLPA"] == DBNull.Value ? string.Empty : this.LoanProfitInfo.Rows[0]["SRP"].ToString();
                if (sAmount != string.Empty)
                {
                    if (decimal.TryParse(sAmount, out dLLPA))
                    {
                        this.txtMM_LLPA.Text = dLLPA.ToString("n2");
                    }
                }

                // Sum Price
                //if (this.LoanProfitInfo.Rows[0]["NetSell"] != DBNull.Value || this.LoanProfitInfo.Rows[0]["SRP"] != DBNull.Value)
                //{
                decimal dSumPrice = dNetSell + dSRP + dLLPA;
                this.txtMM_SumPrice.Text = dSumPrice.ToString("n2");
                //}

                // Investor LCW 10/08/2013 use the LoanProfitInfo.Investor field instead
                if (this.LoanProfitInfo.Rows[0]["Investor"] != DBNull.Value)
                {
                    this.txtMM_Investor.Text = this.LoanProfitInfo.Rows[0]["Investor"].ToString();
                }

                // Investor
                //if (this.LoanLocksInfo.Rows[0]["InvestorID"] == DBNull.Value)
                //{
                //    this.txtMM_Investor.Text = this.LoanLocksInfo.Rows[0]["Investor"].ToString();
                //}
                //else
                //{
                //    int iInvestorID = Convert.ToInt32(this.LoanLocksInfo.Rows[0]["InvestorID"]);
                //    ContactCompanies ContactCompaniesMgr = new ContactCompanies();
                //    DataTable InvestorInfo = ContactCompaniesMgr.GetContactCompanyInfo(iInvestorID);
                //    this.txtMM_Investor.Text = InvestorInfo.Rows[0]["Name"].ToString();
                //}
            }

            #endregion

            #region Compensation Plan

            if (this.LoanProfitInfo.Rows.Count > 0)
            {
                this.ddlCompensationPlan.SelectedValue = this.LoanProfitInfo.Rows[0]["CompensationPlan"].ToString();
            }

            #endregion

            #region Price

            decimal   LOCompDecimal    = 0;
            DataTable LoanOfficerInfo1 = LoanTeamMgr.GetLoanOfficerInfo(this.iFileId);

            if (LoanOfficerInfo1.Rows.Count > 0)
            {
                DataRow LoanOfficerRow1 = LoanOfficerInfo1.Rows[0];

                LOCompDecimal = LoanOfficerRow1["LOComp"] == DBNull.Value ? decimal.Zero : Convert.ToDecimal(LoanOfficerRow1["LOComp"]);
            }

            decimal AmountDecimal = 0;
            decimal TempDecimal   = 0;

            //if (LOCompDecimal > 0)
            //{
            //    if (decimal.TryParse(this.txtLoanAmount.Text, out AmountDecimal))
            //    {
            //        TempDecimal = AmountDecimal * LOCompDecimal /100;
            //        this.txtPrice.Text = TempDecimal.ToString("n0");
            //    }
            //    else
            //    {
            //        TempDecimal = 0;
            //        this.txtPrice.Text = TempDecimal.ToString("n3");
            //    }
            //}
            //else
            //{
            //    TempDecimal = 0;
            //    this.txtPrice.Text = TempDecimal.ToString("n3");
            //}

            if (this.LoanProfitInfo.Rows.Count > 0)
            {
                this.txtPrice.Text = this.LoanProfitInfo.Rows[0]["Price"] == DBNull.Value ? string.Empty : Convert.ToDecimal(this.LoanProfitInfo.Rows[0]["Price"]).ToString("n3");
            }

            #endregion

            #region Lock Option

            if (this.LoanLocksInfo.Rows.Count > 0)
            {
                this.ddlLockOption.SelectedItem.Text = this.LoanLocksInfo.Rows[0]["LockOption"].ToString();
            }

            #endregion

            string N_string = "No MI Required";
            string B_string = "Borrower Paid MI";
            string L_string = "Lender Paid MI";
            string O_string = "No MI Option";

            // MI Option
            DataTable MIOptionInfo = LoanPointFieldsMgr.GetPointFieldInfo(this.iFileId, 4018);
            if (MIOptionInfo.Rows.Count > 0)
            {
                string cValue = MIOptionInfo.Rows[0]["CurrentValue"].ToString();
                if (cValue.Trim().ToLower() == N_string.Trim().ToLower())
                {
                    this.ddlMIOption.SelectedValue = "N";
                }

                if (cValue.Trim().ToLower() == B_string.Trim().ToLower())
                {
                    this.ddlMIOption.SelectedValue = "B";
                }

                if (cValue.Trim().ToLower() == L_string.Trim().ToLower())
                {
                    this.ddlMIOption.SelectedValue = "L";
                }

                if (cValue.Trim().ToLower() == O_string.Trim().ToLower())
                {
                    this.ddlMIOption.SelectedValue = "O";
                }
            }

            #region First time homebuyer

            if (this.LoanInfo.Rows[0]["FirstTimeBuyer"] != DBNull.Value)
            {
                if (Convert.ToBoolean(this.LoanInfo.Rows[0]["FirstTimeBuyer"]) == true)
                {
                    this.ddlFirsTimeHomebuyer.SelectedValue = "Yes";
                }
                else
                {
                    this.ddlFirsTimeHomebuyer.SelectedValue = "No";
                }
            }

            #endregion

            #region Escrow Taxes

            PointFieldInfo = LoanPointFieldsMgr.GetModel(this.iFileId, 4003);
            this.ddlEscrowTaxes.SelectedValue = "N";
            if (PointFieldInfo != null && !string.IsNullOrEmpty(PointFieldInfo.CurrentValue))
            {
                string cValue = PointFieldInfo.CurrentValue.ToUpper();
                if ((cValue.Trim().ToUpper() == "X") || (cValue.Trim().ToUpper() == "Y") || (cValue.Trim().ToUpper() == "YES"))
                {
                    this.ddlEscrowTaxes.SelectedValue = "Y";
                }
            }

            #endregion

            #region Escrow Insurance
            this.ddlEscrowInsurance.SelectedValue = "N";
            PointFieldInfo = LoanPointFieldsMgr.GetModel(this.iFileId, 4004);
            if (PointFieldInfo != null && !string.IsNullOrEmpty(PointFieldInfo.CurrentValue))
            {
                string cValue = PointFieldInfo.CurrentValue.ToUpper();
                if ((cValue.Trim().ToUpper() == "X") || (cValue.Trim().ToUpper() == "Y") || (cValue.Trim().ToUpper() == "YES"))
                {
                    this.ddlEscrowInsurance.SelectedValue = "Y";
                }
            }
            #endregion
        }
    }
Esempio n. 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(LPWeb.Model.LoanPointFields model)
 {
     dal.Update(model);
 }
Esempio n. 5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(LPWeb.Model.LoanPointFields model)
 {
     dal.Add(model);
 }
Esempio n. 6
0
    public void BindData()
    {
        LPWeb.BLL.Loans    bllLoans    = new LPWeb.BLL.Loans();
        LPWeb.BLL.LoanTeam bllLoanTeam = new LPWeb.BLL.LoanTeam();
        LPWeb.BLL.Users    bllUsers    = new LPWeb.BLL.Users();
        LPWeb.Model.Loans  loanInfo    = bllLoans.GetModel(LoanID);

        DataTable LoanInfo_datatable = bllLoans.GetLoanInfo(LoanID);
        decimal   loanAmount         = 0;

        LoanPointFields LoanPointFieldsMgr = new LoanPointFields();

        //LPWeb.Model.LoanPointFields PointFieldInfo = LoanPointFieldsMgr.GetPointFieldInfo(LoanID, 21017);
        LPWeb.Model.LoanPointFields PointFieldInfo = LoanPointFieldsMgr.GetModel(LoanID, 21017);
        if (PointFieldInfo != null && !string.IsNullOrEmpty(PointFieldInfo.CurrentValue))
        {
            decimal.TryParse(PointFieldInfo.CurrentValue, out loanAmount);
        }
        if (loanAmount <= 0 && LoanInfo_datatable != null && LoanInfo_datatable.Rows.Count > 0)
        {
            loanAmount = LoanInfo_datatable.Rows[0]["LoanAmount"] == DBNull.Value ? 0 : (decimal)LoanInfo_datatable.Rows[0]["LoanAmount"];
        }
        this.labLoanamount.Text = loanAmount.ToString("n2");

        var list = new List <ViewCompDetail>();

        var Lo = new ViewCompDetail();

        Lo.Type = "Loan Officer";
        var LOUserId = bllLoanTeam.GetLoanOfficerID(LoanID);

        Lo.Name   = bllLoanTeam.GetLoanOfficer(LoanID);
        Lo.Rate   = GetUserCompRate(LOUserId);
        Lo.Amount = Lo.Rate * loanAmount / 100.00M;
        list.Add(Lo);


        loanInfo.BranchID = loanInfo.BranchID != null ? loanInfo.BranchID : 0;
        var branchM = new ViewCompDetail();

        branchM.Type = "Branch Manager";
        LPWeb.BLL.BranchManagers bllbranM = new LPWeb.BLL.BranchManagers();
        var branchUserId = 0;
        var branchObj    = bllbranM.GetModelList("BranchId =" + loanInfo.BranchID).FirstOrDefault();

        if (branchObj != null)
        {
            branchUserId = branchObj.BranchMgrId;
        }

        LPWeb.Model.Users userBrM = bllUsers.GetModel(branchUserId);
        if (userBrM != null && userBrM.UserId == branchUserId)
        {
            branchM.Name   = userBrM.LastName + "," + userBrM.FirstName;
            branchM.Rate   = GetBranchMgrCompRate(LOUserId);
            branchM.Amount = branchM.Rate * loanAmount / 100.00M;
        }
        list.Add(branchM);


        loanInfo.DivisionID = loanInfo.DivisionID != null ? loanInfo.DivisionID : 0;
        var divisionM = new ViewCompDetail();

        divisionM.Type = "Division Manager";
        LPWeb.BLL.DivisionExecutives bllDivM = new LPWeb.BLL.DivisionExecutives();
        var DivMUserId = 0;
        var divobj     = bllDivM.GetModelList("DivisionId =" + loanInfo.DivisionID).FirstOrDefault();

        if (divobj != null)
        {
            DivMUserId = divobj.ExecutiveId;
        }

        LPWeb.Model.Users userDivM = bllUsers.GetModel(DivMUserId);
        if (userDivM != null && userDivM.UserId == DivMUserId)
        {
            divisionM.Name   = userDivM.LastName + "," + userDivM.FirstName;
            divisionM.Rate   = GetDivisionMgrCompRate(LOUserId);
            divisionM.Amount = divisionM.Rate * loanAmount / 100.00M;
        }
        list.Add(divisionM);

        loanInfo.RegionID = loanInfo.RegionID != null ? loanInfo.RegionID : 0;
        var RegionM = new ViewCompDetail();

        RegionM.Type = "Region Manager";
        LPWeb.BLL.RegionExecutives bllRegionM = new LPWeb.BLL.RegionExecutives();
        var RegionMUserId = 0;
        var regionObj     = bllRegionM.GetModelList("RegionId =" + loanInfo.RegionID).FirstOrDefault();

        if (regionObj != null)
        {
            RegionMUserId = regionObj.ExecutiveId;
        }

        LPWeb.Model.Users userRegionM = bllUsers.GetModel(RegionMUserId);
        if (userRegionM != null && userRegionM.UserId == RegionMUserId)
        {
            RegionM.Name   = userRegionM.LastName + "," + userRegionM.FirstName;
            RegionM.Rate   = GetRegionMgrCompRate(LOUserId);
            RegionM.Amount = RegionM.Rate * loanAmount / 100.00M;
        }
        list.Add(RegionM);


        gvCompDetail.DataSource = list;
        gvCompDetail.DataBind();
    }