/// <summary> /// Block time areas /// </summary> /// <returns></returns> public ActionResult Limit() { var sched = new DHXScheduler(this); sched.InitialDate = new DateTime(2011, 9, 19); // block specific date range sched.TimeSpans.Add(new DHXBlockTime() { StartDate = new DateTime(2011, 9, 14), EndDate = new DateTime(2011, 9, 17) }); // block each tuesday from 12AM to 15PM sched.TimeSpans.Add(new DHXBlockTime() { Day = DayOfWeek.Tuesday, Zones = new List <Zone>() { new Zone { Start = 0, End = 15 * 60 } } }); // block each sunday sched.TimeSpans.Add(new DHXBlockTime() { Day = DayOfWeek.Sunday }); // block each monday from 12am to 8am, and from 18pm to 12am of the next day sched.TimeSpans.Add(new DHXBlockTime() { Day = DayOfWeek.Monday, Zones = new List <Zone>() { new Zone { Start = 0, End = 8 * 60 }, new Zone { Start = 18 * 60, End = 24 * 60 } } }); #region add units and timeline var rooms = new DHXSchedulerModelsDataContext().Rooms.ToList(); var unit = new UnitsView("unit", "room_id"); unit.AddOptions(rooms);//parse model objects sched.Views.Add(unit); var timeline = new TimelineView("timeline", "room_id"); timeline.RenderMode = TimelineView.RenderModes.Bar; timeline.FitEvents = false; timeline.AddOptions(rooms); sched.Views.Add(timeline); #endregion //block different sections in timeline and units view sched.TimeSpans.Add(new DHXBlockTime() { FullWeek = true, Sections = new List <Section>() { new Section(unit.Name, rooms.Take(2).Select(r => r.key.ToString()).ToArray()), new Section(timeline.Name, rooms.Skip(2).Select(r => r.key.ToString()).ToArray()) } }); sched.LoadData = true; sched.EnableDataprocessor = true; return(View(sched)); }