Initial
This commit is contained in:
69
EDOKA/Plugin/clsPlugin.vb
Normal file
69
EDOKA/Plugin/clsPlugin.vb
Normal file
@@ -0,0 +1,69 @@
|
||||
Imports System.Data
|
||||
Imports System.Data.SqlTypes
|
||||
Imports System.Data.SqlClient
|
||||
Imports PluginContracts
|
||||
|
||||
Public Class clsPlugin
|
||||
|
||||
Public PluginRechte As DataTable
|
||||
Dim rechte_gelesen As Boolean = False
|
||||
Public Function get_path() As String
|
||||
|
||||
Dim connection As New SqlConnection()
|
||||
Dim da As New SqlDataAdapter("Select beschreibung from pluginparameter where pluginparamnr=1", connection)
|
||||
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(da)
|
||||
Dim ds As New DataSet()
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionString
|
||||
connection.Open()
|
||||
da.Fill(ds, "params")
|
||||
Return ds.Tables(0).Rows(0).Item(0)
|
||||
Catch ex As Exception
|
||||
Return ""
|
||||
End Try
|
||||
CB = Nothing
|
||||
ds = Nothing
|
||||
da = Nothing
|
||||
connection.Close()
|
||||
connection = Nothing
|
||||
Return True
|
||||
End Function
|
||||
|
||||
|
||||
Public Function Check_Berechtigungen(pluginname As String) As Boolean
|
||||
If rechte_gelesen = False Then get_pluginrechte()
|
||||
For Each r As DataRow In PluginRechte.Rows
|
||||
If r(0) = pluginname Then
|
||||
Return True
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
Next
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Public Function get_pluginrechte() As String
|
||||
|
||||
Dim connection As New SqlConnection()
|
||||
Dim da As New SqlDataAdapter("SELECT dbo.Plugin.Beschreibung, dbo.plugin.Bezeichnung FROM dbo.Plugin INNER JOIN dbo.PluginBerechtigung ON dbo.Plugin.PluginNr = dbo.PluginBerechtigung.PluginNr WHERE (dbo.Plugin.aktiv = 1) AND (dbo.PluginBerechtigung.aktiv = 1) AND (dbo.PluginBerechtigung.Mitarbeiternr = " + Globals.MitarbeiterNr.ToString + ")", connection)
|
||||
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(da)
|
||||
Dim ds As New DataSet()
|
||||
Try
|
||||
connection.ConnectionString = Globals.sConnectionString
|
||||
connection.Open()
|
||||
da.Fill(ds, "rechte")
|
||||
Me.PluginRechte = ds.Tables(0).Copy
|
||||
Return "Rechte vorhanden"
|
||||
Catch ex As Exception
|
||||
Return ""
|
||||
End Try
|
||||
CB = Nothing
|
||||
ds = Nothing
|
||||
da = Nothing
|
||||
connection.Close()
|
||||
connection = Nothing
|
||||
rechte_gelesen = True
|
||||
End Function
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user