private void ScatterData() { ServiceEmployee _service = new ServiceEmployee(); try { TBL_MP_Master_Employee_Qualification model = _service.GetEmployeeQualificationDBRecordByID(this.EmployeeQualificationID); if (model != null) { txtQualification.Text = model.Qualification; txtNameOfInstitute.Text = model.NameOfInstitute; txtGradeClass.Text = model.Grade; TBL_MP_Master_Employee emp = _service.GetEmployeeDbRecordByID(model.FK_EmployeeId); this.Text = string.Format("{0} ({1}) - Update Qualification", emp.EmployeeName, emp.EmployeeCode); } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "frmAddEditEmployeeQualification::ScatterData", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnOK_Click(object sender, EventArgs e) { TBL_MP_Master_Employee_Qualification model = null; ServiceEmployee _service = new ServiceEmployee(); try { if (!this.ValidateChildren()) { return; } if (this.EmployeeQualificationID == 0) { model = new TBL_MP_Master_Employee_Qualification(); } else { model = _service.GetEmployeeQualificationDBRecordByID(EmployeeQualificationID); } model.Qualification = txtQualification.Text.Trim(); model.NameOfInstitute = txtNameOfInstitute.Text.Trim(); model.Grade = txtGradeClass.Text.Trim(); if (this.EmployeeQualificationID == 0) { model.FK_EmployeeId = SelectedEmployeeID; this.EmployeeQualificationID = _service.AddNewEmployeeQualification(model); } else { _service.UpdateEmployeeQualification(model); } this.DialogResult = DialogResult.OK; } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "frmAddEditEmployeeQualification::btnOK_Click", MessageBoxButtons.OK, MessageBoxIcon.Error); } }