コード例 #1
0
 private void RegisterBtn_click(object sender, RoutedEventArgs e)
 {
     Switcher.Switch(new RegisterScreen());
 }
コード例 #2
0
 private void PreviousPage_Click(object sender, RoutedEventArgs e)
 {
     Switcher.Switch(new HomePageMaterialCommissioner(FullName, AccessLevel, MemberId));
 }
コード例 #3
0
 private void LogoutButton_Click(object sender, RoutedEventArgs e)
 {
     Switcher.Switch(new LoginScreen());
 }
コード例 #4
0
 private void PreviousPage_Click(object sender, RoutedEventArgs e)
 {
     Switcher.Switch(new DamageReportsScreen(FullName, AccessLevel, MemberId));
 }
コード例 #5
0
 private void MyReservations_Click(object sender, RoutedEventArgs e)
 {
     Switcher.Switch(new ReservationsScreen(FullName, AccessLevel, MemberId));
 }
コード例 #6
0
 private void PlaceReservation_Click(object sender, RoutedEventArgs e)
 {
     Switcher.Switch(new MakingReservationSelectBoat(FullName, AccessLevel, MemberId));
 }
コード例 #7
0
 private void Boats_Click(object sender, RoutedEventArgs e)
 {
     Switcher.Switch(new boatOverviewScreen(FullName, AccessLevel, MemberId));
 }
コード例 #8
0
        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));
        }
コード例 #9
0
 private void Hl_Click(object sender, RoutedEventArgs e)
 {
     //when "klik hier" is pressed
     Switcher.Switch(new ReservationsScreen(FullName, AccessLevel, MemberId));
 }