DayPilot News (May 2015)

Monthly summary of new releases and articles - May 2015.
May 30, 2015

Tutorials

All versions of the hotel room reservation tutorials (JavaScript, ASP.NET WebForms, ASP.NET MVC) are updated to support custom check-in and check-out time.

This allows more precise display and recording of the reservations - they are correctly displayed as overnight stays.

scheduler-hotel-tutorial-check-in-check-out.png

The updated tutorial versions use the manual timeline feature of the Scheduler control to generate custom timeline cells.

JavaScript Example

function loadTimeline(date) {
  dp.scale = "Manual";
  dp.timeline = [];
  var start = date.getDatePart().addHours(12);
  
  for (var i = 0; i < dp.days; i++) {
      dp.timeline.push({start: start.addDays(i), end: start.addDays(i+1)});
  }
  dp.update();
}

dp.timeHeaders = [
  { groupBy: "Month", format: "MMMM yyyy" },
  { groupBy: "Day", format: "d" }
];

ASP.NET MVC Example (C#)

MVC View

@Html.DayPilotScheduler("dp", new DayPilotSchedulerConfig
{
  Scale = TimeScale.Manual,
  // ...
  TimeHeaders = new TimeHeaderCollection()
  {
      new TimeHeader(GroupBy.Month),
      new TimeHeader(GroupBy.Day)
  },  
  // ...
})

MVC Controller

protected override void OnInit(InitArgs e)
{
  DateTime start = new DateTime(2015, 1, 1, 12, 0, 0);
  DateTime end = new DateTime(2016, 1, 1, 12, 0, 0);

  Timeline = new TimeCellCollection();
  for (DateTime cell = start; cell < end; cell = cell.AddDays(1))
  {
      Timeline.Add(cell, cell.AddDays(1));
  }

  // ...
}

Tutorial Source Code Download

All tutorial versions have been updated:

DayPilot for JavaScript, ASP.NET WebForms, ASP.NET MVC, Java