protected void btnLoanAddSubmit_Click(object sender, EventArgs e) { BorrowORLoanInfo loanInfo = new BorrowORLoanInfo(); if (!string.IsNullOrEmpty(this.HiddenField1.Value.Trim())) { loanInfo.Id = Convert.ToInt32(this.HiddenField1.Value.Trim()); } else { loanInfo.Id = 0; } #region 验证 if (!CheckLoanAddForm()) { string type = this.RadioLoanAddLoanType.SelectedValue; string temp = this.HidderField2.Value; this.ClientScript.RegisterStartupScript(this.GetType(), "fillForm", "DisplayAddLoandiv('" + type + "');fillFormField({loanAccount:'" + temp + "'});", true); return; } #endregion loanInfo.Borrower = this.txtLoanAddBorrower.Text.Trim(); if (this.RadioLoanAddLoanType.SelectedValue == "2" && !string.IsNullOrEmpty(this.HidderField2.Value.Trim())) { string[] s = this.HidderField2.Value.Split(','); CardInfo cardInfo = CardMethods.GetCardById(Convert.ToInt32(s[0])); loanInfo.LoanAccount = cardInfo.CardNumber; loanInfo.BorrowORLoanAccountId = cardInfo.Id; } loanInfo.Lender = this.txtLoanAddLender.Text.Trim(); loanInfo.BorrowedAccount = this.txtLoanAddBorrowAccount.Text.Trim(); loanInfo.BorrowORLoanType = Convert.ToInt32(this.RadioLoanAddLoanType.SelectedValue); loanInfo.Amount = Convert.ToSingle(this.txtLoanAddLoanAmount.Text.Trim()); loanInfo.HappenedDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtLoanAddLoanDate.Text.Trim())); if (!string.IsNullOrEmpty(this.txtLoanAddReturnDate.Text.Trim())) { loanInfo.ReturnDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtLoanAddReturnDate.Text.Trim())); } loanInfo.Status = Convert.ToInt32(this.dropLoanAddStatus.SelectedValue); loanInfo.Content = this.txtLoanAddContent.Text.Trim(); int iSuccess = LoanMethods.InsertOrUpdatetoLoan(loanInfo); this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayAddLoandiv();", true); if (iSuccess == 1) { Alert.Show(this, "新增一条收入成功!"); } else if (iSuccess == 2) { Alert.Show(this, "修改成功!"); } else { Alert.Show(this, "操作失败!"); } queryList = new List <QueryElement>(); BindLoanListDataGrid(queryList); }
protected void btnIncomeEditSave_Click(object sender, EventArgs e) { CashIncomeInfo info = new CashIncomeInfo(); #region 验证 if (Session["editFlag"].Equals("true")) { this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayEditIncomediv();", true); info.Id = Convert.ToInt32(Request.QueryString["IncomeId"]); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayAddIncomediv();", true); } if (string.IsNullOrEmpty(this.dropIncomeAddCardNumber.SelectedValue)) { Alert.Show(this, "请选择卡号!"); this.dropIncomeAddCardNumber.Focus(); return; } if (string.IsNullOrEmpty(this.dropIncomeAddInComeType.SelectedValue)) { Alert.Show(this, "请输入收入类型!"); this.dropIncomeAddInComeType.Focus(); return; } if (string.IsNullOrEmpty(this.dropIncomeAddMode.SelectedValue)) { Alert.Show(this, "请输入存款状态!"); this.dropIncomeAddMode.Focus(); return; } if (string.IsNullOrEmpty(this.txtIncomeAddAmount.Text.Trim())) { Alert.Show(this, "请输入收入金额!"); this.txtIncomeAddAmount.Focus(); return; } if (string.IsNullOrEmpty(this.dropIncomeAddRate.SelectedValue)) { Alert.Show(this, "请输入利率!"); this.dropIncomeAddRate.Focus(); return; } if (string.IsNullOrEmpty(this.txtIncomeAddDepositDate.Text.Trim())) { Alert.Show(this, "请输入存款日期!"); this.txtIncomeAddDepositDate.Focus(); return; } if (string.IsNullOrEmpty(this.txtIncomeAddDepositorName.Text.Trim())) { Alert.Show(this, "请输入存款人!"); this.txtIncomeAddDepositDate.Focus(); return; } if (!string.IsNullOrEmpty(this.txtIncomeAddBDate.Text.Trim()) || !string.IsNullOrEmpty(this.txtIncomeAddEDate.Text.Trim())) { if (!string.IsNullOrEmpty(this.txtIncomeAddBDate.Text.Trim()) && string.IsNullOrEmpty(this.txtIncomeAddEDate.Text.Trim())) { Alert.Show(this, "请输入到期日期!"); this.txtIncomeAddEDate.Focus(); return; } else if (string.IsNullOrEmpty(this.txtIncomeAddBDate.Text.Trim()) && !string.IsNullOrEmpty(this.txtIncomeAddEDate.Text.Trim())) { Alert.Show(this, "请输入定存开始日期!"); this.txtIncomeAddBDate.Focus(); return; } else { bool comparflag = true; comparflag = HelperCommon.ValidDateTime(string.Format("{0:d}", this.txtIncomeAddBDate.Text.Trim()), string.Format("{0:d}", this.txtIncomeAddEDate.Text.Trim())); if (!comparflag) { Alert.Show(this, "到期日期不能小于开始日期"); this.txtIncomeAddEDate.Focus(); return; } comparflag = HelperCommon.ComparDay(string.Format("{0:d}", this.txtIncomeAddBDate.Text.Trim()), string.Format("{0:d}", this.txtIncomeAddEDate.Text.Trim())); if (!comparflag) { Alert.Show(this, "定存日期必须大于等于三个月!"); this.txtIncomeAddEDate.Focus(); return; } } } if (string.IsNullOrEmpty(this.dropIncomeAddStatus.SelectedValue)) { Alert.Show(this, "请选择收入状态!"); this.dropIncomeAddStatus.Focus(); return; } if (string.IsNullOrEmpty(this.dropIncomeAddDepositMode.SelectedValue)) { Alert.Show(this, "请选存款方式!"); this.dropIncomeAddDepositMode.Focus(); return; } if (string.IsNullOrEmpty(this.txtIncomeAddOwner.Text.Trim())) { Alert.Show(this, "请输入资产所有者!"); this.txtIncomeAddOwner.Focus(); return; } #endregion #region 赋值 UserInfo userInfo = UserMethods.GetUserByName(this.txtIncomeAddOwner.Text.Trim()); info.OwnerName = this.txtIncomeAddOwner.Text.Trim(); userInfo = UserMethods.GetUserByName(this.txtIncomeAddOwner.Text.Trim()); if (userInfo.Id > 0) { info.OwnerId = userInfo.Id; } else { info.OwnerId = 0; } CardInfo cardInfo = CardMethods.GetCardById(Convert.ToInt32(this.dropIncomeAddCardNumber.SelectedValue)); info.CardNumber = cardInfo.CardNumber; info.BankCardNumber = cardInfo.CardNumber + " " + StaticRescourse.DisplayBank(cardInfo.BankId); info.CardId = Convert.ToInt32(this.dropIncomeAddCardNumber.SelectedItem.Value); info.IncomeAmount = Convert.ToSingle(this.txtIncomeAddAmount.Text.Trim()); info.PreMode = Convert.ToInt32(this.dropIncomeAddPreMode.SelectedValue); info.Mode = Convert.ToInt32(this.dropIncomeAddMode.SelectedValue); info.PreRate = Convert.ToInt32(this.dropIncomeAddPreRate.SelectedValue); info.Rate = Convert.ToInt32(this.dropIncomeAddRate.SelectedValue); info.DepositDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtIncomeAddDepositDate.Text.Trim())); if (!string.IsNullOrEmpty(this.txtIncomeAddBDate.Text.Trim())) { info.BDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtIncomeAddBDate.Text.Trim())); } if (!string.IsNullOrEmpty(this.txtIncomeAddEDate.Text.Trim())) { info.EDate = HelperCommon.ConverToDateTime(string.Format("{0:d}", this.txtIncomeAddEDate.Text.Trim())); } if (this.checkIncomeAddAutoSave.Checked) { info.AutoSave = 1; } else { info.AutoSave = 0; } userInfo = UserMethods.GetUserByName(this.txtIncomeAddDepositorName.Text.Trim()); if (userInfo.Id > 0) { info.DepositorId = userInfo.Id; } else { info.DepositorId = 0; } info.DepositorName = this.txtIncomeAddDepositorName.Text.Trim(); info.DepositMode = Convert.ToInt32(this.dropIncomeAddDepositMode.SelectedValue); info.Status = Convert.ToInt32(this.dropIncomeAddStatus.SelectedValue); info.IncomeType = Convert.ToInt32(this.dropIncomeAddInComeType.SelectedValue); info.TAmount = info.IncomeAmount; info.Content = !string.IsNullOrEmpty(this.txtIncomeAddContent.Text.Trim()) ? this.txtIncomeAddContent.Text.Trim() : string.Empty; #endregion int iSuccess = CashIncomeMethods.InsertOrUpdatetocashincome(info); this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayAddIncomediv();", true); if (iSuccess > 0) { Alert.Show(this, "新增一条收入成功!"); } else if (iSuccess == -1) { Alert.Show(this, "修改成功!"); } else { Alert.Show(this, "操作失败!"); } InitializeIncomeAdd(new CashIncomeInfo()); queryList = new List <QueryElement>(); BindIncomeListDataGrid(queryList); }