Example #1
0
    protected void btnDel_Click(object sender, EventArgs e)
    {
        bool          flag         = true;
        PrjLoadLogic  prjLoadLogic = new PrjLoadLogic();
        string        arg_0D_0     = string.Empty;
        List <string> list         = new List <string>();

        if (this.hdnLoanID.Value.Contains("["))
        {
            list = JsonHelper.GetListFromJson(this.hdnLoanID.Value);
        }
        else
        {
            list.Add(this.hdnLoanID.Value);
        }
        using (SqlConnection sqlConnection = new SqlConnection(PrjLoan.ConnectionString))
        {
            sqlConnection.Open();
            SqlTransaction sqlTransaction = sqlConnection.BeginTransaction();
            try
            {
                for (int i = 0; i < list.Count; i++)
                {
                    if (!string.IsNullOrEmpty(list[i].ToString()) && !prjLoadLogic.Delete(new Guid(list[i].ToString()), sqlTransaction))
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag)
                {
                    sqlTransaction.Commit();
                    this.BindGv();
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.Append("top.ui.show('删除成功');");
                    base.RegisterScript(stringBuilder.ToString());
                }
                else
                {
                    sqlTransaction.Rollback();
                    sqlConnection.Close();
                    base.RegisterScript("top.ui.alert('删除失败!');");
                }
            }
            catch (Exception)
            {
                sqlTransaction.Rollback();
                sqlConnection.Close();
                base.RegisterScript("top.ui.alert('删除失败!');");
            }
        }
    }
Example #2
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;
            }
        }
    }