0
我在我的MVC5 web应用程序中使用DHTMLXScheduler来添加患者并获取患者的预约并在日历中显示此信息,但我遇到了麻烦,根据start_time和end_time没有添加记录。如何从数据库中获取记录并将其显示为DHTMLXScheduler中的事件日历
日历控制器:
public ActionResult Index()
{
var sched = new DHXScheduler(this);
sched.Skin = DHXScheduler.Skins.Terrace;
sched.LoadData = true;
sched.EnableDataprocessor = true;
sched.InitialDate = new DateTime(2016, 5, 5);
sched.Config.xml_date = "%d-%M-%Y %g:%i:%s%A";
return View(sched);
}
public ContentResult Data()
{
return (new SchedulerAjaxData(
new Entities().AppointmentsLogs.Select(e=> new { id = e.AppointmentId, start_date = e.StartTime.ToString(), end_date=e.EndTime, text = e.PatientName })
// .Select(e => new { e.id, e.text, e.start_date, e.end_date })
)
);
}
Index.cshtml:
<!DOCTYPE html>
<html>
<head>
<title>DHXScheduler initialization sample</title>
<style>
body {
background-color: #eee;
}
</style>
</head>
<body>
<div name="timeline_tab" style="height:700px;width:900px;margin:0 auto">
@Html.Raw(Model.Render())
</div>
</body>
</html>
<script src="~/scripts/dhtmlxScheduler/dhtmlxscheduler.js"></script>
<script src="~/scripts/dhtmlxScheduler/ext/dhtmlxscheduler_timeline.js"></script>