void Save() { try { if (isFormLoaded && _student != null) { if (_student.Name.Length < 10 || _student.Name.Length > 100) { MessageBox.Show("Standart Name character should be between 10 and 100."); return; } if (_student.StandardId == 0) { MessageBox.Show("Standart can not be null or zero."); return; } if (_student.TeacherId == 0) { MessageBox.Show("Teacher can not be null or zero."); return; } if (_id == -1) { schoolMan.AddStudent(_student); } else { schoolMan.UpdateStudent(_student); } } MessageBox.Show("Save Operation succeed."); btnSave.Enabled = false; btnCancel.Text = "Close"; return; } catch (Exception ex) { Logger.LogException(ex); MessageBox.Show("Save Operation failed."); } }