Пример #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        StringBuilder stringBuilder = new StringBuilder();

        this.model = this.GetPageModel();
        if (this.TemAction == "add")
        {
            if (this.PLBLL.Add(this.model))
            {
                base.RegisterScript("top.ui.tabSuccess({ parentName: '_prjloan' });");
            }
            else
            {
                base.RegisterScript("top.ui.alert('保存失败');");
            }
        }
        else
        {
            if (this.TemAction == "edit")
            {
                if (this.PLBLL.Update(this.model))
                {
                    base.RegisterScript("top.ui.tabSuccess({ parentName: '_prjloan' });");
                }
                else
                {
                    base.RegisterScript("top.ui.alert('保存失败');");
                }
            }
        }
        base.ClientScript.RegisterClientScriptBlock(base.GetType(), "sc", "<script>" + stringBuilder.ToString() + "</script>");
    }
Пример #2
0
 protected void initData(string _LoanID)
 {
     this.model = new PrjLoadModel();
     this.model = this.PLBLL.GetModel(new Guid(_LoanID));
     if (this.model != null)
     {
         this.txaRemark.Value        = this.model.Remark;
         this.txtLoanDate.Text       = (this.model.LoanDate.HasValue ? DateTime.Parse(this.model.LoanDate.ToString()).ToShortDateString() : "");
         this.txtLoanFund.Value      = this.model.LoanFund.ToString();
         this.txtLoanRate.Value      = string.Format("{0:0.00}", decimal.Parse(this.model.LoanRate.ToString()) * 100m);
         this.txtPlanReturnDate.Text = (this.model.PlanReturnDate.HasValue ? DateTime.Parse(this.model.PlanReturnDate.ToString()).ToShortDateString() : "");
         if (!string.IsNullOrEmpty(this.model.LoanCode))
         {
             this.txtLoanCode.Text = this.model.LoanCode;
         }
         else
         {
             this.txtLoanCode.Text = DateTime.Now.ToString("yyyyMMddHHmmss");
         }
         this.txtLoanCause.Value = this.model.LoanCause;
         this.labLoanMan.Text    = this.model.LoanmanName;
         this.hdnLoanMan.Value   = this.model.LoanMan;
         ListItem listItem = this.dropPrjCodeList.Items.FindByValue(this.model.PrjGuid.ToString());
         if (listItem != null)
         {
             listItem.Selected = true;
         }
     }
 }
Пример #3
0
 public bool Add(PrjLoadModel model)
 {
     if (model == null)
     {
         return(false);
     }
     return(this.dal.Add(model) > 0);
 }
Пример #4
0
    public void BindLoan(string LoanId)
    {
        Guid         guid  = new Guid(LoanId);
        PrjLoadModel model = this.prjLoad.GetModel(guid);

        this.txtLoanID.Text         = model.LoanCode;
        this.txtLoanFund.Text       = model.LoanFund.ToString();
        this.txtLoanRate.Text       = string.Format("{0:N2}", model.LoanRate * 100m) + "%";
        this.txtLoanDate.Text       = Common2.GetTime(model.PlanReturnDate);
        this.txtReturnMoney.Text    = "0.00";
        this.txtNoRetMoney.Text     = "0.00";
        this.txtReturnInterest.Text = "0.00";
        this.txtReturnOther.Text    = "0.00";
        DataTable sumByLoanid = this.returnBLL.GetSumByLoanid(guid);

        if (sumByLoanid != null && sumByLoanid.Rows.Count > 0)
        {
            this.txtReturnMoney.Text    = sumByLoanid.Rows[0]["FR_Money"].ToString();
            this.txtNoRetMoney.Text     = (model.LoanFund - Convert.ToDecimal(sumByLoanid.Rows[0]["FR_Money"])).ToString();
            this.txtReturnInterest.Text = sumByLoanid.Rows[0]["Interest"].ToString();
            this.txtReturnOther.Text    = sumByLoanid.Rows[0]["Deduct"].ToString();
            if (model.PlanReturnDate < DateTime.Now && model.ReturnState == 0)
            {
                this.txtLoanDate.Style.Add("color", "red");
                this.txtNoRetMoney.Style.Add("color", "red");
            }
            if (model.LoanFund - Convert.ToDecimal(sumByLoanid.Rows[0]["FR_Money"]) < 0m)
            {
                this.txtNoRetMoney.Style.Add("color", "red");
            }
        }
        this.txtPeople.Text    = this.yhmcBLL.GetModelById(model.LoanMan).v_xm;
        this.hdfUserCode.Value = model.LoanMan;
        this.rdbNo.Checked     = true;
        this.rdbYes.Checked    = false;
        if (model.ReturnState == 0)
        {
            this.rdbNo.Checked  = true;
            this.rdbYes.Checked = false;
            return;
        }
        if (model.ReturnState == 1)
        {
            this.rdbYes.Checked = true;
            this.rdbNo.Checked  = false;
        }
    }
Пример #5
0
    public void BindLoan(string LoanId)
    {
        Guid         guid  = new Guid(LoanId);
        PrjLoadModel model = this.prjLoad.GetModel(guid);

        this.txtLoanID.Text         = model.LoanCode;
        this.txtLoanFund.Text       = model.LoanFund.ToString();
        this.txtLoanRate.Text       = string.Format("{0:N2}", model.LoanRate * 100m) + "%";
        this.txtLoanDate.Text       = Convert.ToDateTime(model.LoanDate).ToShortDateString();
        this.txtReturnMoney.Text    = "0.00";
        this.txtNoRetMoney.Text     = "0.00";
        this.txtReturnInterest.Text = "0.00";
        this.txtReturnOther.Text    = "0.00";
        DataTable sumByLoanid = this.returnBLL.GetSumByLoanid(guid);

        if (sumByLoanid != null && sumByLoanid.Rows.Count > 0)
        {
            this.txtReturnMoney.Text    = sumByLoanid.Rows[0]["FR_Money"].ToString();
            this.txtNoRetMoney.Text     = (model.LoanFund - Convert.ToDecimal(sumByLoanid.Rows[0]["FR_Money"])).ToString();
            this.txtReturnInterest.Text = sumByLoanid.Rows[0]["Interest"].ToString();
            this.txtReturnOther.Text    = sumByLoanid.Rows[0]["Deduct"].ToString();
        }
        if (model.PlanReturnDate < DateTime.Now && model.ReturnState == 0)
        {
            this.txtLoanDate.Style.Add("color", "red");
            this.txtNoRetMoney.Style.Add("color", "red");
        }
        if (model.LoanFund - Convert.ToDecimal(sumByLoanid.Rows[0]["FR_Money"]) < 0m)
        {
            this.txtNoRetMoney.Style.Add("color", "red");
        }
        if (model.ReturnState == 0)
        {
            this.labType.Text = "未还清";
            this.labType.Style.Add("color", "red");
            return;
        }
        if (model.ReturnState == 1)
        {
            this.labType.Text = "已还清";
            this.labType.Style.Add("color", "#008B45");
        }
    }
Пример #6
0
    private void bindModel(string ic)
    {
        this.upload.InnerHtml = this.FilesBind(ic);
        AccountLogic accountLogic       = new AccountLogic();
        string       userNameByUserCode = accountLogic.GetUserNameByUserCode(this.Session["yhdm"].ToString());

        this.ltadduser.Text = userNameByUserCode;
        this.ltadddate.Text = string.Format("{0:d}", DateTime.Now);
        PrjLoadModel prjLoadModel = new PrjLoadModel();
        PrjLoadLogic prjLoadLogic = new PrjLoadLogic();

        if (ic.Length == 36)
        {
            prjLoadModel = prjLoadLogic.GetModel(new Guid(ic));
            if (prjLoadModel != null)
            {
                this.ltrprjname.Text        = prjLoadModel.PrjName;
                this.ltrAccountNum.Text     = prjLoadModel.LoanCode;
                this.ltrLoanCause.Text      = prjLoadModel.LoanCause;
                this.ltrLoanDate.Text       = string.Format("{0:d}", prjLoadModel.LoanDate);
                this.ltrLoanFund.Text       = string.Format("{0:0.000}", double.Parse(prjLoadModel.LoanFund.ToString()));
                this.ltrLoanMan.Text        = prjLoadModel.LoanmanName;
                this.ltrLoanRate.Text       = string.Format("{0:0.00}", double.Parse(prjLoadModel.LoanRate.ToString()) * 100.0) + "%";
                this.ltrPlanReturnDate.Text = string.Format("{0:d}", prjLoadModel.PlanReturnDate);
                this.ltrFlowState.Text      = Common2.GetState(prjLoadModel.FlowState.ToString());
                if (prjLoadModel.FlowState.ToString() == "1")
                {
                    this.trrepayment.Style.Add("display", "");
                    Fund_Loan_Repayment fund_Loan_Repayment    = new Fund_Loan_Repayment();
                    DataTable           repaymentInfoByLLoanID = fund_Loan_Repayment.GetRepaymentInfoByLLoanID(ic);
                    if (repaymentInfoByLLoanID.Rows.Count > 0)
                    {
                        DataRow dataRow   = repaymentInfoByLLoanID.Rows[0];
                        int     arg_24D_0 = (int)dataRow["syday"];
                        if (prjLoadModel.ReturnState == 0)
                        {
                            this.lbRepayment.Text = "未还清";
                            this.lbRepayment.Style.Add("color", "red");
                        }
                        else
                        {
                            if (prjLoadModel.ReturnState == 1)
                            {
                                this.lbRepayment.Text = "已还清";
                                this.lbRepayment.Style.Add("color", "#008B45");
                            }
                        }
                    }
                }
                string text = string.Empty;
                text = prjLoadModel.Remark;
                if (!string.IsNullOrEmpty(text) && text.Length > 180)
                {
                    int num = prjLoadModel.Remark.Length / 180;
                    for (int i = 1; i <= num; i++)
                    {
                        int num2 = 180 * i;
                        if (num2 == 180)
                        {
                            num2 = 175;
                        }
                        text = text.Insert(num2, "<br/>");
                    }
                }
                this.ltrRemark.Text = text;
            }
        }
    }
Пример #7
0
 private PrjLoadModel GetPageModel()
 {
     this.model = new PrjLoadModel();
     if (this.TemAction == "add")
     {
         this.model.LoanID    = new Guid(this.ViewState["RecordCode"].ToString());
         this.model.FlowState = new int?(-1);
     }
     else
     {
         this.model.LoanID = new Guid(this.TemLoanID);
     }
     if (!string.IsNullOrEmpty(this.TemAccountid))
     {
         this.model.LoanCode  = this.txtLoanCode.Text.ToString();
         this.model.LoanCause = this.txtLoanCause.Value.ToString();
         if (!string.IsNullOrEmpty(this.txtLoanDate.Text.ToString()))
         {
             this.model.LoanDate = new DateTime?(DateTime.Parse(this.txtLoanDate.Text.ToString()));
         }
         else
         {
             this.model.LoanDate = null;
         }
         if (!string.IsNullOrEmpty(this.txtLoanFund.Value.ToString()))
         {
             this.model.LoanFund = new decimal?(decimal.Parse(this.txtLoanFund.Value.ToString()));
         }
         else
         {
             this.model.LoanFund = new decimal?(0m);
         }
         if (!string.IsNullOrEmpty(this.hdnLoanMan.Value.ToString()))
         {
             this.model.LoanMan = this.hdnLoanMan.Value.ToString();
         }
         else
         {
             this.model.LoanMan = this.Session["yhdm"].ToString();
         }
         if (!string.IsNullOrEmpty(this.txtPlanReturnDate.Text.ToString()))
         {
             this.model.PlanReturnDate = new DateTime?(DateTime.Parse(this.txtPlanReturnDate.Text.Trim().ToString()));
         }
         else
         {
             this.model.PlanReturnDate = null;
         }
         if (!string.IsNullOrEmpty(this.txtLoanRate.Value.ToString()))
         {
             this.model.LoanRate = new decimal?(decimal.Parse(this.txtLoanRate.Value.ToString()) / 100m);
         }
         else
         {
             this.model.LoanRate = new decimal?(0m);
         }
         if (!string.IsNullOrEmpty(this.txaRemark.Value.ToString()))
         {
             this.model.Remark = this.txaRemark.Value.ToString();
         }
         else
         {
             this.model.Remark = "";
         }
         if (!string.IsNullOrEmpty(this.dropPrjCodeList.SelectedValue))
         {
             this.model.PrjGuid = new Guid(this.dropPrjCodeList.SelectedValue);
         }
     }
     this.model.ReturnState = new int?(0);
     return(this.model);
 }
Пример #8
0
        public List <PrjLoadModel> DataTableToList(DataTable dt)
        {
            List <PrjLoadModel> list = new List <PrjLoadModel>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    PrjLoadModel item = new PrjLoadModel();
                    if ((dt.Rows[i]["LoanID"] != null) && (dt.Rows[i]["LoanID"].ToString() != ""))
                    {
                        item.LoanID = new Guid(dt.Rows[i]["LoanID"].ToString());
                    }
                    if ((dt.Rows[i]["LoanCode"] != null) && (dt.Rows[i]["LoanCode"].ToString() != ""))
                    {
                        item.LoanCode = dt.Rows[i]["LoanCode"].ToString();
                    }
                    if ((dt.Rows[i]["PrjGuid"] != null) && (dt.Rows[i]["PrjGuid"].ToString() != ""))
                    {
                        item.PrjGuid = new Guid(dt.Rows[i]["PrjGuid"].ToString());
                    }
                    if ((dt.Rows[i]["LoanDate"] != null) && (dt.Rows[i]["LoanDate"].ToString() != ""))
                    {
                        item.LoanDate = new DateTime?(DateTime.Parse(dt.Rows[i]["LoanDate"].ToString()));
                    }
                    if ((dt.Rows[i]["LoanMan"] != null) && (dt.Rows[i]["LoanMan"].ToString() != ""))
                    {
                        item.LoanMan = dt.Rows[i]["LoanMan"].ToString();
                    }
                    if ((dt.Rows[i]["LoanFund"] != null) && (dt.Rows[i]["LoanFund"].ToString() != ""))
                    {
                        item.LoanFund = new decimal?(decimal.Parse(dt.Rows[i]["LoanFund"].ToString()));
                    }
                    if ((dt.Rows[i]["LoanCause"] != null) && (dt.Rows[i]["LoanCause"].ToString() != ""))
                    {
                        item.LoanCause = dt.Rows[i]["LoanCause"].ToString();
                    }
                    if ((dt.Rows[i]["PlanReturnDate"] != null) && (dt.Rows[i]["PlanReturnDate"].ToString() != ""))
                    {
                        item.PlanReturnDate = new DateTime?(DateTime.Parse(dt.Rows[i]["PlanReturnDate"].ToString()));
                    }
                    if ((dt.Rows[i]["LoanRate"] != null) && (dt.Rows[i]["LoanRate"].ToString() != ""))
                    {
                        item.LoanRate = new decimal?(decimal.Parse(dt.Rows[i]["LoanRate"].ToString()));
                    }
                    if ((dt.Rows[i]["Remark"] != null) && (dt.Rows[i]["Remark"].ToString() != ""))
                    {
                        item.Remark = dt.Rows[i]["Remark"].ToString();
                    }
                    if ((dt.Rows[i]["FlowState"] != null) && (dt.Rows[i]["FlowState"].ToString() != ""))
                    {
                        item.FlowState = new int?(int.Parse(dt.Rows[i]["FlowState"].ToString()));
                    }
                    if ((dt.Rows[i]["ReturnDate"] != null) && (dt.Rows[i]["ReturnDate"].ToString() != ""))
                    {
                        item.ReturnDate = new DateTime?(DateTime.Parse(dt.Rows[i]["ReturnDate"].ToString()));
                    }
                    if ((dt.Rows[i]["ReturnMan"] != null) && (dt.Rows[i]["ReturnMan"].ToString() != ""))
                    {
                        item.ReturnMan = dt.Rows[i]["ReturnMan"].ToString();
                    }
                    list.Add(item);
                }
            }
            return(list);
        }
Пример #9
0
 public bool Update(PrjLoadModel model)
 {
     return((model != null) && this.dal.Update(model));
 }