protected void btnBorrowQuerySubmit_Click(object sender, EventArgs e) { queryList = new List<QueryElement>(); #region 查询条件验证 if (!string.IsNullOrEmpty(this.txtBorrowQueryBBorrowDate.Text.Trim()) || !string.IsNullOrEmpty(this.txtBorrowQueryEBorrowDate.Text.Trim())) { if (!string.IsNullOrEmpty(this.txtBorrowQueryBBorrowDate.Text.Trim()) && string.IsNullOrEmpty(this.txtBorrowQueryEBorrowDate.Text.Trim())) { Alert.Show(this, "请输入一个时间段!"); this.txtBorrowQueryEBorrowDate.Focus(); return; } else if (string.IsNullOrEmpty(this.txtBorrowQueryBBorrowDate.Text.Trim()) && !string.IsNullOrEmpty(this.txtBorrowQueryEBorrowDate.Text.Trim())) { Alert.Show(this, "请输入一个时间段!"); this.txtBorrowQueryBBorrowDate.Focus(); return; } else { bool flag = HelperCommon.ValidDateTime(this.txtBorrowQueryBBorrowDate.Text.Trim(), this.txtBorrowQueryEBorrowDate.Text.Trim()); if (!flag) { Alert.Show(this, "开始日期不能大于结束日期!"); this.txtBorrowQueryEBorrowDate.Focus(); return; } } } #endregion if (!string.IsNullOrEmpty(this.txtBorrowQueryBorrower.Text.Trim())) { QueryElement query = new QueryElement { Queryname = "Borrower", QueryElementType = MySqlDbType.String, Queryvalue = this.txtBorrowQueryBorrower.Text.Trim(), QueryOperation = "like" }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.dropBorrowQueryStatus.SelectedValue)) { QueryElement query = new QueryElement { Queryname = "Status", QueryElementType = MySqlDbType.Int32, Queryvalue = Convert.ToInt32(this.dropBorrowQueryStatus.SelectedValue) }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.txtBorrowQueryBBorrowDate.Text.Trim()) && !string.IsNullOrEmpty(this.txtBorrowQueryEBorrowDate.Text.Trim())) { QueryElement query = new QueryElement { Queryname = "HappenedDate", QueryElementType = MySqlDbType.DateTime, Queryvalue = this.txtBorrowQueryBBorrowDate.Text.Trim(), QueryOperation = ">=" }; queryList.Add(query); query = new QueryElement { Queryname = "HappenedDate", QueryElementType = MySqlDbType.DateTime, Queryvalue = this.txtBorrowQueryEBorrowDate.Text.Trim(), QueryOperation = "<" }; queryList.Add(query); } BindBorrowListDataGrid(queryList); this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayQueryBorrowdiv();", true); InitializeBorrowQuery(); }
/// <summary> /// 查询提交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnExpensesQuerySubmit_Click(object sender, EventArgs e) { #region 验证 if (!string.IsNullOrEmpty(this.txtExpensesQueryBSpendDate.Text.Trim()) || !string.IsNullOrEmpty(this.txtExpensesQueryESpendDate.Text.Trim())) { if (!string.IsNullOrEmpty(this.txtExpensesQueryBSpendDate.Text.Trim()) && string.IsNullOrEmpty(this.txtExpensesQueryESpendDate.Text.Trim())) { Alert.Show(this, "请输入一个时间段!"); this.txtExpensesQueryESpendDate.Focus(); return; } else if (string.IsNullOrEmpty(this.txtExpensesQueryBSpendDate.Text.Trim()) && !string.IsNullOrEmpty(this.txtExpensesQueryESpendDate.Text.Trim())) { Alert.Show(this, "请输入一个时间段!"); this.txtExpensesQueryBSpendDate.Focus(); return; } else { bool flag = HelperCommon.ValidDateTime(this.txtExpensesQueryBSpendDate.Text.Trim(), this.txtExpensesQueryESpendDate.Text.Trim()); if (!flag) { Alert.Show(this, "开始日期不能大于结束日期!"); this.txtExpensesQueryESpendDate.Focus(); return; } } } #endregion queryList = new List <QueryElement>(); if (!string.IsNullOrEmpty(this.txtExpensesQueryCardNumber.Text.Trim())) { QueryElement query = new QueryElement { Queryname = "CardNumber", QueryElementType = MySqlDbType.String, Queryvalue = this.txtExpensesQueryCardNumber.Text.Trim() }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.dropExpensesQuerySpendType.SelectedValue)) { QueryElement query = new QueryElement { Queryname = "SpendType", QueryElementType = MySqlDbType.Int32, Queryvalue = Convert.ToInt32(this.dropExpensesQuerySpendType.SelectedValue) }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.dropExpensesQuerySpendMode.SelectedValue)) { QueryElement query = new QueryElement { Queryname = "SpendMode", QueryElementType = MySqlDbType.Int32, Queryvalue = Convert.ToInt32(this.dropExpensesQuerySpendMode.SelectedValue) }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.txtExpensesQueryConsumerName.Text.Trim())) { QueryElement query = new QueryElement { Queryname = "ConsumerName", QueryElementType = MySqlDbType.String, Queryvalue = this.txtExpensesQueryConsumerName.Text.Trim(), QueryOperation = "like" }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.txtExpensesQueryBSpendDate.Text.Trim()) && !string.IsNullOrEmpty(this.txtExpensesQueryESpendDate.Text.Trim())) { QueryElement query = new QueryElement { Queryname = "SpendDate", QueryElementType = MySqlDbType.DateTime, Queryvalue = this.txtExpensesQueryBSpendDate.Text.Trim(), QueryOperation = ">=" }; queryList.Add(query); query = new QueryElement { Queryname = "SpendDate", QueryElementType = MySqlDbType.DateTime, Queryvalue = this.txtExpensesQueryESpendDate.Text.Trim(), QueryOperation = "<" }; queryList.Add(query); } BindExpensesListDataGrid(queryList); this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayExpensesQuerydiv();", true); InitializeExpensesQuery(); }
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); }
protected void btnIncomeQuerySelect_Click(object sender, EventArgs e) { this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayQueryIncomediv();", true); #region 查询条件验证 if (!string.IsNullOrEmpty(this.txtIncomeQueryBDepositDate.Text.Trim()) || !string.IsNullOrEmpty(this.txtIncomeQueryEDepositDate.Text.Trim())) { if (!string.IsNullOrEmpty(this.txtIncomeQueryBDepositDate.Text.Trim()) && string.IsNullOrEmpty(this.txtIncomeQueryEDepositDate.Text.Trim())) { Alert.Show(this, "请输入一个时间段!"); this.txtIncomeQueryEDepositDate.Focus(); return; } else if (string.IsNullOrEmpty(this.txtIncomeQueryBDepositDate.Text.Trim()) && !string.IsNullOrEmpty(this.txtIncomeQueryEDepositDate.Text.Trim())) { Alert.Show(this, "请输入一个时间段!"); this.txtIncomeQueryBDepositDate.Focus(); return; } else { bool flag = HelperCommon.ValidDateTime(this.txtIncomeQueryBDepositDate.Text.Trim(), this.txtIncomeQueryEDepositDate.Text.Trim()); if (!flag) { Alert.Show(this, "开始日期不能大于结束日期!"); this.txtIncomeQueryEDepositDate.Focus(); return; } } } #endregion queryList = new List <QueryElement>(); if (!string.IsNullOrEmpty(this.txtIncomeQueryCardNumber.Text.Trim())) { QueryElement query = new QueryElement { Queryname = "CardNumber", QueryElementType = MySqlDbType.String, Queryvalue = this.txtIncomeQueryCardNumber.Text.Trim() }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.dropIncomeQueryIncomeType.SelectedValue)) { QueryElement query = new QueryElement { Queryname = "IncomeType", QueryElementType = MySqlDbType.Int32, Queryvalue = Convert.ToInt32(this.dropIncomeQueryIncomeType.SelectedValue) }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.txtIncomeQueryOwnerName.Text.Trim())) { QueryElement query = new QueryElement { Queryname = "OwnerName", QueryElementType = MySqlDbType.String, Queryvalue = this.txtIncomeQueryOwnerName.Text.Trim(), QueryOperation = "like" }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.dropIncomeQueryMode.SelectedValue)) { QueryElement query = new QueryElement { Queryname = "Mode", QueryElementType = MySqlDbType.Int32, Queryvalue = this.dropIncomeQueryMode.SelectedValue }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.txtIncomeQueryDepositorName.Text.Trim())) { QueryElement query = new QueryElement { Queryname = "DepositorName", QueryElementType = MySqlDbType.String, Queryvalue = this.txtIncomeQueryDepositorName.Text.Trim(), QueryOperation = "like" }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.dropIncomeQueryDepositMode.SelectedValue)) { QueryElement query = new QueryElement { Queryname = "DepositMode", QueryElementType = MySqlDbType.Int32, Queryvalue = this.dropIncomeQueryDepositMode.SelectedValue }; queryList.Add(query); } if (!string.IsNullOrEmpty(this.txtIncomeQueryBDepositDate.Text.Trim()) && !string.IsNullOrEmpty(this.txtIncomeQueryEDepositDate.Text.Trim())) { QueryElement query = new QueryElement { Queryname = "DepositDate", QueryElementType = MySqlDbType.DateTime, Queryvalue = this.txtIncomeQueryBDepositDate.Text.Trim(), QueryOperation = ">=" }; queryList.Add(query); query = new QueryElement { Queryname = "DepositDate", QueryElementType = MySqlDbType.DateTime, Queryvalue = this.txtIncomeQueryEDepositDate.Text.Trim(), QueryOperation = "<" }; queryList.Add(query); } BindIncomeListDataGrid(queryList); this.ClientScript.RegisterStartupScript(this.GetType(), "", "DisplayQueryIncomediv();", true); InitializeIncomeQuery(); }