void MoveOtherAppointments(object resourceID, TimeInterval dragAppointmentInterval, Appointment currentApt, bool shiftDown) { // change current appointments settings TimeSpan currentDuration = currentApt.Duration; if (shiftDown) { currentApt.Start = dragAppointmentInterval.End; currentApt.End = currentApt.Start + currentDuration; } else { currentApt.Start = dragAppointmentInterval.Start - currentDuration; currentApt.End = dragAppointmentInterval.Start; } TimeInterval newDragInterval = new TimeInterval(currentApt.Start, currentApt.End); // move other appointments AppointmentBaseCollection appointments = schedulerStorage1.GetAppointments(newDragInterval); appointments.Sort(comparer); foreach (Appointment apt in appointments) { if (Convert.ToInt32(apt.ResourceId) == Convert.ToInt32(resourceID) && apt != currentApt) { MoveOtherAppointments(apt.ResourceId, newDragInterval, apt, shiftDown); } } }
void ReOrderOtherAppointments(object resourceID, TimeInterval dragAppointmentInterval, Appointment currentApt) { schedulerControl1.BeginUpdate(); AppointmentBaseCollection appointments = schedulerStorage1.GetAppointments(dragAppointmentInterval); appointments.Sort(comparer); foreach (Appointment apt in appointments) { if (Convert.ToInt32(apt.ResourceId) == Convert.ToInt32(resourceID) && apt != currentApt) { if (apt.Start >= currentApt.Start) { MoveOtherAppointments(apt.ResourceId, dragAppointmentInterval, apt, true); } else { MoveOtherAppointments(apt.ResourceId, dragAppointmentInterval, apt, false); } } } schedulerControl1.EndUpdate(); }