Imports System.Web
Imports System.Web.Script.Serialization
Imports ICSharpCode.SharpZipLib
Imports System.Text
Imports System.Drawing
Namespace myHandder
    Public Class AjaxRequest : Implements IHttpHandler
        Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
            context.Response.ContentType = "text/plain"
            Dim mAction As String = IO.Path.GetFileName(context.Request.Path).Replace(".gdr", "")
            Dim FixAction() As String = {"ResponseRndImage"}
            Dim mSecurity As New SecurityManager.Security.Verification
            If Not FixAction.Contains(mAction) Then
                Dim msg As String = mSecurity.GetUrlSecurity(False, context, "\Manager\" & IO.Path.GetFileName(context.Request.Path))
                If msg.Length > 0 Then
                    Exit Sub
                End If
            End If

            Select Case mAction
                Case "GetTablsFields"
                    Dim mTable As New clsTable
                    mTable.GetTablsFields()
                Case "EditTable"
                    Dim mTable As New clsTable
                    mTable.EditTable()
                Case "DelTable"
                    Dim mTable As New clsTable
                    mTable.DelTable()
                Case "TableList"
                    Dim mTable As New clsTable
                    mTable.GetTableList()
                Case "EditField"
                    Dim mTable As New clsTable
                    mTable.EditField()
                Case "DelField"
                    Dim mTable As New clsTable
                    mTable.DelField()
                Case "FieldsList"
                    Dim mTable As New clsTable
                    mTable.GetFieldList()
                Case "SaveUpload"
                    Dim mFile As New clsFile
                    context.Response.Write(mFile.SaveUpload)
                Case "GetFolders"
                    Dim mFile As New clsFile
                    context.Response.Write(mFile.GetFolders)
                Case "GetFiles"
                    Dim mFile As New clsFile
                    context.Response.Write(mFile.GetFiles)
                Case "GetHTMLFile"
                    Dim mFile As New clsFile
                    context.Response.Write(mFile.GetHTMLFile)
                Case "GetTagClass"
                    Dim mTag As New clsTag
                    mTag.GetTagClass()
                Case "GetTagList"
                    Dim mTag As New clsTag
                    mTag.GetTagList()
                Case "GetSQLClass"
                    Dim mSQL As New clsSQL
                    mSQL.GetSQLClass()
                Case "GetSQLList"
                    Dim mSQL As New clsSQL
                    mSQL.GetSQLList()
                Case "GetFieldList"
                    Dim mSQL As New clsSQL
                    mSQL.GetFieldList()
                Case "DownLoad"
                    Dim mFile As New clsFile
                    mFile.DownLoad()
                Case "ExZip"
                    Dim mFile As New clsFile
                    context.Response.Write(mFile.ExZip)
                Case "AddFolder"
                    Dim mFile As New clsFile
                    context.Response.Write(mFile.AddFolder)
                Case "DelFolder"
                    Dim mFile As New clsFile
                    context.Response.Write(mFile.DelFolder)
                Case "DelFile"
                    Dim mFile As New clsFile
                    context.Response.Write(mFile.DelFile)
                Case "Menu"
                    Dim mPlug As New clsPlug
                    mPlug.Menu()
                Case "GetModel"
                    Dim mPlug As New clsPlug
                    mPlug.GetModel()
                Case "ChangeModel"
                    Dim mPlug As New clsPlug
                    mPlug.ChangeModel()
                Case "OpenModel"
                    Dim mPlug As New clsPlug
                    mPlug.OpenModel()
                Case "GetParameter"
                    Dim mPlug As New clsPlug
                    mPlug.GetParameter()
                Case "ChangeParNote"
                    Dim mPlug As New clsPlug
                    mPlug.ChangeParNote()
                Case "DeletePar"
                    Dim mPlug As New clsPlug
                    mPlug.DeletePar()
                Case "GetPlug"
                    Dim mPlug As New clsPlug
                    mPlug.GetPlug()
                Case "GetPar"
                    Dim mPlug As New clsPlug
                    mPlug.GetPar()
                Case "SavePlugSec"
                    Dim mPlug As New clsPlug
                    mPlug.SavePlugSec()
                Case "SaveSec"
                    Dim mPlug As New clsPlug
                    mPlug.SaveSec()
                Case "ResponseRndImage"
                    Dim mFile As New clsFile
                    mFile.ResponseRndImage()
                Case "GetJsList"
                    Dim mTag As New clsTag
                    mTag.GetJsList()
                Case "GetJs"
                    Dim mTag As New clsTag
                    mTag.GetJs()
                Case "SecurityModel"
                    Dim mPlug As New clsPlug
                    mPlug.SecurityModel()
                Case "LoadPlugClass"
                    Dim mPlug As New clsPlug
                    mPlug.LoadPlugClass()
                Case "GetSiteUrl"
                    HttpContext.Current.Response.Write(BaseFunction.PublicMethod.GetApplication("WebURL"))
                Case "ClearCache"
                    Dim mCacheEnum As IDictionaryEnumerator = HttpRuntime.Cache.GetEnumerator
                    While (mCacheEnum.MoveNext)
                        HttpRuntime.Cache.Remove(mCacheEnum.Key)
                    End While
            End Select
        End Sub
        Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
            Get
                Return False
            End Get
        End Property
    End Class
End Namespace
