private void SaveExecute() { try { if (Number <= 1 || Number > 1000) { MessageBox.Show("X must be in range of (1, 1000)."); return; } employee.Salary = salaryCalculation().ToString(); serviceEmployee.EditEmployee(Employee); isUpdateEmployee = true; salary.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// This method invokes a methods for editing employee achecks if sector of employee exists. If not exist, invokes a method for adding sector. /// </summary> public void SaveExecute() { try { if (serviceSector.IsSectorExists(Sector) == false) { serviceSector.AddSector(sector); } Employee.Sector = serviceSector.FindSector(sector); Employee.LocationID = Convert.ToInt32(Location.LocationID); Employee.Gender = Convert.ToInt32(Gender.GenderID); if (Manager != null) { Employee.Manager = Convert.ToInt32(Manager.EmployeeID); } serviceEmployee.EditEmployee(employee); editEmployeeView.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }