private void btnSave_Click(object sender, EventArgs e) { if (ValidateEntries()) { int intResults = 0; using (clsEmployeeDependent ed = new clsEmployeeDependent()) { ed.DependentCode = _strDependentCode; ed.Name = txtName.Text; ed.Birthdate = dtpBirthDate.Value; ed.Relation = txtRelation.Text; intResults = ed.Edit(); } if (intResults > 0) { switch (_FormCaller) { case FormCallers.EmployeeDetails: _frmEmployeeDetails.LoadDependentsList(); break; } Close(); } } }
private void btnSave_Click(object sender, EventArgs e) { if (ValidateEntries()) { int intResults = 0; using (clsEmployeeDependent ed = new clsEmployeeDependent()) { ed.Username = _strUsername; ed.Name = txtName.Text; ed.Birthdate = dtpBirthDate.Value; ed.Relation = txtRelation.Text; intResults = ed.Add(); } if (intResults > 0) { _frmEmployeeDetails.LoadDependentsList(); if (MessageBox.Show(clsMessageBox.MessageBoxSuccessAddAskNew, clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ClearFields(); } else { this.Close(); } } } }