private void SetDataSource() { CustomEventList eventList = new CustomEventList(); GenerateEvents(eventList); this.schedulerStorage1.Appointments.DataSource = eventList; }
void GenerateEvents(CustomEventList eventList) { int count = schedulerStorage1.Resources.Count; for (int i = 0; i < count; i++) { Resource resource = schedulerStorage1.Resources[i]; string subjPrefix = resource.Caption + "'s "; eventList.Add(CreateEvent(eventList, subjPrefix + "meeting", resource.Id, 2, 5)); eventList.Add(CreateEvent(eventList, subjPrefix + "travel", resource.Id, 3, 6)); eventList.Add(CreateEvent(eventList, subjPrefix + "phone call", resource.Id, 0, 10)); } }
CustomEvent CreateEvent(CustomEventList eventList, string subject, object resourceId, int status, int label) { CustomEvent apt = new CustomEvent(eventList); apt.Subject = subject; apt.OwnerId = resourceId; Random rnd = RandomInstance; int rangeInMinutes = 60 * 24; apt.StartTime = DateTime.Today + TimeSpan.FromMinutes(rnd.Next(0, rangeInMinutes)); apt.EndTime = apt.StartTime + TimeSpan.FromMinutes(rnd.Next(0, rangeInMinutes / 4)); apt.Status = status; apt.Label = label; TimeSpan duration = apt.EndTime - apt.StartTime; apt.Description = subject + " lasts for " + duration.ToString(); apt.CustomText = "TEST"; apt.CustomColor = Color.Transparent; return(apt); }
public CustomEvent(CustomEventList events) { this.events = events; }