public ShowEmployeesViewModel(ShowEmployees showEmployeesOpen, tblEmployee currentUser) { showEmployees = showEmployeesOpen; employeeService = new EmployeeService(); EmployeeList = employeeService.GetAllNonMenagerEmployees(); }
public void Run() { IExecutable command = null; string line = Console.ReadLine(); while (line != "end") { string[] tokens = line.Split(); switch (tokens[0]) { case "create-company": command = new CreateCompany(db, tokens[1], tokens[2], tokens[3], decimal.Parse(tokens[4])); break; case "create-employee": string departmentName = null; if (tokens.Length > 5) { departmentName = tokens[5]; } command = new CreateEmployee(db, tokens[1], tokens[2], tokens[3], tokens[4], departmentName); break; case "create-department": string mainDepartmentName = null; if (tokens.Length > 5) { mainDepartmentName = tokens[5]; } command = new CreateDepartment(db, tokens[1], tokens[2], tokens[3], tokens[4], mainDepartmentName); break; case "pay-salaries": command = new PaySalaries(db, tokens[1]); break; case "show-employees": command = new ShowEmployees(db, tokens[1]); break; default: throw new ArgumentException("Unknoun command"); } try { Console.Write(command.Execute()); } catch (Exception e) { Console.WriteLine(e.Message); } finally { line = Console.ReadLine(); } } }
public void GetAllReturnsTwoEmployee() { var storage = Substitute.For <IEmployeeStorage>(); var employees = new[] { new Employee(), new Employee() }; storage.GetAll().Returns(employees); var businessCase = new ShowEmployees(storage); var result = businessCase.GetAll(); Assert.IsTrue(result.Count() == 2); }
private void ShowEmployeesExecute() { try { ShowEmployees showEmployees = new ShowEmployees(Manager); showEmployees.Show(); view.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public ShowEmployeesViewModel(ShowEmployees employeeView, tblManager managerLogedIn) { view = employeeView; managerService = new ManagerService(); userService = new UserService(); employeeService = new EmployeeService(); Manager = managerLogedIn; Employee = new vwEmployee2(); EmployeeList = managerService.GetEmployeesOfManager(Manager.ManagerID); //EmployeeList = FilterEmployeesOfManager(EmployeeList); }
private void ShowEmployeesExecute() { try { tblRole currentUserRole = roleService.GetRoleByID((int)currentUser.RoleID); if (currentUserRole.RoleName.Equals("modify")) { ShowEmployees showEmployees = new ShowEmployees(employee); showEmployees.ShowDialog(); } else if (currentUserRole.RoleName.Equals("read-only")) { ShowEmployeesReadOnly showEmployeesReadOnly = new ShowEmployeesReadOnly(); showEmployeesReadOnly.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void ShowEmployees_OnClick(object sender, RoutedEventArgs e) { var showEmployees = new ShowEmployees(_applicationManager.getEmployees()); showEmployees.Show(); }
private void bindDataGrid() { DataContext = new ShowEmployees(grdEmployee); }
private void Button_Click_1(object sender, RoutedEventArgs e) { ShowEmployees showEmployees = new ShowEmployees(); showEmployees.Show(); }