예제 #1
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(LPWeb.Model.LoanLocks model)
 {
     return(dal.Update(model));
 }
예제 #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LPWeb.Model.LoanLocks> DataTableToList(DataTable dt)
        {
            List <LPWeb.Model.LoanLocks> modelList = new List <LPWeb.Model.LoanLocks>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LPWeb.Model.LoanLocks model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LPWeb.Model.LoanLocks();
                    if (dt.Rows[n]["FileId"].ToString() != "")
                    {
                        model.FileId = int.Parse(dt.Rows[n]["FileId"].ToString());
                    }
                    model.LockOption = dt.Rows[n]["LockOption"].ToString();
                    model.LockedBy   = dt.Rows[n]["LockedBy"].ToString();
                    if (dt.Rows[n]["LockTime"].ToString() != "")
                    {
                        model.LockTime = DateTime.Parse(dt.Rows[n]["LockTime"].ToString());
                    }
                    if (dt.Rows[n]["LockTerm"].ToString() != "")
                    {
                        model.LockTerm = int.Parse(dt.Rows[n]["LockTerm"].ToString());
                    }
                    model.ConfirmedBy = dt.Rows[n]["ConfirmedBy"].ToString();
                    if (dt.Rows[n]["ConfirmTime"].ToString() != "")
                    {
                        model.ConfirmTime = DateTime.Parse(dt.Rows[n]["ConfirmTime"].ToString());
                    }
                    if (dt.Rows[n]["LockExpirationDate"].ToString() != "")
                    {
                        model.LockExpirationDate = DateTime.Parse(dt.Rows[n]["LockExpirationDate"].ToString());
                    }
                    if (dt.Rows[n]["Ext1Term"].ToString() != "")
                    {
                        model.Ext1Term = int.Parse(dt.Rows[n]["Ext1Term"].ToString());
                    }
                    if (dt.Rows[n]["Ext1LockExpDate"].ToString() != "")
                    {
                        model.Ext1LockExpDate = DateTime.Parse(dt.Rows[n]["Ext1LockExpDate"].ToString());
                    }
                    if (dt.Rows[n]["Ext1LockTime"].ToString() != "")
                    {
                        model.Ext1LockTime = DateTime.Parse(dt.Rows[n]["Ext1LockTime"].ToString());
                    }
                    model.Ext1LockedBy = dt.Rows[n]["Ext1LockedBy"].ToString();
                    if (dt.Rows[n]["Ext1ConfirmTime"].ToString() != "")
                    {
                        model.Ext1ConfirmTime = DateTime.Parse(dt.Rows[n]["Ext1ConfirmTime"].ToString());
                    }
                    if (dt.Rows[n]["Ext2Term"].ToString() != "")
                    {
                        model.Ext2Term = int.Parse(dt.Rows[n]["Ext2Term"].ToString());
                    }
                    if (dt.Rows[n]["Ext2LockExpDate"].ToString() != "")
                    {
                        model.Ext2LockExpDate = DateTime.Parse(dt.Rows[n]["Ext2LockExpDate"].ToString());
                    }
                    if (dt.Rows[n]["Ext2LockTime"].ToString() != "")
                    {
                        model.Ext2LockTime = DateTime.Parse(dt.Rows[n]["Ext2LockTime"].ToString());
                    }
                    model.Ext2LockedBy = dt.Rows[n]["Ext2LockedBy"].ToString();
                    if (dt.Rows[n]["Ext2ConfirmTime"].ToString() != "")
                    {
                        model.Ext2ConfirmTime = DateTime.Parse(dt.Rows[n]["Ext2ConfirmTime"].ToString());
                    }
                    if (dt.Rows[n]["Ext3Term"].ToString() != "")
                    {
                        model.Ext3Term = int.Parse(dt.Rows[n]["Ext3Term"].ToString());
                    }
                    if (dt.Rows[n]["Ext3LockExpDate"].ToString() != "")
                    {
                        model.Ext3LockExpDate = DateTime.Parse(dt.Rows[n]["Ext3LockExpDate"].ToString());
                    }
                    if (dt.Rows[n]["Ext3LockTime"].ToString() != "")
                    {
                        model.Ext3LockTime = DateTime.Parse(dt.Rows[n]["Ext3LockTime"].ToString());
                    }
                    model.Ext3LockedBy = dt.Rows[n]["Ext3LockedBy"].ToString();
                    if (dt.Rows[n]["Ext3ConfirmTime"].ToString() != "")
                    {
                        model.Ext3ConfirmTime = DateTime.Parse(dt.Rows[n]["Ext3ConfirmTime"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(LPWeb.Model.LoanLocks model)
 {
     dal.Add(model);
 }
예제 #4
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        #region 获取用户输入

        string sMandatoryPricePoint  = this.txtMandatory_Points.Text.Trim();
        string sBestEffortPricePoint = this.txtBestEffortPrice_Points.Text.Trim();

        //string sCommissionTotal = this.txtCommissionTotal_Amount.Text.Trim();
        //string sCommissionTotal_Points = this.txtCommissionTotal_Points.Text.Trim();
        string sCommissionTotal        = Request.Form["txtCommissionTotal_Amount"].Trim();
        string sCommissionTotal_Points = Request.Form["txtCommissionTotal_Points"].Trim();

        string sLenderCredit       = Request.Form["txtLenderCredit_Amount"].Trim();
        string sLenderCreditAmount = this.txtLenderCredit_Amount.Text.Trim();
        string sLenderCreditPoint  = this.txtLenderCredit_Points.Text.Trim();

        string sLPMIPoint = Request.Form["txtLPMI_Points"].Trim();

        string sBestEffortPriceToLOPoint = Request.Form["txtBestEffortPriceToLO_Points"].Trim();

        string sHedgeCostPoint  = Request.Form["txtHedgeCost_Points"].Trim();
        string sCostOnSalePoint = Request.Form["txtCostOnSale_Points"].Trim();
        string sOriginationPts  = Request.Form["txtOriginationPts_Points"].Trim();
        string sDiscountPts     = Request.Form["txtDiscountPts_Points"].Trim();
        string sExtension1Point = this.txtExtension1_Points.Text.Trim();
        string sExtension2Point = this.txtExtension2_Points.Text.Trim();

        string sCompensationPlan  = this.ddlCompensationPlan.SelectedValue;
        string sLockOption        = this.ddlLockOption.SelectedItem.Text;
        string sMIOption          = this.ddlMIOption.SelectedItem.Text.Trim();
        string sFirsTimeHomebuyer = this.ddlFirsTimeHomebuyer.SelectedValue;
        string sEscrowTaxes       = this.ddlEscrowTaxes.SelectedValue;
        string sEscrowInsurance   = this.ddlEscrowInsurance.SelectedValue;
        string sPrice             = this.txtPrice.Text.Trim();

        #endregion
        #region LoanProfit fields: Price, Lender Credit and Compensation Plan
        decimal                tempDecimal    = 0;
        LoanProfit             LoanProfitMgr  = new LoanProfit();
        LPWeb.Model.LoanProfit loanProfitInfo = LoanProfitMgr.GetModel(this.iFileId);
        bool insert = false;
        if (loanProfitInfo == null)
        {
            loanProfitInfo = new LPWeb.Model.LoanProfit();
            insert         = true;
        }
        loanProfitInfo.FileId           = this.iFileId;
        loanProfitInfo.CompensationPlan = sCompensationPlan;
        if (!string.IsNullOrEmpty(sLenderCredit))
        {
            decimal.TryParse(sLenderCredit, out tempDecimal);
        }
        loanProfitInfo.LenderCredit = tempDecimal;
        tempDecimal = 0;
        if (!string.IsNullOrEmpty(sPrice))
        {
            decimal.TryParse(sPrice, out tempDecimal);
        }
        loanProfitInfo.Price = tempDecimal;
        if (insert)
        {
            LoanProfitMgr.Add(loanProfitInfo);
        }
        else
        {
            LoanProfitMgr.Update(loanProfitInfo);
        }

        #endregion
        #region Mandatory/Final Price

        LoanPointFields LoanPointFieldsMgr = new LoanPointFields();
        DataTable       PointFieldInfo     = LoanPointFieldsMgr.GetPointFieldInfo(this.iFileId, 11604);
        if (PointFieldInfo.Rows.Count > 0)
        {
            #region update

            LoanPointFieldsMgr.UpdatePointFieldValue(this.iFileId, 11604, sMandatoryPricePoint);

            #endregion
        }
        else
        {
            #region insert

            this.AddLoanPointField(this.iFileId, 11604, sMandatoryPricePoint);

            #endregion
        }

        #endregion

        #region Best Effort Price

        PointFieldInfo = LoanPointFieldsMgr.GetPointFieldInfo(this.iFileId, 12492);
        if (PointFieldInfo.Rows.Count > 0)
        {
            #region update

            LoanPointFieldsMgr.UpdatePointFieldValue(this.iFileId, 12492, sBestEffortPricePoint);

            #endregion
        }
        else
        {
            #region insert

            this.AddLoanPointField(this.iFileId, 12492, sBestEffortPricePoint);

            #endregion
        }

        #endregion

        #region Commission Total

        // 保存Commission Total %,不再保存Commission Total $
        // LW 08/30/2013 Changed Commission Total % 14153 --> 6177
        PointFieldInfo = LoanPointFieldsMgr.GetPointFieldInfo(this.iFileId, 6177);
        if (PointFieldInfo.Rows.Count > 0)
        {
            #region update

            LoanPointFieldsMgr.UpdatePointFieldValue(this.iFileId, 6177, sCommissionTotal_Points);

            #endregion
        }
        else
        {
            #region insert

            this.AddLoanPointField(this.iFileId, 6177, sCommissionTotal_Points);

            #endregion
        }

        #endregion

        #region Lender Credit
        // LW 08/30/2013 Changed Lender Credit 2284 --> 812
        DataTable LenderCreditInfo = LoanPointFieldsMgr.GetPointFieldInfo(this.iFileId, 812);
        if (LenderCreditInfo.Rows.Count > 0)
        {
            #region update

            LoanPointFieldsMgr.UpdatePointFieldValue(this.iFileId, 812, sLenderCreditAmount);

            #endregion
        }
        else
        {
            #region insert

            this.AddLoanPointField(this.iFileId, 812, sLenderCreditAmount);

            #endregion
        }

        #endregion

        #region LPMI

        PointFieldInfo = LoanPointFieldsMgr.GetPointFieldInfo(this.iFileId, 12973);
        if (PointFieldInfo.Rows.Count > 0)
        {
            #region update

            LoanPointFieldsMgr.UpdatePointFieldValue(this.iFileId, 12973, sLPMIPoint);

            #endregion
        }
        else
        {
            #region insert

            this.AddLoanPointField(this.iFileId, 12973, sLPMIPoint);

            #endregion
        }

        #endregion

        #region Best Effort Price to LO

        // only update Best Effort Price to LO %, not Best Effort Price to LO $
        PointFieldInfo = LoanPointFieldsMgr.GetPointFieldInfo(this.iFileId, 12495);
        if (PointFieldInfo.Rows.Count > 0)
        {
            #region update

            LoanPointFieldsMgr.UpdatePointFieldValue(this.iFileId, 12495, sBestEffortPriceToLOPoint);

            #endregion
        }
        else
        {
            #region insert

            this.AddLoanPointField(this.iFileId, 12495, sBestEffortPriceToLOPoint);

            #endregion
        }

        #endregion

        #region Hedge Cost

        PointFieldInfo = LoanPointFieldsMgr.GetPointFieldInfo(this.iFileId, 12974);
        if (PointFieldInfo.Rows.Count > 0)
        {
            #region update

            LoanPointFieldsMgr.UpdatePointFieldValue(this.iFileId, 12974, sHedgeCostPoint);

            #endregion
        }
        else
        {
            #region insert

            this.AddLoanPointField(this.iFileId, 12974, sHedgeCostPoint);

            #endregion
        }

        #endregion

        #region Cost on sale

        PointFieldInfo = LoanPointFieldsMgr.GetPointFieldInfo(this.iFileId, 12975);
        if (PointFieldInfo.Rows.Count > 0)
        {
            #region update

            LoanPointFieldsMgr.UpdatePointFieldValue(this.iFileId, 12975, sCostOnSalePoint);

            #endregion
        }
        else
        {
            #region insert

            this.AddLoanPointField(this.iFileId, 12975, sCostOnSalePoint);

            #endregion
        }

        #endregion

        #region Origination Pts

        PointFieldInfo = LoanPointFieldsMgr.GetPointFieldInfo(this.iFileId, 11243);
        if (PointFieldInfo.Rows.Count > 0)
        {
            #region update

            LoanPointFieldsMgr.UpdatePointFieldValue(this.iFileId, 11243, sOriginationPts);

            #endregion
        }
        else
        {
            #region insert

            this.AddLoanPointField(this.iFileId, 11243, sOriginationPts);

            #endregion
        }

        #endregion

        #region Discount Pts

        PointFieldInfo = LoanPointFieldsMgr.GetPointFieldInfo(this.iFileId, 11241);
        if (PointFieldInfo.Rows.Count > 0)
        {
            #region update

            LoanPointFieldsMgr.UpdatePointFieldValue(this.iFileId, 11241, sDiscountPts);

            #endregion
        }
        else
        {
            #region insert

            this.AddLoanPointField(this.iFileId, 11241, sDiscountPts);

            #endregion
        }

        #endregion

        #region Extension1

        PointFieldInfo = LoanPointFieldsMgr.GetPointFieldInfo(this.iFileId, 12976);
        if (PointFieldInfo.Rows.Count > 0)
        {
            #region update

            LoanPointFieldsMgr.UpdatePointFieldValue(this.iFileId, 12976, sExtension1Point);

            #endregion
        }
        else
        {
            #region insert

            this.AddLoanPointField(this.iFileId, 12976, sExtension1Point);

            #endregion
        }

        #endregion

        #region Extension2

        PointFieldInfo = LoanPointFieldsMgr.GetPointFieldInfo(this.iFileId, 12977);
        if (PointFieldInfo.Rows.Count > 0)
        {
            #region update

            LoanPointFieldsMgr.UpdatePointFieldValue(this.iFileId, 12977, sExtension2Point);

            #endregion
        }
        else
        {
            #region insert

            this.AddLoanPointField(this.iFileId, 12977, sExtension2Point);

            #endregion
        }

        #endregion

        #region Lock Option

        LoanLocks LoanLocksMgr = new LoanLocks();

        if (this.LoanLocksInfo.Rows.Count > 0)
        {
            #region update

            LoanLocksMgr.UpdateLockOption(this.iFileId, sLockOption);

            #endregion
        }
        else
        {
            #region insert

            #region Build Model

            LPWeb.Model.LoanLocks LoanLocksModel = new LPWeb.Model.LoanLocks();

            LoanLocksModel.FileId = this.iFileId;

            LoanLocksModel.LockOption = sLockOption;

            #endregion

            LoanLocksMgr.Add(LoanLocksModel);

            #endregion
        }
        // delete all the options first then add the one that's selected
        LoanPointFieldsMgr.DeletePointFields(this.iFileId, " PointFieldId in (6100, 6101, 11438, 12545)");
        int iPointFieldId = 0;
        int.TryParse(ddlLockOption.SelectedValue, out iPointFieldId);
        if (iPointFieldId > 0)
        {
            this.AddLoanPointField(this.iFileId, iPointFieldId, "X");
        }
        #endregion

        #region MI Option

        Loans LoansMgr = new Loans();
        LoansMgr.UpdateMIOption(this.iFileId, sMIOption);
        //LoanPointFieldsMgr.DeletePointFields(this.iFileId, " PointFieldId=4018");
        //this.AddLoanPointField(iFileId, 4018, sMIOption);
        LoanPointFieldsMgr.UpdatePointFieldValue(this.iFileId, 4018, sMIOption);

        #endregion

        #region Firs Time Homebuyer

        if (!string.IsNullOrEmpty(sFirsTimeHomebuyer))
        {
            if (sFirsTimeHomebuyer.ToUpper().Contains("Y"))
            {
                LoansMgr.UpdateFirstTimeHomeBuyer(this.iFileId, true);
            }
        }
        else
        {
            LoansMgr.UpdateFirstTimeHomeBuyer(this.iFileId, false);
        }
        LoanPointFieldsMgr.DeletePointFields(this.iFileId, " PointFieldId=7505");
        string s7505_FirstTimeHomeBuyer = "X";
        this.AddLoanPointField(iFileId, 7505, s7505_FirstTimeHomeBuyer);
        #endregion

        #region Escrow Taxes

        PointFieldInfo = LoanPointFieldsMgr.GetPointFieldInfo(this.iFileId, 4003);
        LoanPointFieldsMgr.DeletePointFields(this.iFileId, " PointFieldId=4003");
        if (sEscrowTaxes.Trim().ToUpper() == "Y")
        {
            this.AddLoanPointField(iFileId, 4003, "X");
        }

        #endregion

        #region Escrow Insurance
        LoanPointFieldsMgr.DeletePointFields(this.iFileId, " PointFieldId=4004");
        if (sEscrowInsurance.Trim().ToUpper() == "Y")
        {
            this.AddLoanPointField(iFileId, 4004, "X");
        }
        #endregion

        #region Call WCF UpdateLockInfo

        ServiceManager sm = new ServiceManager();
        using (LP2ServiceClient service = sm.StartServiceClient())
        {
            UpdateLockInfoRequest req = new UpdateLockInfoRequest();
            req.hdr = new ReqHdr();
            req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
            req.hdr.UserId        = this.CurrUser.iUserID;
            req.FileId            = this.iFileId;

            UpdateLockInfoResponse respone = null;
            try
            {
                respone = service.UpdateLockInfo(req);

                if (respone.hdr.Successful == false)
                {
                    PageCommon.WriteJsEnd(this, "Save successfully, but failed to invoke UpdateLockInfo wcf service, reason:" + respone.hdr.StatusInfo, PageCommon.Js_RefreshSelf);
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException)
            {
                string sExMsg = string.Format("Save successfully, but exception happened when Sync Point File (FileID={0}): {1}", this.iFileId, "Point Manager is not running.");
                LPLog.LogMessage(LogType.Logerror, sExMsg);

                PageCommon.WriteJsEnd(this, sExMsg, PageCommon.Js_RefreshSelf);
            }
            catch (Exception ex)
            {
                string sExMsg = string.Format("Save successfully, but exception happened when Sync Point File (FileID={0}): {1}", this.iFileId, ex.Message);
                LPLog.LogMessage(LogType.Logerror, sExMsg);

                PageCommon.WriteJsEnd(this, sExMsg, PageCommon.Js_RefreshSelf);
            }
        }

        #endregion

        // success
        PageCommon.WriteJsEnd(this, "Save successfully.", PageCommon.Js_RefreshSelf);
    }