public LogInViewModel(DBContext context) { this.context = context; employeeRepo = EmployeeImpl.getInstance(context); //Employees = new ObservableCollection<Employee>(employeeRepo.getAll()); Employee = new Employee(); }
public override string ToString() { IRepository <Employee> ir = EmployeeImpl.getInstance(new DBContext()); Employee empl = ir.get((int)EmployeeId); return(String.Format("{0} ({1}) {2} {3}[{4} - {5}]", Project, empl, Task, Date.ToString("dd/MM/yyyy"), StartHours, EndHours)); }
public ControlPanelViewModel(DBContext context, Employee empl) { dbContext = context; employeeRepo = EmployeeImpl.getInstance(dbContext); //adminRepo = new AdminImpl(dbContext); projectRepo = ProjectImpl.getInstance(dbContext); reportRepo = ReportImpl.getInstance(dbContext); taskRepo = TaskImpl.getInstance(dbContext); positionRepo = PositionImpl.getInstance(dbContext); levelRepo = LevelImpl.getInstance(dbContext); Employees = new ObservableCollection <Employee>(employeeRepo.getAll().Where(user => user.Role == Role.User)); Admins = new ObservableCollection <Employee>(employeeRepo.getAll().Where(user => user.Role == Role.Admin)); foreach (Employee employee in Employees) { if (employee.PositionId != null) { employee.Position = positionRepo.get((int)employee.PositionId); } } Projects = projectRepo.getAll(); Tasks = taskRepo.getAll(); Levels = levelRepo.getAll(); Positions = new ObservableCollection <Position>(new List <Position>(new Position[] { new Developer(), new HumanResources(), new ProjectManager(), new Tester() })); EmployeeSelectedIndex = -1; AdminSelectedIndex = -1; ProjectSelectedIndex = -1; TaskSelectedIndex = -1; SelectedProject = new Project(); SelectedTask = new Task(); SelectedEmployee = new Employee(); SelectedAdmin = new Employee(); }
public ReportingViewModel(DBContext context, Employee empl) { dbContext = context; employeeRepo = EmployeeImpl.getInstance(dbContext); projectRepo = ProjectImpl.getInstance(dbContext); reportRepo = ReportImpl.getInstance(dbContext); taskRepo = TaskImpl.getInstance(dbContext); currentEmpl = empl; selectedDay = DateTime.Now.Date; setWeekCollection(selectedDay); setWeekRange(selectedDay); SelectedTabIndex = getWeekIndex(selectedDay); SelectedReport = new Report(); if (empl.ProjectId != null) { Project pr = projectRepo.get((int)empl.ProjectId); Projects.Add(pr); Tasks = new ObservableCollection <Task>(taskRepo.getAll().Where(task => task.ProjectId == pr.Id)); } }
public SignUpViewModel(DBContext context) { employeeRepo = EmployeeImpl.getInstance(context); this.context = context; Employee = new Employee(); }