private void btnSave_Click(object sender, EventArgs e) { if (IsCorrectData()) { using (JobGrade jobgrade = new JobGrade()) { jobgrade.JGCode = txtJGCode.Text; jobgrade.JGDescription = txtDescription.Text; jobgrade.JGOrder = clsValidator.CheckInteger(txtLevel.Text); jobgrade.DeductLate = (chkDeductLate.Checked ? "1" : "0"); jobgrade.DeductUnderTime = (chkDeductUndertime.Checked ? "1" : "0"); jobgrade.PayOverTime = (chkPayOvertime.Checked ? "1" : "0"); jobgrade.PlantillaCountHQ = clsValidator.CheckInteger(txtPlantillaCountHQ.Text); jobgrade.PlantillaCountBillable = clsValidator.CheckInteger(txtPlantillaCountBillable.Text); jobgrade.Insert(); } switch (_FormCaller) { case FormCallers.JobGradeList: _frmJobGradeList.BindJobGradeList(); break; } if (MessageBox.Show("Your record was successfully added.\n\nWould you like to add another record?", clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ClearFields(); } else { this.Close(); } } }
private void btnSave_Click(object sender, EventArgs e) { if (IsCorrectData()) { if (MessageBox.Show("Warning: \nModifying job grade settings might cause discrepancies on employee's details associated with it. \nIt is advisable to create a new job grade than to modify/delete existing one.\n\nAre you sure to continue?", clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { using (JobGrade objJobGrade = new JobGrade()) { objJobGrade.JGCode = txtJGCode.Text; objJobGrade.JGDescription = txtDescription.Text; objJobGrade.JGOrder = clsValidator.CheckInteger(txtLevel.Text); objJobGrade.DeductLate = (chkDeductLate.Checked ? "1" : "0"); objJobGrade.DeductUnderTime = (chkDeductUndertime.Checked ? "1" : "0"); objJobGrade.PayOverTime = (chkPayOvertime.Checked ? "1" : "0"); objJobGrade.PlantillaCountHQ = clsValidator.CheckInteger(txtPlantillaCountHQ.Text); objJobGrade.PlantillaCountBillable = clsValidator.CheckInteger(txtPlantillaCountBillable.Text); objJobGrade.Update(); } _frmJobGradeList.BindJobGradeList(); this.Close(); } } }