I have the room booking calendar implemented - Room Booking Airy MVC version.
I want it to default not in the Week view (default but in the rooms view. Here is my current site:
scheduler.primetimescheduler.com Click on the Daily button on the Nav bar, that is the view I want the scheduler to always come up as when it first loads or you click the Home link.
Here is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using DHTMLX.Scheduler;
using DHTMLX.Common;
using DHTMLX.Scheduler.Controls;
using DHTMLX.Scheduler.Data;
using BookingCalendar.Models;
using System.Web.Script.Serialization;
using System.Net.Mail;
namespace BookingCalendar.Controllers
{
public class HomeController : Controller
{
RoomBookingDataContext db = new RoomBookingDataContext();
public ActionResult Index()
{
var scheduler = new DHXScheduler(this);
scheduler.Skin = DHXScheduler.Skins.Standart;
var studio = db.ManageStudios.Where(x => x.Isactive==true).FirstOrDefault();
Session[“id”] = studio.Id;
Session[“studioname”] = studio.Name;
Session[“studioImage”] = studio.studioImg;
string stime = studio.StartTime;
string ETime = studio.EndTime;
string[] strArr = stime.Split(':');
string[] etrass = ETime.Split(':');
int startTime =Convert.ToInt32(strArr[0]);
int endTime = Convert.ToInt32(etrass[0]);
//--------------------for Am----Pm----------------------------------------//
string[] periodcheck = strArr[1].Split(’ ');
string checkam = periodcheck[1].ToString();
string[] etrass1 = etrass[1].Split(' ');
string checkam1 = etrass1[1].ToString();
if (checkam != checkam1)
{
endTime = endTime + 12;
}
if (startTime==12)
{
startTime = startTime - 12;
}
scheduler.EnableDynamicLoading(SchedulerDataLoader.DynamicalLoadingMode.Month);
scheduler.Config.show_loading = true;
scheduler.InitialDate = new DateTime(2015, 12, 1);
scheduler.Extensions.Add(SchedulerExtensions.Extension.Recurring);
/*enable extensions*/
scheduler.Extensions.Add(SchedulerExtensions.Extension.ActiveLinks);
scheduler.Extensions.Add(SchedulerExtensions.Extension.Collision);
scheduler.Extensions.Add(SchedulerExtensions.Extension.Limit);
scheduler.Extensions.Add(SchedulerExtensions.Extension.PDF);
scheduler.Extensions.Add(SchedulerExtensions.Extension.Cookie);
scheduler.Config.dblclick_create = true;
scheduler.Config.details_on_dblclick = true;
scheduler.Config.select = false;
scheduler.Config.max_month_events = 0;
scheduler.Config.touch = true;
scheduler.Config.separate_short_events = true;
scheduler.Config.repeat_precise = true;
scheduler.Config.drag_out = false;
scheduler.LoadData = true;
scheduler.EnableDataprocessor = true;
scheduler.Config.first_hour = startTime;
scheduler.Config.last_hour = endTime;
scheduler.XY.scroll_width = 0;
scheduler.Config.hour_date = "%h:%i %A";
scheduler.Config.time_step = 5; // minimum event length
scheduler.Config.multi_day = true;
scheduler.Config.limit_time_select = true;
scheduler.Config.hour_size_px = 176;
scheduler.Config.cascade_event_display = true;
// scheduler.Config.full_day = true;
scheduler.AfterInit = new List<string>() { "app.initialize();" };// The required client-side handlers have to be added after Scheduler initialization but before events load.
//scheduler.LoadData = true;
if (Request.IsAuthenticated)
scheduler.EnableDataprocessor = true;
else
scheduler.Config.isReadonly = true;
// var helper = new DHXEventsHelper();
//var items = helper.GetOccurrences(new RoomBookingDataContext().Recurrings, new DateTime(2012, 11, 10), new DateTime(2012, 12, 10));
/*add views*/
var context = new RoomBookingDataContext();
scheduler.Views.Items.RemoveAt(2);//remove DayView
// scheduler.Views.Items.RemoveAt(0);//remove MonthView - doesn't work, crashes scheduler
scheduler.Views[1].TabClass += " dhx_cal_tab_first";
var units = new UnitsView("rooms", "room_id");
units.Label = "Daily";
var rooms = context.Rooms.ToList();
units.AddOptions(rooms);
scheduler.Views.Add(units);
//scheduler.InitialView = "WHAT DO I PUT HERE TO DEFAULT TO ROOMS VIEW?!?!?!";