DHTMLX Scheduler, Connecting to database












0















I am using asp.net mvc to create an app to keep track of employees holidays. I have two tables created in sql server. One is a list of employees and their information and the other is a holiday request form.



I have decided to use DHTLMX scheduler to show when employees take holidays.



So far I've set up the scheduler using a timeline view and created some mock data as follows



 using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;


using DHTMLX.Scheduler;
using DHTMLX.Common;
using DHTMLX.Scheduler.Data;
using DHTMLX.Scheduler.Controls;

using LotusWorksHolidayTracker.Models;
namespace LotusWorksHolidayTracker.Controllers
{
public class CalendarController : Controller
{
public ActionResult Index()
{
var sched = new DHXScheduler(this);
sched.Config.readonly_form = true;
sched.Views.Clear();
sched.InitialDate = new DateTime(2019, 1, 1);


var unit = new UnitsView("timeline", "key");
sched.InitialView = unit.Name;

sched.LoadData = true;
var dbcontext = new LotusworksHTEntities();


var timeline = new TimelineView("timeline", "Employee Name"); // initializes the view
timeline.FolderEventsAvailable = false;
timeline.RenderMode = TimelineView.RenderModes.Tree;



var section = timeline.AddOption(new TimelineUnit("1", "Full Day", true));

section.AddOption(new TimelineUnit("2", "Conor Bloggs")); // defines the items of the folder
section.AddOption(new TimelineUnit("3", "Joe Bloggs"));

var section2 = timeline.AddOption(new TimelineUnit("2", "Shift C", true));

section2.AddOption(new TimelineUnit("5", "Tom Bloggs"));
section2.AddOption(new TimelineUnit("6", "Tim Bloggs"));

timeline.FitEvents = false;
timeline.SectionAutoheight = false;
timeline.Dy = 25;
timeline.X_Unit = TimelineView.XScaleUnits.Day;
timeline.X_Date = "%j";
timeline.X_Step = 1;
timeline.X_Size = 31;
sched.Views.Add(timeline);





sched.TimeSpans.Add(new DHXMarkTime() {
Day = DayOfWeek.Saturday,
CssClass = "green_section",
SpanType = DHXMarkTime.Type.Default
});

sched.TimeSpans.Add(new DHXMarkTime()
{
Day = DayOfWeek.Sunday,
CssClass = "green_section",
SpanType = DHXMarkTime.Type.Default
});



return View(sched);


This has given me the correct format I'm looking for but I need to use data from my database and not mock data, how do I connect my database to the scheduler with Employee Names and down the left side and then the holidays they take on the scheduler itself.










share|improve this question























  • Hi, please check this forum thread forum.dhtmlx.com/t/connect-to-database/66382/7?u=aliaksandr , I've posted a working demo there

    – Alex Klimenkov
    Jan 15 at 17:11


















0















I am using asp.net mvc to create an app to keep track of employees holidays. I have two tables created in sql server. One is a list of employees and their information and the other is a holiday request form.



I have decided to use DHTLMX scheduler to show when employees take holidays.



So far I've set up the scheduler using a timeline view and created some mock data as follows



 using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;


using DHTMLX.Scheduler;
using DHTMLX.Common;
using DHTMLX.Scheduler.Data;
using DHTMLX.Scheduler.Controls;

using LotusWorksHolidayTracker.Models;
namespace LotusWorksHolidayTracker.Controllers
{
public class CalendarController : Controller
{
public ActionResult Index()
{
var sched = new DHXScheduler(this);
sched.Config.readonly_form = true;
sched.Views.Clear();
sched.InitialDate = new DateTime(2019, 1, 1);


var unit = new UnitsView("timeline", "key");
sched.InitialView = unit.Name;

sched.LoadData = true;
var dbcontext = new LotusworksHTEntities();


var timeline = new TimelineView("timeline", "Employee Name"); // initializes the view
timeline.FolderEventsAvailable = false;
timeline.RenderMode = TimelineView.RenderModes.Tree;



var section = timeline.AddOption(new TimelineUnit("1", "Full Day", true));

section.AddOption(new TimelineUnit("2", "Conor Bloggs")); // defines the items of the folder
section.AddOption(new TimelineUnit("3", "Joe Bloggs"));

var section2 = timeline.AddOption(new TimelineUnit("2", "Shift C", true));

section2.AddOption(new TimelineUnit("5", "Tom Bloggs"));
section2.AddOption(new TimelineUnit("6", "Tim Bloggs"));

timeline.FitEvents = false;
timeline.SectionAutoheight = false;
timeline.Dy = 25;
timeline.X_Unit = TimelineView.XScaleUnits.Day;
timeline.X_Date = "%j";
timeline.X_Step = 1;
timeline.X_Size = 31;
sched.Views.Add(timeline);





sched.TimeSpans.Add(new DHXMarkTime() {
Day = DayOfWeek.Saturday,
CssClass = "green_section",
SpanType = DHXMarkTime.Type.Default
});

sched.TimeSpans.Add(new DHXMarkTime()
{
Day = DayOfWeek.Sunday,
CssClass = "green_section",
SpanType = DHXMarkTime.Type.Default
});



return View(sched);


This has given me the correct format I'm looking for but I need to use data from my database and not mock data, how do I connect my database to the scheduler with Employee Names and down the left side and then the holidays they take on the scheduler itself.










share|improve this question























  • Hi, please check this forum thread forum.dhtmlx.com/t/connect-to-database/66382/7?u=aliaksandr , I've posted a working demo there

    – Alex Klimenkov
    Jan 15 at 17:11
















0












0








0








I am using asp.net mvc to create an app to keep track of employees holidays. I have two tables created in sql server. One is a list of employees and their information and the other is a holiday request form.



I have decided to use DHTLMX scheduler to show when employees take holidays.



So far I've set up the scheduler using a timeline view and created some mock data as follows



 using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;


using DHTMLX.Scheduler;
using DHTMLX.Common;
using DHTMLX.Scheduler.Data;
using DHTMLX.Scheduler.Controls;

using LotusWorksHolidayTracker.Models;
namespace LotusWorksHolidayTracker.Controllers
{
public class CalendarController : Controller
{
public ActionResult Index()
{
var sched = new DHXScheduler(this);
sched.Config.readonly_form = true;
sched.Views.Clear();
sched.InitialDate = new DateTime(2019, 1, 1);


var unit = new UnitsView("timeline", "key");
sched.InitialView = unit.Name;

sched.LoadData = true;
var dbcontext = new LotusworksHTEntities();


var timeline = new TimelineView("timeline", "Employee Name"); // initializes the view
timeline.FolderEventsAvailable = false;
timeline.RenderMode = TimelineView.RenderModes.Tree;



var section = timeline.AddOption(new TimelineUnit("1", "Full Day", true));

section.AddOption(new TimelineUnit("2", "Conor Bloggs")); // defines the items of the folder
section.AddOption(new TimelineUnit("3", "Joe Bloggs"));

var section2 = timeline.AddOption(new TimelineUnit("2", "Shift C", true));

section2.AddOption(new TimelineUnit("5", "Tom Bloggs"));
section2.AddOption(new TimelineUnit("6", "Tim Bloggs"));

timeline.FitEvents = false;
timeline.SectionAutoheight = false;
timeline.Dy = 25;
timeline.X_Unit = TimelineView.XScaleUnits.Day;
timeline.X_Date = "%j";
timeline.X_Step = 1;
timeline.X_Size = 31;
sched.Views.Add(timeline);





sched.TimeSpans.Add(new DHXMarkTime() {
Day = DayOfWeek.Saturday,
CssClass = "green_section",
SpanType = DHXMarkTime.Type.Default
});

sched.TimeSpans.Add(new DHXMarkTime()
{
Day = DayOfWeek.Sunday,
CssClass = "green_section",
SpanType = DHXMarkTime.Type.Default
});



return View(sched);


This has given me the correct format I'm looking for but I need to use data from my database and not mock data, how do I connect my database to the scheduler with Employee Names and down the left side and then the holidays they take on the scheduler itself.










share|improve this question














I am using asp.net mvc to create an app to keep track of employees holidays. I have two tables created in sql server. One is a list of employees and their information and the other is a holiday request form.



I have decided to use DHTLMX scheduler to show when employees take holidays.



So far I've set up the scheduler using a timeline view and created some mock data as follows



 using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;


using DHTMLX.Scheduler;
using DHTMLX.Common;
using DHTMLX.Scheduler.Data;
using DHTMLX.Scheduler.Controls;

using LotusWorksHolidayTracker.Models;
namespace LotusWorksHolidayTracker.Controllers
{
public class CalendarController : Controller
{
public ActionResult Index()
{
var sched = new DHXScheduler(this);
sched.Config.readonly_form = true;
sched.Views.Clear();
sched.InitialDate = new DateTime(2019, 1, 1);


var unit = new UnitsView("timeline", "key");
sched.InitialView = unit.Name;

sched.LoadData = true;
var dbcontext = new LotusworksHTEntities();


var timeline = new TimelineView("timeline", "Employee Name"); // initializes the view
timeline.FolderEventsAvailable = false;
timeline.RenderMode = TimelineView.RenderModes.Tree;



var section = timeline.AddOption(new TimelineUnit("1", "Full Day", true));

section.AddOption(new TimelineUnit("2", "Conor Bloggs")); // defines the items of the folder
section.AddOption(new TimelineUnit("3", "Joe Bloggs"));

var section2 = timeline.AddOption(new TimelineUnit("2", "Shift C", true));

section2.AddOption(new TimelineUnit("5", "Tom Bloggs"));
section2.AddOption(new TimelineUnit("6", "Tim Bloggs"));

timeline.FitEvents = false;
timeline.SectionAutoheight = false;
timeline.Dy = 25;
timeline.X_Unit = TimelineView.XScaleUnits.Day;
timeline.X_Date = "%j";
timeline.X_Step = 1;
timeline.X_Size = 31;
sched.Views.Add(timeline);





sched.TimeSpans.Add(new DHXMarkTime() {
Day = DayOfWeek.Saturday,
CssClass = "green_section",
SpanType = DHXMarkTime.Type.Default
});

sched.TimeSpans.Add(new DHXMarkTime()
{
Day = DayOfWeek.Sunday,
CssClass = "green_section",
SpanType = DHXMarkTime.Type.Default
});



return View(sched);


This has given me the correct format I'm looking for but I need to use data from my database and not mock data, how do I connect my database to the scheduler with Employee Names and down the left side and then the holidays they take on the scheduler itself.







asp.net dhtmlx






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 3 at 12:23









Conor8630Conor8630

1419




1419













  • Hi, please check this forum thread forum.dhtmlx.com/t/connect-to-database/66382/7?u=aliaksandr , I've posted a working demo there

    – Alex Klimenkov
    Jan 15 at 17:11





















  • Hi, please check this forum thread forum.dhtmlx.com/t/connect-to-database/66382/7?u=aliaksandr , I've posted a working demo there

    – Alex Klimenkov
    Jan 15 at 17:11



















Hi, please check this forum thread forum.dhtmlx.com/t/connect-to-database/66382/7?u=aliaksandr , I've posted a working demo there

– Alex Klimenkov
Jan 15 at 17:11







Hi, please check this forum thread forum.dhtmlx.com/t/connect-to-database/66382/7?u=aliaksandr , I've posted a working demo there

– Alex Klimenkov
Jan 15 at 17:11














0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022234%2fdhtmlx-scheduler-connecting-to-database%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022234%2fdhtmlx-scheduler-connecting-to-database%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Angular Downloading a file using contenturl with Basic Authentication

Olmecas

Can't read property showImagePicker of undefined in react native iOS