private void schedulerControl1_EditAppointmentFormShowing_1(object sender, AppointmentFormEventArgs e) { try { DevExpress.XtraScheduler.SchedulerControl scheduler = ((DevExpress.XtraScheduler.SchedulerControl)(sender)); var form = new OutlookAppointmentForm(scheduler, e.Appointment, e.OpenRecurrenceForm); e.DialogResult = form.ShowDialog(); e.Handled = true; } catch (Exception ex) { MessageBox.Show(MiscStuff.GetAllMessages(ex)); } }
void barManager_ItemClick(object sender, ItemClickEventArgs e) { try { if (e.Item.Caption.Equals("Copy")) { radialMenu1.Collapse(true); DevExpress.XtraScheduler.Appointment apt = schedulerControl1.SelectedAppointments[0]; copiedAppointment = apt.Copy(); } else if (e.Item.Caption.Equals("Paste")) { if (copiedAppointment != null && dateSelected) { radialMenu1.Collapse(true); copiedAppointment.Start = selectedDate; schedulerStorage1.Appointments.Add(copiedAppointment); } } else if (e.Item.Caption.Equals("Delete")) { radialMenu1.Collapse(true); var apptTemp = this.schedulerControl1.SelectedAppointments[0]; using (var context = new LorikeetAppEntities()) { var apptID = (from a in context.Appointments where a.Subject == apptTemp.Subject && DbFunctions.TruncateTime(a.StartDate) == DbFunctions.TruncateTime(apptTemp.Start) select a).DefaultIfEmpty().First(); var appointmentsToRemove = (from atr in context.AppointmentMembers where atr.AppointmentsID == apptID.UniqueID select atr).ToList(); foreach (var a in appointmentsToRemove) { context.AppointmentMembers.Remove(a); context.SaveChanges(); } var notesToRemove = (from ntr in context.Notes where DbFunctions.TruncateTime(ntr.Date) == DbFunctions.TruncateTime(apptID.StartDate) && ntr.Notes == "Member attended " + apptTemp.Subject + " group" select ntr).ToList(); foreach (var ntr in notesToRemove) { context.Notes.Remove(ntr); context.SaveChanges(); } } schedulerStorage1.Appointments.Remove(apptTemp); appointmentsTableAdapter.Update(lorikeetAppDataSet); lorikeetAppDataSet.AcceptChanges(); } else if (e.Item.Caption.Equals("New")) { radialMenu1.Collapse(true); DevExpress.XtraScheduler.Appointment appointmentNew = schedulerStorage1.CreateAppointment(AppointmentType.Normal); appointmentNew.Start = schedulerControl1.SelectedInterval.Start; appointmentNew.End = schedulerControl1.SelectedInterval.End; var form = new OutlookAppointmentForm(schedulerControl1, appointmentNew, false); form.ShowDialog(this); } else if (e.Item.Caption.Equals("Appointment")) { radialMenu1.Collapse(true); DevExpress.XtraScheduler.Appointment apt = schedulerControl1.SelectedAppointments[0]; var form = new OutlookAppointmentForm(schedulerControl1, apt, false); form.ShowDialog(this); } else if (e.Item.Caption.Equals("Members")) { radialMenu1.Collapse(true); DevExpress.XtraScheduler.Appointment apt = schedulerControl1.SelectedAppointments[0]; var form = new FormEditAppointmentMembers(apt, staffID); form.ShowDialog(this); } else if (e.Item.Caption.Equals("Attendance")) { if (schedulerControl1.SelectedAppointments.Count < 1) { DateTime date = schedulerControl1.SelectedInterval.Start; radialMenu1.Collapse(true); var form = new FormEditAttendance(date, staffID); form.ShowDialog(this); } } } catch (Exception ex) { MessageBox.Show(MiscStuff.GetAllMessages(ex)); } }