CustomEventList GetCustomEvents() { CustomEventList events = Session["ListBoundModeObjects"] as CustomEventList; if (events == null) { events = new CustomEventList(); CustomEvent customEvent1 = new CustomEvent(); customEvent1.Id = customEvent1.GetHashCode(); customEvent1.StartTime = DateTime.Today.AddHours(1); customEvent1.EndTime = DateTime.Today.AddHours(2); customEvent1.Subject = "Test event"; customEvent1.OwnerId = "sbrighton"; customEvent1.Label = 0; events.Add(customEvent1); CustomEvent customEvent2 = new CustomEvent(); customEvent2.Id = customEvent2.GetHashCode(); customEvent2.StartTime = DateTime.Today.AddHours(4); customEvent2.EndTime = DateTime.Today.AddHours(5); customEvent2.Subject = "Test event 2"; customEvent2.OwnerId = "rfischer"; customEvent2.Label = 1; events.Add(customEvent2); Session["ListBoundModeObjects"] = events; } return(events); }
protected void PopulateEventList(CustomEventList eventList) { int count = this.resourceIdList.Length; for(int i = 0; i < count; i++) { object resourceId = this.resourceIdList[i]; string resourceCaption = this.resourceCaptionList[i]; eventList.Add(CreateEvent(resourceId, resourceCaption + " meeting", 2, 2)); eventList.Add(CreateEvent(resourceId, resourceCaption + " travel", 3, 0)); eventList.Add(CreateEvent(resourceId, resourceCaption + " time off", 0, 1)); } }
CustomEventList GenerateCustomEventList() { CustomEventList eventList = new CustomEventList(); int count = Storage.Resources.Count; for (int i = 0; i < count; i++) { Resource resource = Storage.Resources[i]; string subjPrefix = resource.Caption + "'s "; eventList.Add(CreateEvent(resource.Id, subjPrefix + "meeting", 2, 2)); eventList.Add(CreateEvent(resource.Id, subjPrefix + "travel", 3, 0)); eventList.Add(CreateEvent(resource.Id, subjPrefix + "time off", 0, 1)); } return(eventList); }
public CustomEventList SelectCustomEvent(DateTime start, DateTime end) { EventsResource.ListRequest request = Service.Events.List(this.calendarId); request.MaxResults = 2500; request.TimeMin = start; request.TimeMax = end; Events events = request.Execute(); CustomEventList result = new CustomEventList(); foreach (Event item in events.Items) { if (item.Recurrence != null || item.RecurringEventId != null) { continue; } if (item.OriginalStartTime != null) { continue; } CustomEvent customEvent = new CustomEvent(item); result.Add(customEvent); } return(result); }
void PopulateRentals(CustomEventList events) { string[] customers = new string[] { "Mr.Brown", "Mr.White", "Mrs.Black", "Mr.Green" }; string[] locations = new string[] { "city", "out of town" }; int count = 20; for (int i = 0; i < count; i++) { events.Add(CreateRental(customers, locations)); } }
void PopulateMaintenance(CustomEventList events) { CustomEvent wash = new CustomEvent(); wash.Subject = "Wash"; wash.Description = "Wash this car in the garage"; wash.Location = "Garage"; wash.StartTime = baseDate + TimeSpan.FromHours(7); wash.EndTime = baseDate + TimeSpan.FromHours(8); wash.OwnerId = Randomize.Next(1, 6); wash.Label = 2; wash.EventType = 1; wash.RecurrenceInfo = @"<RecurrenceInfo AllDay=""False"" DayNumber=""1"" DayOfMonth=""0"" WeekDays=""42"" Id=""51c81018-53fa-4d10-925f-2ed7f8408c75"" Month=""12"" OccurenceCount=""19"" Periodicity=""1"" Range=""2"" Start=""7/11/2008 7:00:00"" End=""8/24/2008 1:00:00"" Type=""1"" />"; wash.Id = Guid.NewGuid(); AddEventAdditionalInfo(wash); events.Add(wash); }
CustomEventList GenerateCustomEventList() { ShiftSchedule shiftSchedule = this.ShiftSchedule; CustomEventList eventList = new CustomEventList(); if (shiftSchedule != null) { if (this.ASPxScheduler1.Storage.Resources.Count == 0) { SchedulerDemoUtils.ApplyDefaults(this, ASPxScheduler1); SetupMappings(); SchedulerDemoUtils.FillResources(this.ASPxScheduler1.Storage, _scheduler.AlgorithmFactory.ShiftRuleFactory.DataAccess.GetEmployees()); } foreach (var weekItem in shiftSchedule.Weeks) { foreach (var wday in weekItem.Value.WorkingDays) { LogSession.Main.LogMessage("Week[{0}]: Start date: {1} wDay:{2} Date: {3}", weekItem.Value.Id, weekItem.Value.Start_Date, wday.Value.Id, weekItem.Value.Start_Date.AddDays(wday.Value.Id - 1)); foreach (var assignedEmployee in wday.Value.Shifts[1].AssignedEmployees) { Resource resource = Storage.Resources.GetResourceById(assignedEmployee.Value.id); eventList.Add(CreateEvent(resource.Id, string.Format("{0} {1}", resource.Id.ToString(), resource.Caption), 0, assignedEmployee.Value.id, weekItem.Value.Start_Date.AddDays(wday.Value.Id - 1))); } } } } return eventList; }
static void PopulateRentals(CustomEventList events, bool resourceSharing) { string[] customers = new string[] { "Mr.Brown", "Mr.White", "Mrs.Black", "Mr.Green" }; string[] locations = new string[] { "city", "out of town" }; int count = 20; for (int i = 0; i < count; i++) events.Add(CreateRental(customers, locations, resourceSharing)); CreatePriorityRentals(events, resourceSharing, customers, locations); }
static void PopulateMaintenance(CustomEventList events, bool resourceSharing) { CustomEvent wash = new CustomEvent(); wash.Subject = "Wash"; wash.Description = "Wash this car in the garage"; wash.Location = "Garage"; wash.StartTime = baseDate + TimeSpan.FromHours(7); wash.EndTime = baseDate + TimeSpan.FromHours(8); wash.OwnerId = CalculateResourceIdOrIds(resourceSharing); wash.Status = 1; wash.Label = 2; wash.EventType = 1; wash.RecurrenceInfo = @"<RecurrenceInfo AllDay=""False"" DayNumber=""1"" DayOfMonth=""0"" WeekDays=""42"" Id=""51c81018-53fa-4d10-925f-2ed7f8408c75"" Month=""12"" OccurenceCount=""19"" Periodicity=""1"" Range=""2"" Start=""7/11/2008 7:00:00"" End=""8/24/2008 1:00:00"" Type=""1"" />"; wash.Id = Guid.NewGuid(); AddEventAdditionalInfo(wash); events.Add(wash); }
static void CreatePriorityRentals(CustomEventList events, bool resourceSharing, string[] customers, string[] locations) { List<DateTime> priorityDates = new List<DateTime>(); for (int i = -5; i < 3; i++) priorityDates.Add(baseDate.AddDays(i)); int[] startHourSectors = new int[] { 11 }; for (int resourceId = 0; resourceId < ResourceCount; resourceId++) { foreach (DateTime priorityDate in priorityDates) foreach (int startHourSector in startHourSectors) events.Add(CreateRental(resourceId, customers, locations, resourceSharing, priorityDate, startHourSector)); } }