我在全日历中遇到AllDay事件的问题,如果我将allday设置为false然后仍然显示为allday,有人可以看到为什么! 我已添加allday,所以我不知道它是否使用了正确的名称,但日历工作正常,它只是将所有事件显示为AllDays。
<%@ WebHandler Language="VB" Class="fullcalendarjson" %>
Imports System
Imports System.Collections.Generic
Imports System.Web
Imports System.IO
Public Class fullcalendarjson : Implements IHttpHandler
Public Sub ProcessRequest(context As HttpContext) Implements IHttpHandler.ProcessRequest
context.Response.ContentType = "text/plain"
context.Response.Expires = -1
Dim tasksList As IList(Of CalendarDTO) = New List(Of CalendarDTO)()
tasksList.Add(New CalendarDTO() With { _
.id = 1, _
.title = "Google search", _
.start = ToUnixTimespan(DateTime.Now), _
.[end] = ToUnixTimespan(DateTime.Now.AddHours(4)), _
.url = "www.google.com", _
.allday = False _
})
tasksList.Add(New CalendarDTO() With { _
.id = 1, _
.title = "Bing search", _
.start = ToUnixTimespan(DateTime.Now.AddDays(1)), _
.[end] = ToUnixTimespan(DateTime.Now.AddDays(1).AddHours(4)), _
.url = "www.bing.com", _
.allday = False _
})
tasksList.Add(New CalendarDTO() With { _
.id = 1, _
.title = "AllDay search", _
.start = ToUnixTimespan(DateTime.Now.AddDays(3)), _
.[end] = ToUnixTimespan(DateTime.Now.AddDays(3)), _
.url = "www.bing.com", _
.allday = True _
})
Dim oSerializer As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim sJSON As String = oSerializer.Serialize(tasksList)
context.Response.Write(sJSON)
End Sub
Private Function ToUnixTimespan([date] As DateTime) As Long
Dim tspan As TimeSpan = [date].ToUniversalTime().Subtract(New DateTime(1970, 1, 1, 0, 0, 0))
Return CLng(Math.Truncate(tspan.TotalSeconds))
End Function
Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
Public Class CalendarDTO
Public Property id() As Integer
Get
Return m_id
End Get
Set(value As Integer)
m_id = Value
End Set
End Property
Private m_id As Integer
Public Property title() As String
Get
Return m_title
End Get
Set(value As String)
m_title = Value
End Set
End Property
Private m_title As String
Public Property start() As Long
Get
Return m_start
End Get
Set(value As Long)
m_start = Value
End Set
End Property
Private m_start As Long
Public Property [end]() As Long
Get
Return m_end
End Get
Set(value As Long)
m_end = Value
End Set
End Property
Private m_end As Long
Public Property url() As String
Get
Return m_url
End Get
Set(value As String)
m_url = Value
End Set
End Property
Private m_url As String
Public Property allday() As String
Get
Return m_allday
End Get
Set(value As String)
m_allday = value
End Set
End Property
Private m_allday As String
End Class
End Class