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);
                }
            }
        }
Esempio n. 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");
                            }
                        }
                    }
                }
            }
        }
Esempio n. 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");
     }
 }
Esempio n. 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 UpgradeMember_button_Click(object sender, RoutedEventArgs e)
        {
            if (SurnameSearch_UpgradeMember_combo.Items.Count == 0)
            {
                MessageBox.Show("Please enter a customer name to search for");
            }
            else
            {
                int chosenCustomerID = int.Parse(this.SurnameSearch_UpgradeMember_combo.SelectedValue.ToString());
                dataSet = CustomerClass.getCustomerById(chosenCustomerID);

                CustomerClass.editCustomerDetails(chosenCustomerID, dataSet.Tables[0].Rows[0]["First_Name"].ToString(), dataSet.Tables[0].Rows[0]["Last_Name"].ToString(), dataSet.Tables[0].Rows[0]["Email"].ToString(), ShowingsClass.formatDateTimeToSqlLiteDateString(DateTime.Now.AddMonths(12)));
                MessageBox.Show("Customer changed to gold club member");
            }
        }
        //---------------------------------------------- Add Member Tab ------------------------------------------------------//
        private void CreateMember_button_Click(object sender, RoutedEventArgs e)
        {
            string mFirstName = Forename_AddMember_txt.Text.ToString();

            if (mFirstName.Length == 0)
            {
                MessageBox.Show("Please enter a Forename");
            }
            else
            {
                string stringToBeChecked = ValidationClass.HasNumbersInStringChecker(mFirstName);
                if (stringToBeChecked != null)
                {
                    MessageBox.Show("Forename cannot contain numbers");
                }
                else
                {
                    string mLastName = Surname_AddMember_txt.Text.ToString();
                    if (mLastName.Length == 0)
                    {
                        MessageBox.Show("Please enter a Surname");
                    }
                    else
                    {
                        stringToBeChecked = ValidationClass.HasNumbersInStringChecker(mLastName);
                        if (stringToBeChecked != null)
                        {
                            MessageBox.Show("Surname cannot contain numbers");
                        }
                        else
                        {
                            string mEmail = Email_AddMember_txt.Text.ToString();
                            if (mEmail.Length == 0)
                            {
                                MessageBox.Show("Please enter an Email");
                            }
                            else
                            {
                                if (CustomerClass.checkIfEmailExits(mEmail) == true)
                                {
                                    MessageBox.Show("This email already exists - Please enter another email");
                                }
                                else
                                {
                                    if (GoldMember_checkbox.IsChecked == true)
                                    {
                                        var    currentTime           = ShowingsClass.formatDateTimeToSqlLiteDateString(DateTime.Now.AddMonths(12));
                                        string mMembershipExpiryDate = currentTime.ToString();

                                        CustomerClass.newCustomer(mFirstName, mLastName, mEmail, mMembershipExpiryDate);
                                        MessageBox.Show("Customer added");
                                    }
                                    else
                                    {
                                        CustomerClass.newCustomer(mFirstName, mLastName, mEmail, null);
                                        MessageBox.Show("Customer added");
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        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);
                            }
                        }
                    }
                }
            }
        }