private void Bar_MouseUp(object sender, MouseButtonEventArgs e)
        {
            var rDate = DateTime.Now.Date;

            if (Dp_DatePicker.SelectedDate != null)
            {
                rDate = (DateTime)Dp_DatePicker.SelectedDate;
            }
            if (!App.isDateTimeIsPast(rDate))
            {
                var resID = (sender as Label).Tag.ToString();

                //status isActive
                var r_by_name = (from r in App.reservedTables where r.ReservationId.Equals(Int32.Parse(resID)) && r.IsActive == 1 select r).FirstOrDefault();
                if (r_by_name != null & !App.IsEditReservationOpen)
                {
                    var editReservation = new EditReservation(r_by_name)
                    {
                        Owner = this
                    };
                    editReservation.Show();
                }
            }

            e.Handled = true;
        }
        private void Btn_Search_Click(object sender, RoutedEventArgs e)
        {
            if (Dtp_reservation_date.SelectedDate == null)
            {
                if (Cbx_guest_number.Text.Equals(".") & Dtp_reservation_date.SelectedDate == null & Cbx_reservation_hours.Text.Equals("Hrs")
                    & Cbx_reservation_minute.Text.Equals("Min") & !string.IsNullOrEmpty(Tbx_reservation_name.Text))
                {
                    var r_by_name = (from r in App.reservedTables where r.GuestName.Equals(Tbx_reservation_name.Text) && r.IsActive == 1 select r).FirstOrDefault();
                    if (r_by_name != null & !App.IsEditReservationOpen)
                    {
                        var editReservation = new EditReservation(r_by_name)
                        {
                            Owner = this
                        };
                        editReservation.Show();
                    }
                    else
                    {
                        MessageBox.Show("No Reservation by Name " + Tbx_reservation_name.Text, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
            }
            else
            {
                if (!Cbx_guest_number.Text.Equals(".") & Dtp_reservation_date.SelectedDate != null & !Cbx_reservation_hours.Text.Equals("Hrs")
                    & !Cbx_reservation_minute.Text.Equals("Min") & string.IsNullOrEmpty(Tbx_reservation_name.Text))
                {
                    if (!App.isDateTimeIsPast(ipDate: (DateTime)Dtp_reservation_date.SelectedDate, time: (int.Parse(Cbx_reservation_hours.Text) * 100) + int.Parse(Cbx_reservation_minute.Text)))
                    {
                        int et_startTime = Int32.Parse(Cbx_reservation_hours.Text) * 100 + Int32.Parse(Cbx_reservation_minute.Text);
                        int et_endtime   = ((Int32.Parse(Cbx_reservation_hours.Text) + 1) * 100) + Int32.Parse(Cbx_reservation_minute.Text);


                        if (et_endtime <= 2300)
                        {
                            var booked_tables = (from et in App.reservedTables
                                                 where
                                                 et.ReservationDate.Date.Equals((DateTime)Dtp_reservation_date.SelectedDate) &&
                                                 ((et_endtime > et.StartTime && et_endtime < et.EndTime) || (et_startTime > et.StartTime && et_startTime < et.EndTime)) &&
                                                 et.IsActive == 1
                                                 select et.TableId).ToList();
                            // todo check if time overlapps
                            var empty_tables = App.tables.Where(i => !booked_tables.Contains(i.TableId) && i.TableCapacity >= Int32.Parse(Cbx_guest_number.Text));

                            if (empty_tables.Count() > 0 & !App.IsMakeNewReservationOpen)
                            {
                                ReservationDetails newReservation = new ReservationDetails
                                {
                                    NumberOfGuest   = Int32.Parse(Cbx_guest_number.Text),
                                    ReservationDate = (DateTime)Dtp_reservation_date.SelectedDate,
                                    StartTime       = Int32.Parse(Cbx_reservation_hours.Text) * 100 + Int32.Parse(Cbx_reservation_minute.Text),
                                    EndTime         = ((Int32.Parse(Cbx_reservation_hours.Text) + 1) * 100) + Int32.Parse(Cbx_reservation_minute.Text),
                                    IsActive        = 1
                                };

                                var newReservationWindow = new makeNewReservation(newReservation, empty_tables)
                                {
                                    Owner = this
                                };
                                newReservationWindow.Show();
                            }
                        }
                        else
                        {
                            MessageBox.Show("No Tables Availiable", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                }

                if (Cbx_guest_number.Text.Equals(".") & Dtp_reservation_date.SelectedDate != null & Cbx_reservation_hours.Text.Equals("Hrs")
                    & Cbx_reservation_minute.Text.Equals("Min") & !string.IsNullOrEmpty(Tbx_reservation_name.Text))
                {
                    var r_by_name_n_Date = (from r in App.reservedTables
                                            where r.GuestName.Equals(Tbx_reservation_name.Text) &&
                                            r.ReservationDate.Date.Equals((DateTime)Dtp_reservation_date.SelectedDate) &&
                                            r.IsActive == 1
                                            select r).FirstOrDefault();
                    if (r_by_name_n_Date != null & !App.IsEditReservationOpen)
                    {
                        var editReservation = new EditReservation(r_by_name_n_Date)
                        {
                            Owner = this
                        };
                        editReservation.Show();
                    }
                    else
                    {
                        MessageBox.Show("No Reservation by Name " + Tbx_reservation_name.Text, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
            }
        }