private void dgvRecoedtList_CellContentClick(object sender, DataGridViewCellEventArgs e) { int columnIndex = e.ColumnIndex; int rowIndex = e.RowIndex; //AddCode if (rowIndex == -1) { return; } //AddCode if (this.dgvRecoedtList.Columns[columnIndex] == this.dgvRecoedtList.Columns[_delColumnName]) { var dialogResult = MessageBox.Show("确定要删除吗?", SystemInfo.ReminderStr, MessageBoxButtons.OKCancel); if (dialogResult == DialogResult.OK) { var RecordID = (int)dgvRecoedtList.Rows[rowIndex].Cells["RecordID"].Value; var result = new RewardRecordBLL().DeleteRewardRecordByID(RecordID); if (result.Code > 0) { MessageBox.Show(result.Message, SystemInfo.ErrorReminderStr, MessageBoxButtons.OK); } BindDataList(); } } else if (this.dgvRecoedtList.Columns[columnIndex] == this.dgvRecoedtList.Columns[_editColumName]) { var TitleWageChangeRecordID = (int)dgvRecoedtList.Rows[rowIndex].Cells["RecordID"].Value; var contractForm = new RewardRecordInfoForm(true, TitleWageChangeRecordID, null); contractForm.callbackEvent += delegate { BindDataList(); }; contractForm.ShowDialog(); } }
private void btnSave_Click(object sender, EventArgs e) { var record = new RewardRecord(); record.RewardDate = this.dtpRewardDate.Value; record.RewardContent = this.rtxtRewardContent.Text; var bll = new RewardRecordBLL(); CResult<bool> result = new CResult<bool>(false); if (this._isEdit) { record.RecordID = this._currentRecordID.Value; result = bll.UpdateRewardRecord(record); } else { record.PeopleID = this._peopleID.Value; result = bll.InsertRewardRecord(record); } MessageHelper.ShowSaveDbResultMessage(result); if (result.Code == 0) { this.Dispose(); if (callbackEvent != null) { callbackEvent.Invoke(); } } }
private void InitControlValue() { if (this._currentRecordID.HasValue) { var contract = new RewardRecordBLL().GetRewardRecordByID(this._currentRecordID.Value).Data; if (contract.RewardDate.HasValue) { this.dtpRewardDate.Value = contract.RewardDate.Value; } this.rtxtRewardContent.Text = contract.RewardContent; } }