private void buttonXDelete_Click(object sender, EventArgs e) { if (this.gridViewDataList.SelectedRowsCount == 0) { MessageBox.Show("请选择一条数据!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!MessageBoxFunction.showQuestionMessageBox("确定要删除这条数据?")) { return; } // 取出pk int selectRow = this.gridViewDataList.GetSelectedRows()[0]; int pk = Convert.ToInt32(this.gridViewDataList.GetRowCellValue(selectRow, "pk").ToString()); bool isSuccess = IncomeAccountsManager.Instance.Delete(pk); if (isSuccess) { MessageBox.Show("删除成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.loadDataList(); } else { MessageBox.Show("删除失败!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void loadCombox() { // 消费用途下拉 DataSet dataSet = IncomeTypeManager.Instance.GetList(""); if (dataSet == null || dataSet.Tables.Count == 0) { MessageBoxFunction.showWarningMessageBox("没有收入类型,请先去创建收入类型!"); base.Close(); return; } DataTable dataTable = dataSet.Tables[0]; if (dataTable == null && dataTable.Rows.Count == 0) { MessageBoxFunction.showWarningMessageBox("没有收入类型,请先去创建收入类型!"); base.Close(); return; } DataRow dr = dataTable.NewRow(); dr["v_srlx_name"] = "全部"; dr["pk"] = -1; dataTable.Rows.Add(dr); this.comboBoxExType.Items.Clear(); this.comboBoxExType.DataSource = dataTable; this.comboBoxExType.DisplayMember = "v_srlx_name"; this.comboBoxExType.ValueMember = "pk"; this.comboBoxExType.SelectedValue = -1; }
private void btnOK_Click(object sender, EventArgs e) { if (estimateNull() == false) { return; } if (m_jrzmModel == null) { jt_jr_zm zmModel = new jt_jr_zm(); zmModel = setModelValue(zmModel); bool isSuccess = BorrowAccountsManager.Instance.Add(zmModel); if (isSuccess) { MessageBoxFunction.showSaveSuccessMessageBox(); this.DialogResult = DialogResult.OK; } } else { m_jrzmModel = setModelValue(m_jrzmModel); bool isSuccess = BorrowAccountsManager.Instance.Update(m_jrzmModel); if (isSuccess) { MessageBoxFunction.showSaveSuccessMessageBox(); this.DialogResult = DialogResult.OK; } } base.Close(); }
private void buttonSearch_Click(object sender, EventArgs e) { if (this.dateTimeInputStartDate.Value > this.dateTimeInputEndDate.Value) { MessageBoxFunction.showWarningMessageBox("开始时间不能大于结束时间!"); return; } loadData(); }
/// <summary> /// 加载下拉框 /// </summary> private bool loadTypeComboBox() { DataTable dataTable = null; DataSet dataSet = null; // 消费用途下拉 dataSet = ExpendTypeManager.Instance.GetList(""); if (dataSet == null || dataSet.Tables.Count == 0) { MessageBoxFunction.showWarningMessageBox("没有支出类型,请先去创建支出类型!"); base.Close(); return(false); } dataTable = dataSet.Tables[0]; if (dataTable == null && dataTable.Rows.Count == 0) { MessageBoxFunction.showWarningMessageBox("没有支出类型,请先去创建支出类型!"); base.Close(); return(false); } this.comboBoxType.DataSource = dataTable; this.comboBoxType.DisplayMember = "v_zclx_name"; this.comboBoxType.ValueMember = "pk"; // 支付方式 dataSet = PaymentTypeManager.Instance.GetList(""); if (dataSet == null || dataSet.Tables.Count == 0) { MessageBoxFunction.showWarningMessageBox("没有支付方式,请先去创建支付方式!"); base.Close(); return(false); } dataTable = dataSet.Tables[0]; if (dataTable == null && dataTable.Rows.Count == 0) { MessageBoxFunction.showWarningMessageBox("没有支付方式,请先去创建支付方式!"); base.Close(); return(false); } this.comboBoxPayType.DataSource = dataTable; this.comboBoxPayType.DisplayMember = "v_zffs_name"; this.comboBoxPayType.ValueMember = "pk"; return(true); }
/// <summary> /// 判断是否填了空值 /// </summary> private bool estimateNull() { if (string.IsNullOrEmpty(this.textBoxNo.Text)) { MessageBoxFunction.showVerifyInfoMessageBox("编码不能为空!"); return(false); } if (this.decimalTextBoxMoney.EditValue <= 0) { MessageBoxFunction.showVerifyInfoMessageBox("消费金额不能小于或等于0!"); return(false); } if (string.IsNullOrEmpty(this.textBoxWho.Text)) { MessageBoxFunction.showVerifyInfoMessageBox("给谁消费的不能为空!"); return(false); } return(true); }
/// <summary> /// 判断是否填了空值 /// </summary> private bool estimateNull() { if (string.IsNullOrEmpty(this.textBoxNo.Text)) { MessageBoxFunction.showVerifyInfoMessageBox("编码不能为空!"); return(false); } if (this.decimalTextBoxMoney.EditValue <= 0) { MessageBoxFunction.showVerifyInfoMessageBox("消费金额不能小于或等于0!"); return(false); } if (string.IsNullOrEmpty(this.textBoxName.Text)) { MessageBoxFunction.showVerifyInfoMessageBox("预算用途不能为空!"); return(false); } if (this.dateTimeStart.Value > this.dateTimeEnd.Value) { MessageBoxFunction.showVerifyInfoMessageBox("开始时间不能大于结束时间!"); return(false); } return(true); }