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 TitleWageChangeRecordID = (int)dgvContractList.Rows[rowIndex].Cells["RecordID"].Value;
             var result = new TitleWageChangeRecordBLL().DeleteTitleWageChangeRecordByID(TitleWageChangeRecordID);
             if (result.Code > 0) {
                 MessageBox.Show(result.Message, SystemInfo.ErrorReminderStr, MessageBoxButtons.OK);
             }
             BindDataList();
         }
     } else if (this.dgvContractList.Columns[columnIndex] == this.dgvContractList.Columns[_editColumName]) {
         var TitleWageChangeRecordID = (int)dgvContractList.Rows[rowIndex].Cells["RecordID"].Value;
         var contractForm = new TitleWageChangeRecordInfoForm(true, TitleWageChangeRecordID, null);
         contractForm.callbackEvent += delegate {
             BindDataList();
         };
         contractForm.ShowDialog();
     }
 }
        public void InitControlValue()
        {
            if (_isEdit && _titleWageChangeRecordID.HasValue) {
                var record = new TitleWageChangeRecordBLL().GetTitleWageChangeRecordByID(_titleWageChangeRecordID.Value).Data;

                if (record.ChangeDate.HasValue) {
                    dtpChangeDate.Value = record.ChangeDate.Value;
                }
                txtAfterChangeYearAward.Text = record.AfterChangeYearAward.ToString();
                txtAfterChangeBasicWage.Text = record.AfterChangeBasicWage.ToString();
                txtContractNum.Text = record.ContractNum;
                txtBeforeChangeYearAward.Text = record.BeforeChangeYearAward.ToString();
                txtAfterChangeAllowance.Text = record.AfterChangeAllowance.ToString();
                txtAfterChangeTitle.Text = record.AfterChangeTitle.ToString();
                txtBeforeChangeallowance.Text = record.BeforeChangeAllowance.ToString();
                txtBeforeChangeTitle.Text = record.BeforeChangeTitle;
                txtBeforeChangeBasicWage.Text = record.BeforeChangeBasicWage.ToString();

                cbxChangeType.SelectedItem = ((TitleChangeType)record.ChangeType).ToString();
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            var record = new TitleWageChangeRecord();

            record.ChangeType = (int)(TitleChangeType)(Enum.Parse(typeof(TitleChangeType), this.cbxChangeType.SelectedItem.ToString()));
            record.AfterChangeTitle = this.txtAfterChangeTitle.Text;
            if (!string.IsNullOrWhiteSpace(this.txtAfterChangeAllowance.Text)) {
                record.AfterChangeAllowance = float.Parse(this.txtAfterChangeAllowance.Text);
            }
            if (!string.IsNullOrWhiteSpace(this.txtAfterChangeBasicWage.Text)) {
                record.AfterChangeBasicWage = float.Parse(this.txtAfterChangeBasicWage.Text);
            }
            if (!string.IsNullOrWhiteSpace(this.txtAfterChangeYearAward.Text)) {
                record.AfterChangeYearAward = float.Parse(this.txtAfterChangeYearAward.Text);
            }

            record.BeforeChangeTitle = this.txtBeforeChangeTitle.Text;
            if (!string.IsNullOrWhiteSpace(this.txtBeforeChangeallowance.Text)) {
                record.BeforeChangeAllowance = float.Parse(this.txtBeforeChangeallowance.Text);
            }
            if (!string.IsNullOrWhiteSpace(this.txtBeforeChangeBasicWage.Text)) {
                record.BeforeChangeBasicWage = float.Parse(this.txtBeforeChangeBasicWage.Text);
            }
            if (!string.IsNullOrWhiteSpace(this.txtBeforeChangeYearAward.Text)) {
                record.BeforeChangeYearAward = float.Parse(this.txtBeforeChangeYearAward.Text);
            }
            record.ChangeDate = this.dtpChangeDate.Value;
            record.ContractNum = this.txtContractNum.Text;

            CResult<bool> result = new CResult<bool>(false);
            if (_isEdit) {
                record.TitleWageChangeRecordID = this._titleWageChangeRecordID.Value;
                result = new TitleWageChangeRecordBLL().UpdateTitleWageChangeRecord(record);
            } else {
                record.PeopleID = this._peopleID.Value;
                result = new TitleWageChangeRecordBLL().InsertTitleWageChangeRecord(record);
            }
            MessageHelper.ShowSaveDbResultMessage(result);
            if (result.Code == 0) {
                this.Dispose();
                if (callbackEvent != null) {
                    callbackEvent.Invoke();
                }
            }
        }