private void Save() { try { if (isFormLoaded && _teacher != null) { if (_teacher.Name.Length < 10 || _teacher.Name.Length > 100) { MessageBox.Show("Teacher Name character should be between 10 and 100."); return; } if (_id == -1) { schoolMan.AddTeacher(_teacher); } else { schoolMan.UpdateTeacher(_teacher); } } MessageBox.Show("Save Operation succeed."); btnSave.Enabled = false; btnCancel.Text = "Close"; return; } catch (Exception ex) { Logger.LogException(ex); MessageBox.Show("Save Operation failed."); } }