private void NewAppointment() { // TODO - You need to complete this method AppointmentSingle eappForm = new AppointmentSingle(_SelectedAppointment, 1, monthCalendar.SelectionStart); eappForm.ShowDialog(); // Single Appointment if (eappForm.saved) { _Appointments.Add(eappForm._SelectedAppointment); GetAppointmentsOnSelectedDate(monthCalendar.SelectionRange.Start); // Force repaint of daily view panel panelDailyView.Invalidate(); _Appointments.Save(); } }
private void editToolStripMenuItem_Click(object sender, EventArgs e) { // Raised by selecting Edit on the content menu // TODO - You need to complete this method. // _SelectedAppointment is set to the instance of the appointment to be edited if (((Appointment)_SelectedAppointment).TypeRecurring == 0) { AppointmentSingle eappForm = new AppointmentSingle(_SelectedAppointment, 0, monthCalendar.SelectionStart); eappForm.ShowDialog(); // Single Appointment if (_SelectedAppointment.Start != eappForm._SelectedAppointment.Start || _SelectedAppointment.Length != eappForm._SelectedAppointment.Length || _SelectedAppointment.DisplayableDescription != eappForm._SelectedAppointment.DisplayableDescription || ((Appointment)_SelectedAppointment).TypeRecurring != ((Appointment)eappForm._SelectedAppointment).TypeRecurring || ((Appointment)_SelectedAppointment).Times != ((Appointment)eappForm._SelectedAppointment).Times) { // If objects are different, we should update table and Save new edited appointment _Appointments.Remove(_SelectedAppointment); _Appointments.Add(eappForm._SelectedAppointment); GetAppointmentsOnSelectedDate(monthCalendar.SelectionRange.Start); // Force repaint of daily view panel panelDailyView.Invalidate(); _Appointments.Save(); } } else { AppointmentRec eappForm = new AppointmentRec(_SelectedAppointment, 0, monthCalendar.SelectionStart); eappForm.ShowDialog(); // Recurring Appointment if (_SelectedAppointment.Start != eappForm._SelectedAppointment.Start || _SelectedAppointment.Length != eappForm._SelectedAppointment.Length || _SelectedAppointment.DisplayableDescription != eappForm._SelectedAppointment.DisplayableDescription || ((Appointment)_SelectedAppointment).TypeRecurring != ((Appointment)eappForm._SelectedAppointment).TypeRecurring || ((Appointment)_SelectedAppointment).Times != ((Appointment)eappForm._SelectedAppointment).Times) { // If objects are different, we should update table and Save new edited appointment _Appointments.Remove(_SelectedAppointment); _Appointments.Add(eappForm._SelectedAppointment); GetAppointmentsOnSelectedDate(monthCalendar.SelectionRange.Start); // Force repaint of daily view panel panelDailyView.Invalidate(); _Appointments.Save(); } } }