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);
                }
            }
        }
Beispiel #2
0
        private void EditShowing_button_Click(object sender, RoutedEventArgs e)
        {
            if (SelectDate_EditDelShow.SelectedDate == null)
            {
                MessageBox.Show("Please select a date for the required showing");
            }
            else
            {
                int    showingId       = ShowingsClass.getShowingIdByDate(ShowingsClass.formatDateTimeToSqlLiteDateString((DateTime)SelectDate_EditDelShow.SelectedDate));
                string startTime       = this.TimeOfShowing_EditDeleteShowing_txt.Text;
                string timeToBeChecked = ValidationClass.TimeChecker(startTime);

                if (timeToBeChecked != null)
                {
                    MessageBox.Show(timeToBeChecked);
                }
                else
                {
                    double upperCirclePrice = double.Parse(this.UpperCircle_EditDelShow_txt.Text);
                    string priceToBeChecked = UpperCircle_EditDelShow_txt.Text.ToString();
                    priceToBeChecked = ValidationClass.FloatChecker(priceToBeChecked);
                    if (priceToBeChecked != null)
                    {
                        MessageBox.Show(priceToBeChecked);
                    }
                    else
                    {
                        double dressCirclePrice = double.Parse(this.DressCircle_EditDelShow_txt.Text);
                        priceToBeChecked = DressCircle_EditDelShow_txt.Text.ToString();
                        priceToBeChecked = ValidationClass.FloatChecker(priceToBeChecked);
                        if (priceToBeChecked != null)
                        {
                            MessageBox.Show(priceToBeChecked);
                        }
                        else
                        {
                            double stallPrice = double.Parse(this.Stalls_EditDelShow_txt.Text);
                            priceToBeChecked = Stalls_EditDelShow_txt.Text.ToString();
                            priceToBeChecked = ValidationClass.FloatChecker(priceToBeChecked);
                            if (priceToBeChecked != null)
                            {
                                MessageBox.Show(priceToBeChecked);
                            }
                            else
                            {
                                dataSet = ShowingsClass.getShowingByShowingId(showingId);
                                string unedditedSqlDateTimeString = dataSet.Tables[0].Rows[0]["Date"].ToString();
                                string newDateTimeSqlString       = ShowingsClass.replaceSqlDateTimeWithNewTime(unedditedSqlDateTimeString, startTime);
                                ShowingsClass.editShowingDetails(showingId, newDateTimeSqlString, upperCirclePrice, dressCirclePrice, stallPrice);
                                MessageBox.Show("Showing edited");
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
        //-----------------------------------Add Showing ---------------------------------//

        //--------------------------------Edit/Delete Showing-----------------------------//
        private void SelectDate_EditDelShow_SelectionDateChanged(object sender, RoutedEventArgs e)
        {
            if (SelectDate_EditDelShow.SelectedDate != null)
            {
                int showingId = ShowingsClass.getShowingIdByDate(ShowingsClass.formatDateTimeToSqlLiteDateString((DateTime)SelectDate_EditDelShow.SelectedDate));
                dataSet = ShowingsClass.getShowingByShowingId(showingId);

                string dateTime = dataSet.Tables[0].Rows[0]["Date"].ToString();
                this.TimeOfShowing_EditDeleteShowing_txt.Text = ShowingsClass.getTimeFromSqlDateSting(dateTime);
                this.UpperCircle_EditDelShow_txt.Text         = dataSet.Tables[0].Rows[0]["UpperCirclePrice"].ToString();
                this.DressCircle_EditDelShow_txt.Text         = dataSet.Tables[0].Rows[0]["DressCirclePrice"].ToString();
                this.Stalls_EditDelShow_txt.Text = dataSet.Tables[0].Rows[0]["StallsPrice"].ToString();
            }
        }
 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);
     }
 }
 private void BookPlay_button_Click(object sender, RoutedEventArgs e)
 {
     if (ChoosePlay_combo.Items.Count == 0)
     {
         MessageBox.Show("Please select a showing and fill out all other fields before selecting 'Add to Basket");
     }
     else
     {
         string sqlDateString = ShowingsClass.formatDateTimeToSqlLiteDateString((DateTime)SelectDate_Booking.SelectedDate);
         int    showingId     = ShowingsClass.getShowingIdByDate(sqlDateString);
         int    customerId    = int.Parse(this.Surname_Booking_Combo.SelectedValue.ToString());
         List <SeatBookingClass> seatBookingList = new List <SeatBookingClass>();
         foreach (DataRow row in seatBookingsDataset.Rows)
         {
             SeatBookingClass seatBookingObj = new SeatBookingClass(row["Section"].ToString(), row["Row"].ToString(), int.Parse(row["Number"].ToString()), showingId);
             seatBookingList.Add(seatBookingObj);
         }
         //int pCustomerId, string pDate, int pPaid, List<SeatBookingClass> SeatsToBookList
         BookingsClass.newBooking(customerId, ShowingsClass.formatDateTimeToSqlLiteDateString(DateTime.Now), 0, seatBookingList);
         MessageBox.Show("New booking added");
     }
 }
Beispiel #6
0
 private void DeleteShowing_button_Click(object sender, RoutedEventArgs e)
 {
     if (SelectDate_EditDelShow.SelectedDate == null)
     {
         MessageBox.Show("Please select a date for the required showing");
     }
     else
     {
         MessageBoxResult messageBoxResult = MessageBox.Show("Are you sure?", "Delete Confirmation", MessageBoxButton.YesNo);
         if (messageBoxResult == MessageBoxResult.Yes)
         {
             ShowingsClass.deleteShowing(ShowingsClass.getShowingIdByDate(ShowingsClass.formatDateTimeToSqlLiteDateString((DateTime)SelectDate_EditDelShow.SelectedDate)));
             MessageBox.Show("Showing deleted");
             this.Close();
             BookingOfficerWindow newBookingOfficerWindow = new BookingOfficerWindow();
             newBookingOfficerWindow.Show();
             //fillDatePicker(this.SelectDate_EditDelShow);
         }
         else
         {
             MessageBox.Show("Delete cancelled");
         }
     }
 }
        private void AddToBasket_button_Click(object sender, RoutedEventArgs e)
        {
            if (ChoosePlay_combo.Items.Count == 0)
            {
                MessageBox.Show("Please Choose a play");
            }
            else
            {
                if (SelectDate_Booking.SelectedDate == null)
                {
                    MessageBox.Show("Please enter a showing date");
                }
                else
                {
                    if (UpperCircle_radio.IsChecked == false && DressCircle_radio.IsChecked == false && Stalls_radio.IsChecked == false)
                    {
                        MessageBox.Show("Please check a seating area");
                    }
                    else
                    {
                        if (Rows_combo.SelectedValue == null)
                        {
                            MessageBox.Show("Please select a seat row");
                        }
                        else
                        {
                            if (Seat_combo.SelectedValue == null)
                            {
                                MessageBox.Show("Please select a seat number");
                            }
                            else
                            {
                                string area;

                                if (UpperCircle_radio.IsChecked == true)
                                {
                                    area = "UpperCircle";
                                }
                                else if (DressCircle_radio.IsChecked == true)
                                {
                                    area = "DressCircle";
                                }
                                else
                                {
                                    area = "Stall";
                                }

                                string sqlDateString = ShowingsClass.formatDateTimeToSqlLiteDateString((DateTime)SelectDate_Booking.SelectedDate);
                                int    showingId     = ShowingsClass.getShowingIdByDate(sqlDateString);

                                string row = this.Rows_combo.SelectedValue.ToString();
                                int    num = int.Parse(this.Seat_combo.SelectedValue.ToString());

                                //DataRow rowCheck = seatBookingsDataset.NewRow();
                                //rowCheck["Section"] = area;
                                //rowCheck["Row"] = row;
                                //rowCheck["Number"] = num;
                                bool cannAddToBasket = true;
                                foreach (DataRow loopRow in seatBookingsDataset.Rows)
                                {
                                    if (loopRow["Section"].ToString() == area && loopRow["Row"].ToString() == row && int.Parse(loopRow["Number"].ToString()) == num)
                                    {
                                        cannAddToBasket = false;
                                    }
                                }
                                if (cannAddToBasket == false)
                                {
                                    MessageBox.Show("Seat already in basket");
                                }
                                else
                                {
                                    if (seatBookingsDataset.Rows.Count < 6)
                                    {
                                        seatBookingsDataset.Rows.Add(area, row, num);
                                        this.UpperCircle_radio.IsChecked = false;
                                        this.DressCircle_radio.IsChecked = false;
                                        this.Stalls_radio.IsChecked      = false;
                                        this.Rows_combo.Items.Clear();
                                        this.Seat_combo.Items.Clear();
                                    }
                                }

                                //SeatBookingClass seatBookingObj = new SeatBookingClass(area, row, num, showingId);
                            }
                        }
                    }
                }
            }
        }