private void btn3_Click(object sender, EventArgs e) { //Closes this form and opens Private Tuition Menu this.Hide(); frmPrivateTuition PrivateTuition = new frmPrivateTuition(db); PrivateTuition.Show(); }
private void btn2_Click_1(object sender, EventArgs e) { //Validates if all of the required options were selected if (comboBox1.SelectedIndex == -1 || comboBox2.SelectedIndex == -1 || comboBox3.SelectedIndex == -1) { MessageBox.Show("To proceed you must select tuition type, lesson level and duration. "); } else { try { //Inserts booking int BookingNo = Convert.ToInt32(lblBookingNo.Text); int NoOfLessons = lessons; int instrumentNo = comboBox1.SelectedIndex; newBooking.BookingNo = BookingNo; newBooking.Duration = Duration; newBooking.PupilNo = int.Parse(lblPupilNo.Text); BookingDBAccess BookingAccess = new BookingDBAccess(db); BookingAccess.insertBooking(BookingNo, int.Parse(lblPupilNo.Text), instrumentNo, NoOfLessons, level, Duration, fee); //Informs the user that booking was created and checks if user wants to block book instantly DialogResult dialogResult = MessageBox.Show("Would you like to Block Book your lessons now?", "Booking Created.", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { // Enables groupboxes related to block booking lessons groupBox4.Enabled = true; groupBox5.Enabled = true; groupBox6.Enabled = true; //Disables buttons related to booking btnSearch.Enabled = false; btnSelectPupil.Enabled = false; btn2.Enabled = false; } else if (dialogResult == DialogResult.No) { this.Hide(); frmPrivateTuition PTuition = new frmPrivateTuition(db); PTuition.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } cBoxTimeSlot.Items.Clear(); cBoxTimeSlot.Items.Add("9:00am to 9:30am"); cBoxTimeSlot.Items.Add("9:30am to 10:00am"); cBoxTimeSlot.Items.Add("10:00am to 10:30am"); cBoxTimeSlot.Items.Add("10:30am to 11:00am"); cBoxTimeSlot.Items.Add("11:00am to 11:30am"); cBoxTimeSlot.Items.Add("11:30am to 12:00pm"); cBoxTimeSlot.Items.Add("12:00pm to 12:30pm"); cBoxTimeSlot.Items.Add("12:30pm to 1:00pm"); cBoxTimeSlot.Items.Add("1:00pm to 1:30pm"); cBoxTimeSlot.Items.Add("1:30pm to 2:00pm"); cBoxTimeSlot.Items.Add("2:00pm to 2:30pm"); cBoxTimeSlot.Items.Add("2:30pm to 3:00pm"); cBoxTimeSlot.Items.Add("3:00pm to 3:30pm"); cBoxTimeSlot.Items.Add("3:30pm to 4:00pm"); cBoxTimeSlot.Items.Add("4:00pm to 4:30pm"); cBoxTimeSlot.Items.Add("4:30pm to 5:00pm"); cBoxTimeSlot.Items.Add("5:00pm to 5:30pm"); cBoxTimeSlot.Items.Add("5:30pm to 6:00pm"); cBoxTimeSlot.Items.Add("6:00pm to 6:30pm"); cBoxTimeSlot.Items.Add("6:30pm to 7:00pm"); cBoxTimeSlot.Items.Add("7:00pm to 7:30pm"); cBoxTimeSlot.Items.Add("7:30pm to 8:00pm"); cBoxTimeSlot.Items.Add("8:00pm to 8:30pm"); cBoxTimeSlot.Items.Add("8:30pm to 9:00pm"); /*else * { * cBoxTimeSlot.Items.Clear(); * cBoxTimeSlot.Items.Add("9:00am to 10:00am"); * cBoxTimeSlot.Items.Add("10:00am to 11:00am"); * cBoxTimeSlot.Items.Add("11:00am to 12:00pm"); * cBoxTimeSlot.Items.Add("12:00pm to 1:00pm"); * cBoxTimeSlot.Items.Add("1:00pm to 2:00pm"); * cBoxTimeSlot.Items.Add("2:00pm to 3:00pm"); * cBoxTimeSlot.Items.Add("3:00pm to 4:00pm"); * cBoxTimeSlot.Items.Add("4:00pm to 5:00pm"); * cBoxTimeSlot.Items.Add("5:00pm to 6:00pm"); * cBoxTimeSlot.Items.Add("6:00pm to 7:00pm"); * cBoxTimeSlot.Items.Add("7:00pm to 8:00pm"); * cBoxTimeSlot.Items.Add("8:00pm to 9:00pm"); * }*/ // catch (Exception ex) //{ // MessageBox.Show(ex.Message); // } } }