private void GetMechanicInfo(Mechanic mechanic) { tbFirstNameToChange.Watermark = mechanic.FirstName; tbLastNameToChange.Watermark = mechanic.LastName; dpDateOfBirthToChange.SelectedDate = mechanic.DateOfBirth; dpDateOfEmploymentToChange.SelectedDate = mechanic.DateOfEmployment; lbMechanicCompetences2.ItemsSource = mechanic.Competences; lbCompetences2.ItemsSource = _mechanicService.GetRemainingCompetences(mechanic); var user = _userService.GetAssignedUserFromMechanic(mechanic); tbUserID.Text = user != null ? user.Username : "******"; var errands = _errandService.GetMechanicErrands(mechanic); cbCurrentErrands.ItemsSource = errands.Where(x => x.ErrandStatus == ErrandStatus.Gul); cbFinishedErrands.ItemsSource = errands.Where(x => x.ErrandStatus == ErrandStatus.Grön); }
private void RefreshLists() { _dbErrands = new UserDataAccess <Errand>(); _dbMechanics = new UserDataAccess <Mechanic>(); _dbCars = new UserDataAccess <Car>(); _dbMotorCycles = new UserDataAccess <Motorcycle>(); _dbBuses = new UserDataAccess <Bus>(); _dbTrucks = new UserDataAccess <Truck>(); db.Cars = _dbCars.LoadList(); db.Motorcycles = _dbMotorCycles.LoadList(); db.Buses = _dbBuses.LoadList(); db.Trucks = _dbTrucks.LoadList(); db.CurrentMechanics = _dbMechanics.LoadCurrentMechanics(); db.Errands = _dbErrands.LoadList(); LoggedInUserService.Mechanic = db.CurrentMechanics.FirstOrDefault(x => x.UserID == LoggedInUserService.User.ID); var errands = _errandService.GetMechanicErrands(LoggedInUserService.Mechanic); cbPågående.ItemsSource = errands.Where(x => x.ErrandStatus == ErrandStatus.Gul); cbKlara.ItemsSource = errands.Where(x => x.ErrandStatus == ErrandStatus.Grön); }