Ejemplo n.º 1
0
 private void SubmitBookingButton_Click(object sender, EventArgs e)
 {
     if (_signedIn)
     {
         //Take information from the combo boxes and store it in strings. This will then be used to check against the database
         //To see if the booking can be made or not
         string Platform   = PlatformCombobox.GetItemText(PlatformCombobox.SelectedItem);
         string TimeLength = comboBox2.GetItemText(comboBox2.SelectedItem);
         string Software   = comboBox3.GetItemText(comboBox3.SelectedItem);
         string NoOfPeople = NoOfPeopleComboBox.GetItemText(NoOfPeopleComboBox.SelectedItem);
         string Time       = TimeBox.GetItemText(TimeBox.SelectedItem);
     }
     else
     {
         MessageBox.Show("Please sign in to quick book", "Quick book", MessageBoxButtons.OK);
     }
 }
Ejemplo n.º 2
0
        private void SubmitBookingButton_Click(object sender, EventArgs e)
        {
            //Take information from the combo boxes and store it in strings. This will then be used to check against the database
            //To see if the booking can be made or not

            string Platform   = PlatformCombobox.GetItemText(PlatformCombobox.SelectedItem);
            string TimeLength = comboBox2.GetItemText(comboBox2.SelectedItem);
            string Software   = comboBox3.GetItemText(comboBox3.SelectedItem);
            string NoOfPeople = NoOfPeopleComboBox.GetItemText(NoOfPeopleComboBox.SelectedItem);
            string Time       = TimeBox.GetItemText(TimeBox.SelectedItem);



            //This is where the values stored in the date picker will be used to push through to the data base,
            //Below includes a simple check to ensure that the information is filled before sending and a check
            //to ensure double bookings dont happen (Needs to be updated)

            //If successful
            //    if (Platform != "" && TimeLength != "" && Time != "" && Software != "" && NoOfPeople != "")
            //    {
            //        bool IsDuplicate = false;

            //        for (int i = 0; i < dataGridView2.RowCount - 1; i++)
            //        {

            //            if (Time == dataGridView2.Rows[i].Cells[3].Value.ToString())
            //            {
            //                IsDuplicate = true;
            //            }
            //        }

            //        //Add code to check if member here or not , maybe make into a switch using time data
            //        if (IsDuplicate == false && TimeLength == "1 Hour")
            //        {

            //            if (MessageBox.Show("Booking will cost £1.50", "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            //            {
            //                dataGridView2.Rows.Insert(dataGridView2.RowCount - 1, Platform, TimeLength, Date.ToShortDateString(), Time, Software, NoOfPeople);
            //            }
            //            else
            //            {

            //            }
            //        }
            //        else if (IsDuplicate == false && TimeLength == "2 Hours")
            //        {
            //            if (MessageBox.Show("Booking will cost £2.50", "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            //            {
            //                dataGridView2.Rows.Insert(dataGridView2.RowCount - 1, Platform, TimeLength, Date.ToShortDateString(), Time, Software, NoOfPeople);
            //            }
            //            else
            //            {

            //            }
            //        }
            //        else if (IsDuplicate == false && TimeLength == "5 Hours")
            //        {
            //            if (MessageBox.Show("Booking will cost £4.00", "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            //            {
            //                dataGridView2.Rows.Insert(dataGridView2.RowCount - 1, Platform, TimeLength, Date.ToShortDateString(), Time, Software, NoOfPeople);
            //            }
            //            else
            //            {

            //            }
            //        }

            //        //if (IsDuplicate == false)
            //        //{
            //        //    dataGridView2.Rows.Insert(dataGridView2.RowCount - 1, Platform, TimeLength, Date.ToShortDateString(), Time, Software, NoOfPeople);
            //        //    MessageBox.Show("Booking has been made!", "Booking check", MessageBoxButtons.OK);
            //        //}
            //        //else
            //        //    MessageBox.Show("Duplicate booking, choose another time.", "Booking check", MessageBoxButtons.OK);
            //    }
        }
Ejemplo n.º 3
0
        private void SubmitBooking_Click(object sender, EventArgs e)
        {
            //Take information from the combo boxes and store it in strings. This will then be used to check against the database
            //To see if the booking can be made or not

            //string Platform = comboBox1.GetItemText(comboBox1.SelectedItem);
            //int id = Reader.GetColumnCount("Booking") + 1;
            int    Platform   = SelectPlatformComboBox.SelectedIndex + 1;
            string TimeLength = LengthOfBookingComboBox.GetItemText(LengthOfBookingComboBox.SelectedItem);
            int    Software   = SelectGameComboBox.SelectedIndex + 1;
            int    NoOfPeople = int.Parse(NoOfPeopleComboBox.GetItemText(NoOfPeopleComboBox.SelectedItem));

            DateTime Date = EventCalendar.SelectionStart;
            int      Time = TimeBox.SelectedIndex + 1;



            //Code for button on click event
            //This is where the values stored in the date picker will be used to push through to the data base

            /*
             * If - datepicker date != database values
             *  add to database
             *  confirm success
             *
             * else
             *  Send message to user that dates are unavailable
             *      Maybe suggest closest date available?
             */

            //BookingData newBooking = new BookingData { ID = id, Name = null, Attenders = NoOfPeople, Hardware = Platform, Software = Software, DateBooked = Date, HoursBooked = Time };
            // Debug
            //BookingData newBooking = new BookingData { ID = id, Name = "John Doe", Attenders = NoOfPeople, Hardware = Platform, Software = Software, DateBooked = new DateTime(2018, 3, 22, 15, 30, 0), HoursBooked = Time };
            BookingData newBooking = new BookingData {
                ID = 0, Name = "John Doe", Attenders = NoOfPeople, Hardware = Platform, Software = Software, DateBooked = new DateTime(2018, 3, 22, 15, 30, 0), HoursBooked = Time
            };

            //If successful
            if (Platform != null && TimeLength != "" && Time != null && Software != null && NoOfPeople != null)
            {
                bool IsDuplicate = false;

                //for(int i = 0; i < dataGridView2.RowCount - 1; i++)
                //{

                //    if (Time == dataGridView2.Rows[i].Cells[3].Value.ToString())
                //    {
                //        IsDuplicate = true;
                //    }
                //}

                if (IsDuplicate == false)
                {
                    //dataGridView2.Rows.Insert(dataGridView2.RowCount - 1, Platform, TimeLength, Date.ToShortDateString(), Time, Software, NoOfPeople);
                    //string error = Writer.AddBooking(newBooking);
                    MessageBox.Show("Booking has been made!", "Booking check", MessageBoxButtons.OK);
                }
                else
                {
                    MessageBox.Show("Duplicate booking, choose another time.", "Booking check", MessageBoxButtons.OK);
                }
            }
        }