private void dgvContractList_CellContentClick(object sender, DataGridViewCellEventArgs e) { int columnIndex = e.ColumnIndex; int rowIndex = e.RowIndex; //AddCode if (rowIndex == -1) { return; } //AddCode if (this.dgvContractList.Columns[columnIndex] == this.dgvContractList.Columns[_delColumnName]) { var dialogResult = MessageBox.Show("确定要删除吗?", SystemInfo.ReminderStr, MessageBoxButtons.OKCancel); if (dialogResult == DialogResult.OK) { var contractID = (int)dgvContractList.Rows[rowIndex].Cells["ContractID"].Value; var result = new ContractBLL().DeleteContractByID(contractID); if (result.Code > 0) { MessageBox.Show(result.Message, SystemInfo.ErrorReminderStr, MessageBoxButtons.OK); } BindDataList(); } } else if (this.dgvContractList.Columns[columnIndex] == this.dgvContractList.Columns[_editColumName]) { var contractID = (int)dgvContractList.Rows[rowIndex].Cells["ContractID"].Value; var contractForm = new ContractInfoForm(true, contractID, null); contractForm.callbackEvent += delegate { BindDataList(); }; contractForm.ShowDialog(); } }
private void btnNew_Click(object sender, EventArgs e) { var contractInfoForm = new ContractInfoForm(false, null, this._currentPeopleID); contractInfoForm.callbackEvent += BindDataList; contractInfoForm.ShowDialog(); }