private void btnSave_Click(object sender, EventArgs e) { if (IsCorrectEntries()) { int intAffected = 0; using (clsResignationReason reason = new clsResignationReason()) { reason.ResignationReasonName = txtReason.Text; reason.Enabled = (chkEnabled.Checked ? "1" : "0"); intAffected = reason.Insert(); } if (intAffected > 0) { switch (_FormCaller) { case FormCallers.ResignationReasonList: _frmResignationReasonList.BindResignationReasonList(); break; case FormCallers.EmployeeDetails: _frmEmployeeDetails.BindResignationReason(); break; } if (MessageBox.Show(clsMessageBox.MessageBoxSuccessAddAskNew, clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ClearFields(); } else { this.Close(); } } } }
private void btnSave_Click(object sender, EventArgs e) { if (this.IsCorrectData()) { using (clsResignationReason reason = new clsResignationReason()) { reason.ResignationReasonCode = _strResignationReasonCode; reason.Fill(); reason.ResignationReasonName = txtReason.Text; reason.Enabled = (chkEnabled.Checked ? "1" : "0"); if (reason.Update() > 0) { _frmResignationReasonList.BindResignationReasonList(); this.Close(); } } } }