public static EmployeeViewModel ConvertToViewModel(this Employee employee, Department department, Employee manager, Salary salary, Title title) { var employeeViewModel = new EmployeeViewModel { BirthDate = employee.BirthDate.Value.ToShortDateString(), CurrentManager = string.Empty, Id = employee.PersistenceId.ToString(), FirstName = employee.FirstName, Gender = employee.Gender.DisplayName, HireDate = employee.HireDate.Value.ToShortDateString(), LastName = employee.LastName, }; if (manager != null) { employeeViewModel.CurrentManager = manager.FirstName + " " + manager.LastName; } if (department != null) { employeeViewModel.CurrentDepartment = department.Name; } if (salary != null) { employeeViewModel.CurrentSalary = salary.Amount.ToString(); } if (title != null) { employeeViewModel.CurrentTitle = title.Name; } return employeeViewModel; }
public ChangeSalary(Processing processing, EmployeeViewModel currentEmployeeData) { this.InitializeComponent(); this.processor = processing; this.employeeData = currentEmployeeData; this.InitializeComponent(); }
public static EmployeeViewModel ConvertToViewModel(this Employee employee) { var employeeViewModel = new EmployeeViewModel { BirthDate = employee.BirthDate.Value.ToShortDateString(), CurrentDepartment = string.Empty, CurrentManager = string.Empty, CurrentSalary = string.Empty, CurrentTitle = string.Empty, Id = employee.PersistenceId.ToString(), FirstName = employee.FirstName, Gender = employee.Gender.DisplayName, HireDate = employee.HireDate.Value.ToShortDateString(), LastName = employee.LastName, }; return employeeViewModel; }
private void SearchForEmployee(int searchNumber) { var request = new GetEmployeeRequest(searchNumber); var response = this.employeeService.GetEmployee(request); if (response.Exception != null) { this.DisplayErrorMessage("Employee could not be found."); } else { this.CurrentEmployeeData = response.Employee; this.DisplayEmployeeData(response); } }