2017-09-11 12 views
0

DHTMLXScheduler를 MVC5 웹 응용 프로그램에 사용하여 환자를 추가하고 환자의 약속을 표시하고 달력에 표시하지만 데이터베이스에서 데이터를 가져 오는 중 문제가 있습니다. start_time 및 end_time에 따라 레코드가 추가되지 않습니다.데이터베이스에서 레코드를 가져와 DHTMLXScheduler에서 이벤트로 표시하는 방법 Calendar

달력 컨트롤러 :

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> 

답변

2

가 보이는 :

, START_DATE = e.StartTime.ToString(), end_date = e.EndT endtime에이 날짜 시간으로 통과하고 스케줄러 도우미에 의해 직렬화되는 동안 IME는

상영 시간은 시스템 문화 https://msdn.microsoft.com/en-us/library/k494fzbf(v=vs.110).aspx를 사용하여 문자열로 변환됩니다.

두 날짜를 모두 DateTime으로 전달하면 변경됩니까?

new Entities() 
    .AppointmentsLogs 
    .Select(e=> new 
    { 
     id = e.AppointmentId, 
     start_date = e.StartTime, 
     end_date=e.EndTime, 
     text = e.PatientName 
    });