private void btnShowClosedErrands_Click(object sender, RoutedEventArgs e) { lvShowErrands.ItemsSource = ErrandService.GetCompletedErrands((Application.Current as App).connectionString) .OrderByDescending(i => i.CreationTime) .Take(SettingsContext.GetMaxItemsCount()) .ToList(); }
private void btnOpen_Click(object sender, RoutedEventArgs e) { lvActive.ItemsSource = ErrandService.GetErrandsActive((Application.Current as App) .connectionString).Take(Views.Settings.SetItemsMax()) .OrderBy(i => i.CreationTime) .OrderByDescending(i => i.Id); }
public NewErrandPage() { InitializeComponent(); _errandservice = new ErrandService(); _errand = new Errand(); //Binder sidans datakontext till ett ärende this.DataContext = _errand; }
private void btnCreate_Click(object sender, RoutedEventArgs e) { try { ErrandService.CreateErrandAsync(Description.Text, DateTime.Now, FirstName.Text, LastName.Text, Email.Text, Convert.ToInt32(Phonenumber.Text), GetStatus(), GetCategory(), CreatedBy.Text).GetAwaiter(); createlabel.Visibility = Visibility.Visible; } catch { } }
public ErrandStatus() { _userservice = new UserService(); InitializeComponent(); _errandservice = new ErrandService(); _mechanicService = new MechanicService(); Errands.ItemsSource = _errandservice.OnGoingErrands(); FinishedErrands.ItemsSource = _errandservice.FinishedErrands(); }
private void btnUpdate_Click(object sender, RoutedEventArgs e) { try { ErrandService.UpdateErrandAsync(Convert.ToInt32(idLoad.Text), UpdateStatus(), Comment()).GetAwaiter(); updatelabel.Visibility = Visibility.Visible; } catch { } }
public ErrandPageAdmin() { ErrandService es = new ErrandService(); if (es.UnassignedErrands() == null) { ErrandMechanic.IsEnabled = false; } InitializeComponent(); }
private async void btnUpdateErrandStatus_Click(object sender, RoutedEventArgs e) { try { ErrandService.UpdateErrandAsync(Convert.ToInt32(tbidLoad.Text), UpdateStatus()).GetAwaiter(); } catch { string message = "Something went wrong"; MessageDialog msgdialog = new MessageDialog(message, "Error Message"); await msgdialog.ShowAsync(); } }
public ErrandMechanic() { _errandservice = new ErrandService(); InitializeComponent(); ErrandList.ItemsSource = _errandservice.UnassignedErrands(); if (ErrandList.Items.Count == 0) { AddMechanic.IsEnabled = false; ErrandList.IsEnabled = false; MechanicList.IsEnabled = false; var noErrand = new string[] { "Det finns inga ärenden utan mekaniker" }; ErrandList.ItemsSource = noErrand; } }
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(); }
private async Task RefreshLists() { _dbMechanics = new UserDataAccess <Mechanic>(); _dbErrands = new UserDataAccess <Errand>(); _mechanicService = new MechanicService(); _errandService = new ErrandService(); db.Errands = await _dbErrands.LoadListAsync(); db.CurrentMechanics = _dbMechanics.LoadCurrentMechanics(); lbErrands.ItemsSource = db.Errands.Where(x => x.ErrandStatus == ErrandStatus.Röd); lbBirthdays.ItemsSource = db.CurrentMechanics.Where(x => _mechanicService.IsBirthday(x) == true).ToList(); lbErrands.Items.Refresh(); lbBirthdays.Items.Refresh(); lblTodaysDate.Content = DateTime.Now.ToShortDateString(); }
//private readonly UserDataAccess<Errand> _dbErrands; public ErrandsPage() { InitializeComponent(); _dbErrands = new UserDataAccess <Errand>(); _dbCars = new UserDataAccess <Car>(); _dbMotorCycles = new UserDataAccess <Motorcycle>(); _dbBuses = new UserDataAccess <Bus>(); _dbTrucks = new UserDataAccess <Truck>(); _dbCurrentMechanics = new UserDataAccess <Mechanic>(); _mechanicService = new MechanicService(); _vehicleService = new VehicleService(); _vehicleService = new VehicleService(); _errandService = new ErrandService(); cbFuelType.ItemsSource = _fuelType; cbProblem.ItemsSource = _vehicleParts; cbCarType.ItemsSource = _carTypes; UpdateErrandPage(); }
public MechanicPage() { InitializeComponent(); _mechanicService = new MechanicService(); _userService = new UserService(); _errandService = new ErrandService(); _vehicleService = new VehicleService(); _dbCars = new UserDataAccess <Car>(); _dbMotorCycles = new UserDataAccess <Motorcycle>(); _dbBuses = new UserDataAccess <Bus>(); _dbTrucks = new UserDataAccess <Truck>(); _mechanicCompetences = new List <VehiclePart>(); _competences = new List <VehiclePart>(); _dbMechanics = new UserDataAccess <Mechanic>(); _dbErrands = new UserDataAccess <Errand>(); UpdateAddMechanicPage(); lbMechanicCompetences.ItemsSource = _mechanicCompetences; lbCompetences.ItemsSource = _competences; }
private void btnClosed_Click(object sender, RoutedEventArgs e) { lvClosed.ItemsSource = ErrandService.GetErrandsClosed((Application.Current as App) .connectionString).Take(Views.Settings.SetItemsMax()); }
public ErrandManager(string conn) { errandService = new ErrandService(conn); voucherService = new VoucherService(conn); }
private void btnClosed_Click(object sender, RoutedEventArgs e) { lvActive.ItemsSource = ErrandService.GetErrandsClosed((Application.Current as App).connectionString); }