2012-03-01 5 views
0

을 사용하여 전체 달력 v 1.5.3을 MS SQL Server에 연결하는 방법 asp.net webforms 및 vb.net을 사용하여 SQL Server에 FullCalendar v1.4.2를 성공적으로 연결했습니다. v1.5.3으로 업데이트하고 싶지만 원래의 통합 코드가 더 이상 작동하지 않으며 수정 방법을 볼 수 없습니다.asp.net C#/VB

둘째, 끌어서 놓기 기능을 추가하여 asp.net에서 끌어서 놓기 데이터베이스를 업데이트 할 수 있도록 도와 드리고 싶습니다. 그러나 그 위치를 시작할 위치가 확실하지 않습니다. 다음과 같이

즉 V 1.4.2 근무 내가 가진 코드는 다음과 같습니다 나는이와 사투를 벌인거야

<script type="text/javascript" language="javascript"> 
     $(document).ready(function() { 
      $('#calendar').fullCalendar({ 
       header: { 
        left: 'prev, next today', 
        center: 'title', 
        right: 'month, basicWeek, basicDay' 
       }, 
       events: "Calendar.asmx/EventList" 
      }); 

     }); 
</script> 
Imports System 
Imports System.Data 
Imports System.Web.Services 
Imports System.Data.SqlClient 
Imports System.Web.Services.Protocols 
Imports System.ComponentModel 
Imports System.Collections.Generic 
Imports System.Web.UI.Page 


<System.Web.Script.Services.ScriptService()> _ 
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _ 
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _ 
<ToolboxItem(False)> _ 
Public Class Calendar 
    Inherits System.Web.Services.WebService 

    <WebMethod()> _ 
    Public Function EventList(ByVal startDate As String, ByVal endDate As String) As String 
     ' List to hold events 
     Dim events As List(Of CalendarDTO) = New List(Of CalendarDTO)() 

     Dim WebConfigConnection As String = ConfigurationManager.ConnectionStrings("FresheyeTimeTrackerConnectionString").ConnectionString 
     Dim query As String = "SELECT * FROM CORE_PROJECT" 
     Dim conn As New SqlConnection(WebConfigConnection) 
     Dim cmd As New SqlCommand(query, conn) 
     Dim da As New SqlDataAdapter(cmd) 
     Dim ds As New DataSet() 
     da.Fill(ds) 
     'If startDate > ToUnixTimespan(DateTime.Now) Then 
     'GoTo x 
     'End If 
     Dim starting As DateTime = FromUnixTimespan(startDate) 
     ' Loop through events to be added 
     For i As Integer = 0 To ds.Tables(0).Rows.Count - 1 
      If String.IsNullOrEmpty(ds.Tables(0).Rows(i)("ProjectDeliveryDate").ToString()) Then 


      Else 

       ' Create a new event and start to populate 
       Dim value As CalendarDTO = New CalendarDTO() 
       ' Date is required to be in a unix format 
       value.StartDate = ToUnixTimespan(DateTime.Parse(ds.Tables(0).Rows(i)("ProjectAddedDate").ToString)) 
       value.id = ds.Tables(0).Rows(i)("ProjectID").ToString() 
       value.title = ds.Tables(0).Rows(i)("ProjectTitle").ToString() 
       value.EndDate = ToUnixTimespan(DateTime.Parse(ds.Tables(0).Rows(i)("ProjectDeliveryDate").ToString)) 
       events.Add(value) 

      End If 

     Next 
     ' Serialize the return value so it can be decoded in java. 

x: 

     Dim js As New System.Web.Script.Serialization.JavaScriptSerializer 
     Return js.Serialize(events) 
    End Function 

    Private Function ToUnixTimespan(ByVal d As DateTime) As Int64 
     Dim time As New TimeSpan() 
     time = d.ToUniversalTime().Subtract(New DateTime(1970, 1, 1, 0, 0, 0)) 

     Return CType(Math.Truncate(time.TotalSeconds), Int64) 
    End Function 

    Private Function FromUnixTimespan(ByVal s As String) As DateTime 
     Dim time As DateTime = New DateTime(1970, 1, 1, 0, 0, 0) 
     Return time.AddSeconds(s) 
    End Function 
End Class 
+0

@ 브라이언 ....에 게시 대답 몇 찾고 있어요 - 나 아니었지만, 나는 몇 가지 이유를 제시 할 수있는 이유 중 하나 might : 산문에서 문장이 없습니다. 코드 서식이 구문 형광펜을 손상 시켰습니다. vb.net 관련 질문에 대한 C# 태그. 이 질문에 여분의 불필요한 코드가 포함되어 있습니다. 고맙게도, 나는 그 대부분을 수정하기 위해 편집 할 수 있습니다. –

+0

C# 또는 VB 언어로이 솔루션을 원했기 때문에 저는 C# 태그를 배치 했습니까? – user1243663

답변

0

우리가 비슷한 장소에서 코드를 빌려처럼 ... 그것은 보인다. ..

위의 코드에서 startDate 및 endDate를 시작 및 끝으로 다시 변환하지 않는 것 같습니다. FullCalendar.js에서이 작업을 수행 했습니까?

기본적으로 나는 돌아 오는 이벤트 전에 반환하는 문자열에 startDate 및 EndDate 대신 시작 및 끝이 포함되도록 바꾸기 전에는 거의 동일합니다.

내 코드는 Chrome에서는 정상적으로 작동하지만 IE에서는 작동하지 않는 것 같습니다. DB 업데이트로

... 난

FullCalendar, how do I allow users to edit/delete events and remove them from the database?

+0

FullCalendar.js의 기능을 수정하여 시작과 끝을 startDate와 end Date로 변경하는 방법을 모르겠습니다. 난 그냥 v1.4에 대한 샘플 코드를 다운로드 나는 그 코드를 데이터베이스에 연결하는 데 사용하고 그것은 잘 작동 하지만 그 v1.5.3에 대한 동일한 코드를 사용했을 때 작동하지 않았다 v1.5.3 당신을 위해 일하고있다 크롬에요? 코드를 제공해 주시겠습니까? 덕분에 ! – user1243663

+0

좋아요, 어디에서 코드를 가져 왔는지 확실하지 않지만 [link] (http://jake1164.blogspot.com/2011/02/full-calendar-1-410.html)에서 코드를 수정했습니다. jsonSerial이 fullCalendar에 대한 올바른 매개 변수를 갖도록하는 Replace ("EndDate", "end")는 js.Serialize (events) .Replace ("StartDate", "start")를 대체합니다. startDate 및 endDate가 아닌 start 및 end를 예상합니다. 다음은 fullCalendar.js의 개조입니다. 위에서 언급 한 블로그에서 파일을 얻은 경우 A Shaw의 원본에서 수정되었습니다. 블로그는 변경된 내용을 언급합니다. 당신은 1.5.3에서 비슷하게 만들 필요가있다. – Mych

+0

계속 ... 블로그는 1.4.10에 대한 두 가지 변경 사항을 언급하지만, 1.5.3에서는 startParam을 startDate로 변경하고 endParam을 endParam으로 변경했다. endDate. 그 이유는 VB에서는 끝 부분에 예약어가 있기 때문입니다. 1.5.3에서는 GET에서 POST로 유형을 설정하는 두 번째 변경 사항이 이제는 옵션이므로 j를 변경할 필요가 없습니다. url : 'yourwebservice.asmx'와 같이 소스를 지정할 때 옵션 중 하나로 포함하십시오. 'POST' – Mych