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); }
public object InsertMethodHandler(CustomEvent customEvent) { Object id = customEvent.GetHashCode(); customEvent.Id = id; Events.Add(customEvent); return(id); }
CustomEvent CreateEvent(object resourceId, string subject, int status, int label) { CustomEvent customEvent = new CustomEvent(); customEvent.Subject = subject; customEvent.OwnerId = resourceId; int rangeInHours = 48; customEvent.StartTime = DateTime.Today + TimeSpan.FromHours(rnd.Next(0, rangeInHours)); customEvent.EndTime = customEvent.StartTime + TimeSpan.FromHours(rnd.Next(0, rangeInHours / 8)); customEvent.Status = status; customEvent.Label = label; customEvent.Id = "ev" + customEvent.GetHashCode(); return customEvent; }
CustomEvent CreateEvent(object resourceId, string subject, int status, int label) { CustomEvent customEvent = new CustomEvent(); customEvent.Subject = subject; customEvent.Description = subject + ". " + "Some description."; customEvent.OwnerId = resourceId; Random rnd = RandomInstance; int rangeInHours = 48; customEvent.StartTime = DateTime.Today + TimeSpan.FromHours(rnd.Next(0, rangeInHours)); customEvent.EndTime = customEvent.StartTime + TimeSpan.FromHours(rnd.Next(0, rangeInHours / 8)); customEvent.Status = status; customEvent.Label = label; customEvent.Id = "ev" + customEvent.GetHashCode(); customEvent.Amount = rnd.Next(1, 10); return(customEvent); }
CustomEvent CreateEvent(object resourceId, string subject, int status, int label, DateTime date) { int id = (int)resourceId; CustomEvent customEvent = new CustomEvent(); customEvent.Subject = subject; customEvent.OwnerId = resourceId; int rangeInHours = 1; customEvent.StartTime = date + TimeSpan.FromHours(rangeInHours*id); customEvent.EndTime = customEvent.StartTime + TimeSpan.FromHours(rangeInHours); customEvent.Status = status; customEvent.Label = label; customEvent.Id = "ev" + customEvent.GetHashCode(); return customEvent; }
string GenerateId(CustomEvent customEvent) { return("a" + customEvent.GetHashCode()); }