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); } }
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); // } }