private void MyReservations_Click(object sender, RoutedEventArgs e) { Switcher.Switch(new ReservationsScreen(FullName, AccessLevel, MemberId)); }
private void Boats_Click(object sender, RoutedEventArgs e) { Switcher.Switch(new boatOverviewScreen(FullName, AccessLevel, MemberId)); }
private void PlaceReservation_Click(object sender, RoutedEventArgs e) { Switcher.Switch(new MakingReservationSelectBoat(FullName, AccessLevel, MemberId)); }
private void LogoutButton_Click(object sender, RoutedEventArgs e) { Switcher.Logout(); }
private void BackToHomePage_Click(object sender, RoutedEventArgs e) { Switcher.BackToHomePage(AccessLevel, FullName, MemberId); }
private void PreviousPage_Click(object sender, RoutedEventArgs e) { Switcher.Switch(new DamageReportsScreen(FullName, AccessLevel, MemberId)); }
private void InMaintenance_Click(object sender, RoutedEventArgs e) { var valid = true; var from = DatePicker.SelectedDate; var until = DatePickerUntil.SelectedDate; //start date is not empty if (from == null) { valid = false; MessageBox.Show("Vult u de start datum in."); } else if (until == null) //end date is not empty { valid = false; MessageBox.Show("Vult u de eind datum in."); } else if (from > until) //startDate > endDates { valid = false; MessageBox.Show("Start datum mag niet voorbij eind datum zijn."); } //save to boatMaintenance if (!valid) { return; } int insertId; //set endDate time to 23:59:59 from day var now = (DateTime)until; var newUntil = now.AddHours(23).AddMinutes(59).AddSeconds(59); using (var context = new BootDB()) { var inmain = new BoatInMaintenances() { boatId = this.BoatID, startDate = @from, endDate = newUntil }; //save to boat in maintenances context.BoatInMaintenances.Add(inmain); context.SaveChanges(); insertId = inmain.boatInMaintenanceId; //find reservation id int reservId; var query = context.Reservations .FirstOrDefault(x => x.memberId == MemberId && x.date >= @from && x.date <= newUntil); if (query != null) { reservId = query.reservationId; //remove records from reservations context.Reservations.RemoveRange(context.Reservations.Where(x => x.reservationId == reservId && x.memberId == MemberId)); //remove records from Resevervation_boats context.Reservation_Boats.RemoveRange(context.Reservation_Boats.Where(x => x.reservationId == reservId)); context.SaveChanges(); } } MessageBox.Show($"Boot \"{BoatName}\" is in onderhoud genomen van {@from?.ToString("dd-MM-yyyy")} t/m {until?.ToString("dd-MM-yyyy")}."); Switcher.Switch(new DamageReportsScreen(FullName, AccessLevel, MemberId)); }
private void Hl_Click(object sender, RoutedEventArgs e) { //when "klik hier" is pressed Switcher.Switch(new ReservationsScreen(FullName, AccessLevel, MemberId)); }