コード例 #1
0
ファイル: ImportLeads.aspx.cs プロジェクト: PulseCRM/Pulse
        /// <summary>
        /// Import LoanTeam
        /// </summary>
        /// <param name="iFileId"></param>
        private void ImportLoanTeam(int iFileId)
        {
            LoanTeam bLoanTeam = new LoanTeam();

            Model.LoanTeam mLoanTeam = new Model.LoanTeam();
            mLoanTeam.FileId = iFileId;
            mLoanTeam.UserId = Convert.ToInt32(iLoanOfficer);
            mLoanTeam.RoleId = iLoanOfficerRoleID; //Loan Officer RoleID

            bLoanTeam.Add(mLoanTeam);
        }
コード例 #2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (this.CurrentFileId == 0)
        {
            return;
        }
        ServiceManager sm          = new ServiceManager();
        bool           bSuccessful = false;

        using (LP2ServiceClient service = sm.StartServiceClient())
        {
            ReassignLoanRequest req = new ReassignLoanRequest();
            req.hdr = new ReqHdr();
            req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
            req.hdr.UserId        = CurrentUser.iUserID;
            ReassignUserInfo uInfo = new ReassignUserInfo();

            uInfo.FileId = this.CurrentFileId;
            uInfo.RoleId = int.Parse(ddlRole.SelectedValue);
            if (ddlUsers.SelectedValue != "")
            {
                uInfo.NewUserId = int.Parse(ddlUsers.SelectedValue);
            }
            else
            {
                uInfo.NewUserId = 0;
            }
            List <ReassignUserInfo> uList = new List <ReassignUserInfo>();
            uList.Add(uInfo);
            req.reassignUsers = uList.ToArray();
            ReassignLoanResponse respone = null;
            try
            {
                ReassignProspect(service);

                respone = service.ReassignLoan(req);

                if (respone.hdr.Successful)
                {
                    LPWeb.Model.LoanTeam lcModel = new LPWeb.Model.LoanTeam();
                    lcModel.FileId = CurrentFileId;
                    lcModel.RoleId = uInfo.RoleId;
                    lcModel.UserId = uInfo.NewUserId;

                    LPWeb.Model.LoanTeam oldlcModel = new LPWeb.Model.LoanTeam();
                    oldlcModel.FileId = CurrentFileId;
                    oldlcModel.RoleId = oldRoleID;
                    oldlcModel.UserId = oldUserID;

                    LPWeb.BLL.LoanTeam lc = new LoanTeam();

                    //lc.Reassign(oldlcModel, lcModel, req.hdr.UserId, ddlRole.SelectedItem.Text, ddlUsers.SelectedItem.Text);
                    lc.Reassign(oldlcModel, lcModel, req.hdr.UserId);

                    bSuccessful = true;
                }
                else
                {
                    bSuccessful = false;
                }
                if (bSuccessful)
                {
                    PageCommon.WriteJsEnd(this, "Reassigned loan successfully", "window.parent.RefreshPage();" + this.hdnCloseDialogCodes.Value);
                }
                else
                {
                    PageCommon.WriteJsEnd(this, string.Format("Failed to reassign loan, reason:{0}.", respone.hdr.StatusInfo), PageCommon.Js_RefreshSelf);
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException ex)
            {
                LPLog.LogMessage(ex.Message);
                PageCommon.WriteJsEnd(this, "Failed to reassign loan, reason: Point Manager is not running.", PageCommon.Js_RefreshSelf);
            }
            catch (Exception exception)
            {
                LPLog.LogMessage(exception.Message);
                PageCommon.WriteJsEnd(this, string.Format("Failed to reassign loan, reason:{0}.", exception.Message), PageCommon.Js_RefreshSelf);
            }
        }
    }
コード例 #3
0
    private void BindBorrower()
    {
        DataTable dt                 = null;
        string    borrowerName       = string.Empty;
        int       iBorrowerContactId = iContactID;

        if (iFileID <= 0 && iContactID <= 0)
        {
            GetBorrowerListFromSctach();
            return;
        }
        try
        {
            if (iFileID > 0)
            {
                // loan officer name
                LoanTeam lt = new LoanTeam();
                sProspectLoanOfficer = lt.GetLoanOfficer(iFileID);

                #region Get Loan Officer ID

                string sSql            = "select isnull(dbo.lpfn_GetLoanOfficerID(" + iFileID + "),0)";
                string sLoanOfficerIDx = LPWeb.DAL.DbHelperSQL.ExecuteScalar(sSql).ToString();

                #endregion


                if (!string.IsNullOrEmpty(sProspectLoanOfficer))
                {
                    if (ddlLoanOfficer.Items != null && ddlLoanOfficer.Items.Count > 0)
                    {
                        //ddlLoanOfficer.SelectedItem.Text = sProspectLoanOfficer;

                        ddlLoanOfficer.SelectedValue = sLoanOfficerIDx;

                        if (ddlLoanOfficer.SelectedValue == "-1")
                        {
                            //var s = sLoanOfficerIDx;
                            ddlLoanOfficer.Items.Add(new ListItem()
                            {
                                Text = sProspectLoanOfficer, Value = sLoanOfficerIDx
                            });
                            ddlLoanOfficer.SelectedValue = sLoanOfficerIDx;
                        }

                        hfLoanOfficer.Value = ddlLoanOfficer.SelectedItem.Text;
                    }
                }
                dt = loan.GetBorrowerInfo(iFileID);
                if (dt != null && dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["LastName"] == DBNull.Value || dt.Rows[0]["ContactId"] == DBNull.Value || dt.Rows[0]["FirstName"] == DBNull.Value)
                    {
                        iBorrowerContactId = iContactID;
                    }
                    else
                    {
                        iBorrowerContactId = (int)dt.Rows[0]["ContactId"];
                        if (iContactID <= 0)
                        {
                            iContactID = iBorrowerContactId;
                        }
                    }
                }

                borrowerName = contact.GetContactName(iBorrowerContactId);
                if (dt != null)
                {
                    dt.Clear();
                }
            }
            if (borrowerName == string.Empty)
            {
                borrowerName       = contact.GetContactName(iContactID);
                iBorrowerContactId = iContactID;
            }
            if (iBorrowerContactId > 0)
            {
                ddlBorrower.Items.Add(new ListItem(borrowerName, iBorrowerContactId.ToString()));
                ddlBorrower.SelectedValue = iBorrowerContactId.ToString();
            }
            else
            {
                ddlBorrower.Items.Add(new ListItem("-- select --", "0"));
                ddlBorrower.SelectedValue = "0";
            }

            if (relatedContactsTable == null || relatedContactsTable.Rows.Count <= 0)
            {
                relatedContactsTable = contact.GetRelatedContacts(iContactID);
            }

            if (relatedContactsTable != null && relatedContactsTable.Rows.Count > 0)
            {
                lc.Clear();
                foreach (DataRow dr in relatedContactsTable.Rows)
                {
                    if (dr["ContactName"] == DBNull.Value || dr["RelContactID"] == null)
                    {
                        continue;
                    }
                    lc.Add(new ListItem(dr["ContactName"].ToString(), dr["RelContactID"].ToString()));
                }
            }
            if (lc.Count > 0)
            {
                foreach (ListItem item in lc)
                {
                    ddlBorrower.Items.Add(item);
                }
            }
        }
        catch
        { }
    }
コード例 #4
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
        }
    }
コード例 #5
0
    private bool SaveLocal(ref string errMsg)
    {
        if (!string.IsNullOrEmpty(FileName) && FileName.Length > 0 && !FileName.ToUpper().EndsWith(".PRS") && !FileName.ToUpper().EndsWith(".BRW"))
        {
            errMsg = "The filename must end with “.PRS” or “.BRW”. ";
            return(false);
        }

        try
        {
            #region Save BranchId
            Loans             bllLoans = new Loans();
            LPWeb.Model.Loans loanInfo = new LPWeb.Model.Loans();
            loanInfo = bllLoans.GetModel(iFileID);
            if (loanInfo != null)
            {
                loanInfo.BranchID = BranchId;
                bllLoans.Update(loanInfo);
            }
            #endregion

            //Save Loan Officer

            #region Loan Officer

            LoanTeam bllLoanTeam   = new LoanTeam();
            Users    bllUsers      = new Users();
            var      loanOfficer   = bllLoanTeam.GetLoanOfficer(iFileID);
            var      loanOfficerId = bllLoanTeam.GetLoanOfficerID(iFileID);

            #region Loan Officer RolesID   =loanOfficerRolesId
            Roles bllRoles           = new Roles();
            int   loanOfficerRolesId = 3;//default;
            try
            {
                loanOfficerRolesId = bllRoles.GetModelList(" Name = 'Loan Officer' ").FirstOrDefault().RoleId;
            }
            catch { }
            #endregion

            if (LoanOfficerId != loanOfficerId)
            {
                var loanTeamInfo = bllLoanTeam.GetModel(iFileID, loanOfficerRolesId, loanOfficerId);

                if (loanTeamInfo == null)
                {
                    loanTeamInfo = new LPWeb.Model.LoanTeam();
                }
                else
                {
                    bllLoanTeam.Delete(iFileID, loanOfficerRolesId, loanOfficerId);
                }
                loanTeamInfo.FileId = iFileID;
                loanTeamInfo.RoleId = loanOfficerRolesId;
                loanTeamInfo.UserId = LoanOfficerId;


                bllLoanTeam.Add(loanTeamInfo);
            }

            #endregion

            #region Local PointFile  ----pointFileInfo and  pointFolderInfo

            PointFiles   bllPointFile    = new PointFiles();
            PointFolders bllPointFolders = new PointFolders();


            LPWeb.Model.PointFiles pointFileInfo = bllPointFile.GetModel(iFileID);
            var IsAddPointFile = false;
            if (pointFileInfo == null)
            {
                IsAddPointFile = true;
                pointFileInfo  = new LPWeb.Model.PointFiles();
            }
            else
            {
                IsAddPointFile = false;
            }

            pointFileInfo.FileId = iFileID;
            if (FolderId > 0)
            {
                pointFileInfo.FolderId = FolderId;
            }
            if (FileName.Length > 0)
            {
                pointFileInfo.Name = FileName;
            }


            if (IsAddPointFile)
            {
                bllPointFile.Add(pointFileInfo);
            }
            else
            {
                bllPointFile.UpdateBase(pointFileInfo);
            }

            #endregion
        }
        catch (Exception ex)
        {
            errMsg = ex.Message;
            return(false);
        }
        return(true);
    }
コード例 #6
0
ファイル: PointInfoTab.aspx.cs プロジェクト: PulseCRM/Pulse
    private void BindOther()
    {
        if (iBranchId == 0 && !string.IsNullOrEmpty(ddlBranch.SelectedValue))
        {
            iBranchId = Convert.ToInt32(ddlBranch.SelectedValue);
        }

        #region Loan Officer

        LoanTeam bllLoanTeam   = new LoanTeam();
        Users    bllUsers      = new Users();
        var      loanOfficer   = bllLoanTeam.GetLoanOfficer(iFileID);
        var      loanOfficerId = bllLoanTeam.GetLoanOfficerID(iFileID);

        if (!string.IsNullOrEmpty(loanOfficer))
        {
            ddlLoanOfficer.DataTextField  = "text";
            ddlLoanOfficer.DataValueField = "value";
            ddlLoanOfficer.DataSource     = new ListItemCollection()
            {
                new ListItem()
                {
                    Selected = true, Text = loanOfficer, Value = loanOfficerId.ToString()
                }
            };
            ddlLoanOfficer.DataBind();
        }
        else
        {
            if (iBranchId > 0)
            {
                ddlLoanOfficer.DataTextField  = "UserName";
                ddlLoanOfficer.DataValueField = "UserId";
                //ddlLoanOfficer.DataSource = bllUsers.GetAllUsers(loanInfo.BranchID.Value);
                ddlLoanOfficer.DataSource = bllUsers.GetAllUsers(iBranchId);
                ddlLoanOfficer.DataBind();
            }
            else
            {
                if (loginUser.sRoleName == "Executive")
                {
                    ddlLoanOfficer.DataTextField  = "UserName";
                    ddlLoanOfficer.DataValueField = "UserId";
                    ddlLoanOfficer.DataSource     = bllUsers.GetUserListByBranches_Executive(loginUser.iUserID);
                    ddlLoanOfficer.DataBind();
                }
                else if (loginUser.bIsBranchManager || loginUser.bIsBranchUser)
                {
                    ddlLoanOfficer.DataTextField  = "UserName";
                    ddlLoanOfficer.DataValueField = "UserId";
                    ddlLoanOfficer.DataSource     = bllUsers.GetUserListByUserBranches(loginUser.iUserID);
                    ddlLoanOfficer.DataBind();
                }
            }

            if (ddlLoanOfficer.Items.Count > 0 && loanOfficerId != 0)
            {
                ddlLoanOfficer.SelectedValue = loanOfficerId.ToString();
                //ddlLoanOfficer.SelectedIndex = 0;
            }
        }

        #endregion

        #region FolderName
        ddlFolderName.Enabled = true;
        //if (pointFileInfo.FolderId != 0)
        //{
        //    ddlFolderName.DataTextField = "text";
        //    ddlFolderName.DataValueField = "value";
        //    ddlFolderName.DataSource = new ListItemCollection() { new ListItem() { Text = pointFolderInfo.Name, Value = pointFolderInfo.FolderId.ToString(), Selected = true } };
        //    ddlFolderName.DataBind();
        //    //ddlFolderName.Enabled = false;
        //}
        //else

        //CR60 ADD
        Company_Point bllcomPoint = new Company_Point();
        //LPWeb.BLL.ArchiveLeadStatus bllLeadStatus = new ArchiveLeadStatus();
        LPWeb.Model.Company_Point comPointInfo = bllcomPoint.GetModel();

        //int leadStatus = 0;
        //LPWeb.Model.ArchiveLeadStatus statusInfo = bllLeadStatus.GetModelList(" LeadStatusName ='" + loanInfo.ProspectLoanStatus + "'").FirstOrDefault();
        //if (statusInfo != null && statusInfo.LeadStatusName == loanInfo.ProspectLoanStatus)
        //{
        //    leadStatus = statusInfo.LeadStatusId;
        //}

        if (comPointInfo != null && comPointInfo.Enable_MultiBranchFolders)
        {
            ddlFolderName.DataTextField  = "Name";
            ddlFolderName.DataValueField = "FolderId";
            ddlFolderName.DataSource     = bllPointFolders.GetList(" [Enabled] = 1 AND  (BranchID IS NOT NULL)  AND (LoanStatus= 8 ) order by [Name] asc");
            ddlFolderName.DataBind();
        }
        else
        {
            #region CR60前绑定逻辑
            if (iBranchId > 0 || Convert.ToInt32(ddlBranch.SelectedValue) > 0)
            {
                if (loanInfo.ProspectLoanStatus == "Active")
                {
                    ddlFolderName.DataTextField  = "Name";
                    ddlFolderName.DataValueField = "FolderId";
                    ddlFolderName.DataSource     = bllPointFolders.GetList(" [Enabled] = 1 AND BranchId = " + iBranchId + " AND LoanStatus  = 6  order by Name");
                    ddlFolderName.DataBind();
                }
                else
                {
                    ddlFolderName.DataTextField  = "Name";
                    ddlFolderName.DataValueField = "FolderId";
                    ddlFolderName.DataSource     = bllPointFolders.GetList(" [Enabled] = 1 AND BranchId = " + iBranchId + " AND LoanStatus  = 8  order by Name");
                    ddlFolderName.DataBind();
                }
            }
            else
            {
                string whereStr = " [Enabled] = 1 ";
                if (loanInfo.ProspectLoanStatus == "Active")
                {
                    whereStr += " AND LoanStatus  = 6 ";
                }
                else
                {
                    whereStr += " AND LoanStatus  = 8 ";
                }

                if (loginUser.bIsCompanyExecutive)
                {
                    whereStr += " AND BranchId IN (select BranchId from dbo.lpfn_GetUserBranches_Executive(" + loginUser.iUserID + "))";
                }
                else if (loginUser.bIsBranchManager)
                {
                    whereStr += " AND BranchId IN (select BranchId from dbo.lpfn_GetUserBranches_Branch_Manager(" + loginUser.iUserID + "))";
                }
                else
                {
                    whereStr += " AND BranchId IN (select BranchId from dbo.lpfn_GetUserBranches(" + loginUser.iUserID + "))";
                }

                whereStr += " order by Name ";

                ddlFolderName.DataTextField  = "Name";
                ddlFolderName.DataValueField = "FolderId";
                ddlFolderName.DataSource     = bllPointFolders.GetList(whereStr);
                ddlFolderName.DataBind();
            }
            #endregion
        }


        if (ddlFolderName.Items.Count > 0 && iPointFolderId > 0)
        {
            ddlFolderName.SelectedValue = iPointFolderId.ToString();
            //ddlFolderName.SelectedIndex = 0;
        }

        #endregion
    }