Esempio n. 1
0
        private void btnLeftArrow_Click(object sender, RoutedEventArgs e)
        {
            if (lbCompetences.SelectedItem != null)
            {
                VehiclePart competence = (VehiclePart)lbCompetences.SelectedItem;
                _mechanicService.AddCompetence(LoggedInUserService.Mechanic, competence);

                lbMechanicCompetences.Items.Refresh();
                lbCompetences.ItemsSource = _mechanicService.GetRemainingCompetences(LoggedInUserService.Mechanic);
                _dbMechanics.SaveMechanicList(db.CurrentMechanics, "CurrentMechanics.json");
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        public UserHomePage()
        {
            InitializeComponent();

            _mechanicService = new MechanicService();
            _vehicleService  = new VehicleService();
            _errandService   = new ErrandService();
            RefreshLists();



            lbMechanicCompetences.ItemsSource = LoggedInUserService.Mechanic.Competences;
            lbCompetences.ItemsSource         = _mechanicService.GetRemainingCompetences(LoggedInUserService.Mechanic);

            lblHeader.Content = $"Välkommen {LoggedInUserService.Mechanic.FirstName}!";
            lblToday.Content  = DateTime.Now.ToShortDateString();
        }