/
ivan
/
ModMas
Обзор
Документация
Войти
/
ivan
/
ModMas
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
ModuleMaster/pm/schedule.ashx
79 строк
3 KB
i.krivokon
Initial commit
13 мар 2026, 13:49
13 мар 2026, 13:49
00d9fb6
Код
Авторство
О чём код?
<%@ WebHandler Language="VB" Class="schedule" %> Imports System Imports System.Web Imports System.Data Imports sharedClasses.dbFunctions Imports Newtonsoft.Json Public Class schedule : Implements IHttpHandler Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest Dim action As String = context.Request.QueryString("action") Dim data As String = context.Request.QueryString("data") Dim eventName As String = context.Request.QueryString("eventname") context.Response.ContentType = "text" '"application/json; charset=utf-8" Select Case action Case "getschedule" context.Response.Write(getJson()) Case "event" Select Case eventName Case "addlink" context.Response.Write("link added") Case "deletelink" context.Response.Write("link deleted") Case "updatelink" context.Response.Write("link updated") Case "addtask" context.Response.Write("task added") Case "deletetask" context.Response.Write("task deleted") Case "updatetask" context.Response.Write("task updated") End Select Case Else context.Response.Write("") End Select End Sub Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable Get Return False End Get End Property Private sqlf As New SqlFunctions Private Function getTasks() As DataTable Dim sql As New StringBuilder sql.AppendLine("SELECT id, [text], ") sql.AppendLine("convert(varchar,convert(date, start_date, 121),105) as start_date, ") sql.AppendLine("duration, ") sql.AppendLine("progress, ") sql.AppendLine("case [open] when 'Y' then 'true' else 'false' end as [open], ") sql.AppendLine("parent ") sql.AppendLine("FROM UserModules.[user].[TASKS] ") Dim dt As DataTable = sqlf.GetData(sql.ToString) dt.TableName = "tasks" Return dt End Function Private Function getLinks() As DataTable Dim sql As New StringBuilder sql.AppendLine("SELECT id, [source], ") sql.AppendLine("[target], [type] ") sql.AppendLine("FROM UserModules.[user].[links] ") Dim dt As DataTable = sqlf.GetData(sql.ToString) dt.TableName = "links" Return dt End Function Public Function getJson() As String Dim tasks As String = JsonConvert.SerializeObject(getTasks()) Dim links As String = JsonConvert.SerializeObject(getLinks()) Dim result As String = "{""data"":" & tasks & ",""links"":" & links & "}" Return result End Function End Class