static AgendaAppointment CreateAgendaAppointment(DevExpress.Xpf.Scheduler.SchedulerStorage storage, Appointment sourceAppointment, DateTime startDate, string startTime, string endTime) { AgendaAppointment agendaAppointment = new AgendaAppointment(); agendaAppointment.AgendaDate = startDate; agendaAppointment.AgendaDescription = sourceAppointment.Description; agendaAppointment.AgendaSubject = sourceAppointment.Subject; if (startTime == "" && endTime == "") { agendaAppointment.AgendaDuration = "All Day"; } else if (startTime == "" && endTime != "") { agendaAppointment.AgendaDuration = "Till: " + endTime; } else if (startTime != "" && endTime == "") { agendaAppointment.AgendaDuration = "From: " + startTime; } else { agendaAppointment.AgendaDuration = String.Format("{0} - {1}", startTime, endTime); } agendaAppointment.AgendaLocation = sourceAppointment.Location; agendaAppointment.AgendaStatus = storage.AppointmentStorage.Statuses[sourceAppointment.StatusId]; agendaAppointment.AgendaLabel = storage.GetLabelColor(sourceAppointment.LabelId); agendaAppointment.SourceAppointment = sourceAppointment; return(agendaAppointment); }
public static object GenerateAgendaAppointmentCollection(DevExpress.Xpf.Scheduler.SchedulerStorage storage) { AppointmentBaseCollection sourceAppointments = storage.GetAppointments(SelectedInterval); BindingList <AgendaAppointment> agendaAppointments = new BindingList <AgendaAppointment>(); foreach (Appointment appointment in sourceAppointments) { TimeInterval currentDayInterval = new TimeInterval(appointment.Start.Date, appointment.Start.Date.AddDays(1)); string startTime = ""; string endTime = ""; if (currentDayInterval.Contains(appointment.End)) { startTime = currentDayInterval.Start == appointment.Start ? "" : appointment.Start.TimeOfDay.ToString(@"hh\:mm"); endTime = currentDayInterval.End == appointment.End ? "" : appointment.End.TimeOfDay.ToString(@"hh\:mm"); agendaAppointments.Add(CreateAgendaAppointment(storage, appointment, currentDayInterval.Start, startTime, endTime)); } else { startTime = currentDayInterval.Start == appointment.Start ? "" : appointment.Start.TimeOfDay.ToString(@"hh\:mm"); agendaAppointments.Add(CreateAgendaAppointment(storage, appointment, currentDayInterval.Start, startTime, "")); while (true) { currentDayInterval = new TimeInterval(currentDayInterval.End, currentDayInterval.End.AddDays(1)); if (currentDayInterval.Contains(appointment.End)) { endTime = currentDayInterval.End == appointment.End ? "" : appointment.End.TimeOfDay.ToString(@"hh\:mm"); agendaAppointments.Add(CreateAgendaAppointment(storage, appointment, currentDayInterval.Start, "", endTime)); break; } else { agendaAppointments.Add(CreateAgendaAppointment(storage, appointment, currentDayInterval.Start, "", "")); } } } } return(agendaAppointments); }
public static object GenerateResourcesCollection(DevExpress.Xpf.Scheduler.SchedulerStorage storage) { return(storage.ResourceStorage.Items); }