private void btCreate_Click(object sender, EventArgs e) { if (dvOnline.Selection != SelectionType.Appointment) { DowntimeType dtType; DialogResult result; DowntimeTypeDialog dialog = new DowntimeTypeDialog(); result = dialog.ShowDialog(this); dtType = dialog.AppointmentType; dialog.Dispose(); if (result == DialogResult.Cancel) { return; } CreateDowntime(dtType); } else { //now we want to change an existing appointment if (!dvOnline.SelectedAppointment.Recurring) { if (CreateDowntime(GetDowntimeTypeOfSelectedDowntime())) { DeleteDowntime(); } } else { //change recurring appointment //check, if only selected appointment has to change or whole recurrence DialogResult res = MessageBox.Show("Change all events in this series?", "Change recurrences", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res != DialogResult.Yes) { if (CreateDowntime(GetDowntimeTypeOfSelectedDowntime())) { DeleteDowntime(); } } else { ChangeRecurrenceDowntime(((HiveDowntime)dvOnline.SelectedAppointment).RecurringId); } } } dvOnline.Invalidate(); }
private void btCreate_Click(object sender, EventArgs e) { if (dvOnline.Selection != SelectionType.Appointment) { DowntimeType dtType; DialogResult result; DowntimeTypeDialog dialog = new DowntimeTypeDialog(); result = dialog.ShowDialog(this); dtType = dialog.AppointmentType; dialog.Dispose(); if (result == DialogResult.Cancel) return; CreateDowntime(dtType); } else { //now we want to change an existing appointment if (!dvOnline.SelectedAppointment.Recurring) { if (CreateDowntime(GetDowntimeTypeOfSelectedDowntime())) DeleteDowntime(); } else { //change recurring appointment //check, if only selected appointment has to change or whole recurrence DialogResult res = MessageBox.Show("Change all events in this series?", "Change recurrences", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res != DialogResult.Yes) { if (CreateDowntime(GetDowntimeTypeOfSelectedDowntime())) DeleteDowntime(); } else ChangeRecurrenceDowntime(((HiveDowntime)dvOnline.SelectedAppointment).RecurringId); } } dvOnline.Invalidate(); }