private void Row_ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.Rows_combo.Items.Count != 0)
            {
                this.Seat_combo.Items.Clear();
                string sqlDateString = ShowingsClass.formatDateTimeToSqlLiteDateString((DateTime)SelectDate_Booking.SelectedDate);
                int    showingId     = ShowingsClass.getShowingIdByDate(sqlDateString);

                if (UpperCircle_radio.IsChecked == true)
                {
                    dataSet = SeatsClass.getAllAvailableNumbersByAreaRowShowingId(showingId, "UpperCircle", this.Rows_combo.SelectedValue.ToString());
                    fillNumberDropDown(dataSet);
                }
                else if (DressCircle_radio.IsChecked == true)
                {
                    dataSet = SeatsClass.getAllAvailableNumbersByAreaRowShowingId(showingId, "DressCircle", this.Rows_combo.SelectedValue.ToString());
                    fillNumberDropDown(dataSet);
                }
                else
                {
                    dataSet = SeatsClass.getAllAvailableNumbersByAreaRowShowingId(showingId, "Stall", this.Rows_combo.SelectedValue.ToString());
                    fillNumberDropDown(dataSet);
                }
            }
        }
        public void testDeleteBooking()
        {
            SeatBookingClass        booking1        = new SeatBookingClass("Stall", "M", 5, 1);
            List <SeatBookingClass> SeatsToBookList = new List <SeatBookingClass>();

            SeatsToBookList.Add(booking1);
            BookingsClass.newBooking(1, "2017-06-28 12:00", 0, SeatsToBookList);

            SeatBookingClass booking2 = new SeatBookingClass("Stall", "M", 6, 1);

            SeatsToBookList[0] = booking2;
            BookingsClass.newBooking(2, "2017-06-27 12:00", 0, SeatsToBookList);

            BookingsClass.deleteBooking(2);
            dataSet = BookingsClass.getBookingDetailsById(2);
            int actualBookingRowCount   = dataSet.Tables[0].Rows.Count;
            int expectedBookingRowCount = 0;

            dataSet = SeatsClass.getSeatDetails("Stall", "M", 5, 1);
            int actualSeatBookingId  = int.Parse(dataSet.Tables[0].Rows[0]["booking_Id"].ToString());
            int epectedSeatBookingId = 0;

            Assert.AreEqual(expectedBookingRowCount, actualBookingRowCount);
            Assert.AreEqual(epectedSeatBookingId, actualSeatBookingId);
        }
        private void Generate1_button_Click(object sender, RoutedEventArgs e)
        {
            DataSet dataSet = SeatsClass.seatsSoldUnsold();

            this.Report_txt.ItemsSource           = dataSet.Tables[0].DefaultView;
            this.Report_txt.Columns[0].Visibility = Visibility.Collapsed;
            this.Report_txt.Columns[1].Visibility = Visibility.Collapsed;
        }
 private void Stalls_radio_Checked(object sender, RoutedEventArgs e)
 {
     if (ChoosePlay_combo.Items.Count == 0)
     {
         MessageBox.Show("Please search for a showing before selecting seats");
     }
     else
     {
         this.Rows_combo.Items.Clear();
         this.UpperCircle_radio.IsChecked = false;
         this.DressCircle_radio.IsChecked = false;
         string sqlDateString = ShowingsClass.formatDateTimeToSqlLiteDateString((DateTime)SelectDate_Booking.SelectedDate);
         int    showingId     = ShowingsClass.getShowingIdByDate(sqlDateString);
         dataSet = SeatsClass.getAllAvailableRowByAreaShowingId(showingId, "Stall");
         int numberOfSeatsLeftForArea = SeatsClass.getNumOfSeatsLeftInAreaForShowing(showingId, "Stall");
         this.SeatsRemaining_lbl.Content = "Seats remaining: " + numberOfSeatsLeftForArea;
         fillRowDropDown(dataSet);
     }
 }
        public void testDeleteShowing()
        {
            dataSet = ShowingsClass.deleteShowing(2);

            string actualEmail   = dataSet.Tables[0].Rows[0]["Email"].ToString();
            string expectedEmail = "*****@*****.**";

            dataSet = SeatsClass.getSeatDetails("Stall", "M", 5, 2);
            int actualRowCountSeats   = dataSet.Tables[0].Rows.Count;
            int expectedRowCountSeats = 0;

            dataSet = BookingsClass.getBookingDetailsById(1);
            int actualRowCountBookings   = dataSet.Tables[0].Rows.Count;
            int expectedRowCountBookings = 0;

            Assert.AreEqual(expectedRowCountSeats, actualRowCountSeats);
            Assert.AreEqual(expectedEmail, actualEmail);
            Assert.AreEqual(expectedRowCountBookings, actualRowCountBookings);
        }
        public void testAddBooking()
        {
            SeatBookingClass        booking1        = new SeatBookingClass("Stall", "M", 5, 2);
            List <SeatBookingClass> SeatsToBookList = new List <SeatBookingClass>();

            SeatsToBookList.Add(booking1);
            BookingsClass.newBooking(2, "2017-06-20 12:00", 0, SeatsToBookList);

            dataSet = BookingsClass.getBookingDetailsById(1);

            int    actualCustomerId  = int.Parse(dataSet.Tables[0].Rows[0]["Customer_Id"].ToString());
            string actualBookingDate = dataSet.Tables[0].Rows[0]["Date_Of_Booking"].ToString();
            int    actualPaid        = int.Parse(dataSet.Tables[0].Rows[0]["Paid"].ToString());

            dataSet = SeatsClass.getAllSeatsForBooking(1);

            string actualSection   = dataSet.Tables[0].Rows[0]["Section"].ToString();
            string actualRow       = dataSet.Tables[0].Rows[0]["Row"].ToString();
            int    actualNumber    = int.Parse(dataSet.Tables[0].Rows[0]["Number"].ToString());
            int    actualShowingId = int.Parse(dataSet.Tables[0].Rows[0]["Showing_Id"].ToString());
            int    actualBookingId = int.Parse(dataSet.Tables[0].Rows[0]["Booking_Id"].ToString());

            int    expectedCustomerId  = 2;
            string expectedBookingDate = "2017-06-20 12:00";
            int    expectedPaid        = 0;
            string expectedSection     = "Stall";
            string expectedRow         = "M";
            int    expectedNumber      = 5;
            int    expectedShowingId   = 2;
            int    expectedBookingId   = 1;

            Assert.AreEqual(expectedCustomerId, actualCustomerId);
            Assert.AreEqual(expectedBookingDate, actualBookingDate);
            Assert.AreEqual(expectedPaid, actualPaid);
            Assert.AreEqual(expectedSection, actualSection);
            Assert.AreEqual(expectedRow, actualRow);
            Assert.AreEqual(expectedNumber, actualNumber);
            Assert.AreEqual(expectedShowingId, actualShowingId);
            Assert.AreEqual(expectedBookingId, actualBookingId);
        }