/// <summary> /// Method used to add the selected period as an appointment to the database /// </summary> /// <param name="sender">The Object Sender</param> /// <param name="e">The EventArgs</param> private void AddAppointmentButton_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(LessonTypecomboBox.Text) && !String.IsNullOrEmpty(StartTimecomboBox.Text) && !String.IsNullOrEmpty(lessonsComboBox.Text)) { TimeSpan startTime = TimeSpan.Parse(StartTimecomboBox.Text); DateTime dateToAdd = date.Date + startTime; bool appointmentAdded = DatabaseParser.AddAppointment(LessonTypecomboBox.Text, dateToAdd, (int)lessonsComboBox.SelectedItem, Session.LoggedInUser.Id.ToString()); if (appointmentAdded) { CustomMsgBox.ShowOk("Succes", "Appointment succesfully added", CustomMsgBoxIcon.Complete); AppointmentStructure appointmentStructure = new AppointmentStructure(-1, Session.LoggedInUser.Id, dateToAdd, (int)lessonsComboBox.SelectedItem, LessonTypecomboBox.Text, false, Session.LoggedInUser.Fullname); _appointments.Add(new Appointment(appointmentStructure)); this.Dispose(); } else { CustomMsgBox.ShowOk("Failure", "Appointment failed to upload", CustomMsgBoxIcon.Error); } } else { CustomMsgBox.ShowOk("Failure", "Some fields need to be filled", CustomMsgBoxIcon.Warrning); } }