private void DatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
            beginTime.Clear();
            endTime.Clear();

            //reservation button is visible
            ReservationButton.Visibility = Visibility.Visible;

            //clear all data in main stackPanel where the reservations where stored
            mainStackPanel.Children.Clear();

            var sp1 = new StackPanel();
            var tb  = new TextBlock
            {
                Text     = "Dit zijn de reservering die die dag al zijn geplaatst",
                FontSize = 16
            };

            sp1.Children.Add(tb);
            mainStackPanel.Children.Add(sp1);

            //getting the selected date
            selectedDate = DatePicker.SelectedDate.Value;

            //make the timepicker visible
            TimePicker.Visibility = Visibility.Visible;

            //getting the information when sun is coming up and is going down
            SelectedDateTime = DatePicker.SelectedDate.Value;
            var sunInfo = FindSunInfo.GetSunInfo(52.51695742, 6.08367229, SelectedDateTime);

            var sunRise = DateTime.Parse(FindSunInfo.ReturnStringToFormatted(sunInfo.results.sunrise));
            var sunSet  = DateTime.Parse(FindSunInfo.ReturnStringToFormatted(sunInfo.results.sunset));

            InformationSun.Content = $" Er kan van {sunRise.TimeOfDay:hh\\:mm} tot {sunSet.TimeOfDay:hh\\:mm} worden gereserveerd";
            sunUp   = sunRise.TimeOfDay;
            sunDown = sunSet.TimeOfDay;

            using (var context = new BootDB())
            {
                var sv = new ScrollViewer
                {
                    Height = 250,
                    VerticalScrollBarVisibility = ScrollBarVisibility.Auto
                };
                var margin = sv.Margin;
                margin.Right   = 30;
                sv.Margin      = margin;
                sv.MouseWheel += Sv_MouseWheel;

                var sp = new StackPanel();
                foreach (var boat in SelectionList)
                {
                    //getting all reservations for selected date
                    var data1 = (from b in context.Boats
                                 join rb in context.Reservation_Boats
                                 on b.boatId equals rb.boatId
                                 join r in context.Reservations
                                 on rb.reservationId equals r.reservationId
                                 where b.boatId == boat.boatId && r.date == selectedDate
                                 select new
                    {
                        beginTime = r.beginTime,
                        endTime = r.endTime,
                    });
                    var dateTrue = false;

                    //adding all reservations for selected date to screen
                    foreach (var d1 in data1)
                    {
                        beginTime.Add(d1.beginTime);
                        endTime.Add(d1.endTime);
                        var nameTextBlock = new TextBlock
                        {
                            Name         = "txt",
                            Text         = $"{boat.boatName}:",
                            TextWrapping = TextWrapping.Wrap,
                            FontSize     = 14,
                            Background   = new SolidColorBrush(Colors.LightGray),
                            FontStyle    = FontStyles.Italic
                        };

                        var l2 = new Label
                        {
                            Content  = $"- van {d1.beginTime} tot {d1.endTime}",
                            Width    = 400,
                            FontSize = 14
                        };
                        sp.Children.Add(nameTextBlock);
                        sp.Children.Add(l2);
                        dateTrue = true;
                    }

                    //this will be executed when there are no reservation for selected date
                    if (dateTrue)
                    {
                        continue;
                    }
                    {
                        var nameTextBlock = new TextBlock
                        {
                            Name         = "txt",
                            Text         = $"{boat.boatName}:",
                            TextWrapping = TextWrapping.Wrap,
                            FontSize     = 14,
                            Background   = new SolidColorBrush(Colors.LightGray),
                            FontStyle    = FontStyles.Italic
                        };

                        var l2 = new Label
                        {
                            Content  = $"Er zijn nog geen reserveringen",
                            Width    = 400,
                            FontSize = 14
                        };
                        sp.Children.Add(nameTextBlock);
                        sp.Children.Add(l2);
                    }
                }
                sv.Content = sp;
                mainStackPanel.Children.Add(sv);
            }
        }
        private void DatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
            BeginTime.Clear();
            EndTime.Clear();

            //reservation button is visible
            ReservationButton.Visibility = Visibility.Visible;
            ReservationButton.Visibility = Visibility.Visible;

            //clear all data in mainstackpanel where the reservations where stored
            mainStackPanel.Children.Clear();

            var sp1 = new StackPanel();
            var tb  = new TextBlock();

            tb.Text     = "Dit zijn de reservering die die dag al zijn geplaatst";
            tb.FontSize = 16;
            sp1.Children.Add(tb);
            mainStackPanel.Children.Add(sp1);

            //getting the selected date
            SelectedDate = DatePicker.SelectedDate.Value;

            //make the timePicker visible
            TimePicker.Visibility = Visibility.Visible;

            //getting the information when sun is coming up and is going down
            SelectedDateTime = DatePicker.SelectedDate.Value;
            var sunInfo = FindSunInfo.GetSunInfo(52.51695742, 6.08367229, SelectedDateTime);

            var dateSunUp   = DateTime.Parse(FindSunInfo.ReturnStringToFormatted(sunInfo.results.sunrise));
            var dateSunDown = DateTime.Parse(FindSunInfo.ReturnStringToFormatted(sunInfo.results.sunset));

            InformationSun.Content     = $"Er kan van {dateSunUp.ToString(@"HH\:mm")} tot {dateSunDown.ToString(@"HH\:mm")} worden gereserveerd";
            ReservationMinHour.Content = "De boot moet minimaal een uur worden gereserveerd en mag maximaal twee uur gereserveerd worden";
            SunUp   = dateSunUp.TimeOfDay;
            SunDown = dateSunDown.TimeOfDay;

            using (var context = new BootDB())
            {
                //getting all reservations for selected date
                var data1 = (from b in context.Boats
                             join rb in context.Reservation_Boats
                             on b.boatId equals rb.boatId
                             join r in context.Reservations
                             on rb.reservationId equals r.reservationId
                             where b.boatId == BoatId && r.date == SelectedDate
                             select new
                {
                    beginTime = r.beginTime,
                    endTime = r.endTime,
                });
                var dateTrue = false;

                //adding all reservations for selected date to screen
                foreach (var d1 in data1)
                {
                    BeginTime.Add(d1.beginTime);
                    EndTime.Add(d1.endTime);
                    var sp = new StackPanel();
                    var l  = new Label
                    {
                        Content  = $"- van {d1.beginTime.ToString(@"hh\:mm")} tot {d1.endTime.ToString(@"hh\:mm")}",
                        Width    = 400,
                        Height   = 40,
                        FontSize = 14
                    };
                    sp.Children.Add(l);
                    mainStackPanel.Children.Add(sp);
                    dateTrue = true;
                }

                //this will be executed when there are no reservation for selected date
                if (dateTrue == false)
                {
                    var sp = new StackPanel();
                    var l  = new Label
                    {
                        Content  = $"Er zijn nog geen reserveringen",
                        Width    = 400,
                        FontSize = 14
                    };

                    sp.Children.Add(l);
                    mainStackPanel.Children.Add(sp);
                    dateTrue = true;
                }
            }
        }