Diverses
This commit is contained in:
@@ -7,7 +7,9 @@ Public Class Class1
|
||||
'Public Shared DBConString As String = "Server=NBMIESENBECK\SPIELWIESE;Initial Catalog=Doku;User ID=sa;Password=verag#3;Connection Timeout=5;"
|
||||
Public Shared DBConString As String
|
||||
Public Shared DBConstringDev As String = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;"
|
||||
Public Shared DBADMINBuchhaltung As String = "Data Source=192.168.0.94\SQLEXPRESS;Initial Catalog=ADMIN;Integrated Security=false;User ID=sa;Password=BmWr501956;"
|
||||
Public Shared DBADMINBuchhaltung As String = "Data Source=BUCHHALTUNG.verag.ost.dmn\SQLEXPRESS;Initial Catalog=ADMIN;Integrated Security=false;User ID=sa;Password=BmWr501956;"
|
||||
Public Shared DBDoku As String = "Server=buchhaltung.verag.ost.dmn\SQLEXPRESS;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;"
|
||||
Public Shared DBDokuTest As String = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;"
|
||||
'Public Shared FilePath As String = "\\192.168.0.253\backup\temp_Sebastian\Spielwiese\Doku"
|
||||
Public Shared FilePath As String ' = "\\192.168.0.90\f\EDV-Wartung\Dokumentation"
|
||||
Public Shared Absender As String = "Absender Standard"
|
||||
@@ -51,10 +53,10 @@ Public Class Class1
|
||||
If (Main.sAppPath Like "*\bin\Debug" Or Startparameter = "debug") And Debugoverride = False Then
|
||||
DebugMode = True
|
||||
|
||||
Class1.DBConString = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;"
|
||||
Class1.DBConString = DBDokuTest '"Server=DEVELOPER.verag.ost.dmn\DEVSQL;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;"
|
||||
Class1.FilePath = "\\192.168.0.253\backup\temp_Sebastian\DokuTest"
|
||||
Else
|
||||
Class1.DBConString = "Server=buchhaltung.verag.ost.dmn\SQLEXPRESS;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;"
|
||||
Class1.DBConString = DBDoku '"Server=buchhaltung.verag.ost.dmn\SQLEXPRESS;Initial Catalog=Doku;User ID=sa;Password=BmWr501956;Connection Timeout=5;"
|
||||
Class1.FilePath = "\\DEVELOPER.verag.ost.dmn\f\EDV-Wartung\Dokumentation"
|
||||
End If
|
||||
End Function
|
||||
|
||||
226
Dokumentation/Classes/cDomUser.vb
Normal file
226
Dokumentation/Classes/cDomUser.vb
Normal file
@@ -0,0 +1,226 @@
|
||||
Imports System.Reflection
|
||||
|
||||
Public Class cDomUser
|
||||
|
||||
Property du_ID As String = ""
|
||||
Property du_Email_Activated As Boolean = False
|
||||
Property du_EMail As String = ""
|
||||
Property du_Vorname As String = ""
|
||||
Property du_Nachname As String = ""
|
||||
Property du_Abteilung As String = ""
|
||||
Property du_TelNummer As String = ""
|
||||
Property du_DW As String = ""
|
||||
Property du_Kennwort As String = ""
|
||||
Property du_Dom As String = ""
|
||||
Property du_sAMAc As String = ""
|
||||
Property du_Info As String = ""
|
||||
Property mit_username As String = ""
|
||||
Property mit_pwd As String = ""
|
||||
'-----------------------------------------
|
||||
Dim SelectItems As String = ""
|
||||
Public Exist As Boolean = False
|
||||
|
||||
Public Sub New()
|
||||
SelectItems = Selectinator3000(getparameterlistMaster())
|
||||
' MsgBox(SelectItems)
|
||||
End Sub
|
||||
|
||||
|
||||
Function getparameterlistMaster() As List(Of SQLVariable)
|
||||
Dim list As New List(Of SQLVariable)
|
||||
|
||||
list.Add(New SQLVariable("du_ID", du_ID))
|
||||
list.Add(New SQLVariable("du_Email_Activated", du_Email_Activated))
|
||||
list.Add(New SQLVariable("du_EMail", du_EMail))
|
||||
list.Add(New SQLVariable("du_Vorname", du_Vorname))
|
||||
list.Add(New SQLVariable("du_Nachname", du_Nachname))
|
||||
list.Add(New SQLVariable("du_Abteilung", du_Abteilung))
|
||||
list.Add(New SQLVariable("du_TelNummer", du_TelNummer))
|
||||
list.Add(New SQLVariable("du_DW", du_DW))
|
||||
list.Add(New SQLVariable("du_Kennwort", du_Kennwort))
|
||||
list.Add(New SQLVariable("du_Dom", du_Dom))
|
||||
list.Add(New SQLVariable("du_sAMAc", du_sAMAc))
|
||||
list.Add(New SQLVariable("du_Info", du_Info))
|
||||
list.Add(New SQLVariable("mit_username", mit_username))
|
||||
list.Add(New SQLVariable("mit_pwd", mit_pwd))
|
||||
Return list
|
||||
End Function
|
||||
|
||||
Public Function getDomUser(Filterspalte As String, Filterbegriff As String)
|
||||
Dim ds As New DataSet
|
||||
|
||||
cSQL.SQL2DS("select " & SelectItems & " from [Buchhaltung\sqlexpress].doku.dbo.tbl_domuser as Doku left join [Buchhaltung\sqlexpress].ADMIN.dbo.tblMitarbeiter on mit_AliasAD_Username = du_sAMAc where " & Filterspalte & "= '" & Filterbegriff & "'", ds)
|
||||
|
||||
If ds.Tables(0).Rows.Count > 0 Then Exist = True
|
||||
|
||||
For Each c As DataColumn In ds.Tables(0).Columns
|
||||
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(c.ColumnName)
|
||||
If propInfo IsNot Nothing Then
|
||||
If Not IsDBNull(c.Table.Rows(0).Item(c)) Then
|
||||
propInfo.SetValue(Me, c.Table.Rows(0).Item(c))
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
' MsgBox("hier")
|
||||
End Function
|
||||
|
||||
Public Function getDomUserByID(ID As String)
|
||||
Dim ds As New DataSet
|
||||
|
||||
cSQL.SQL2DS("select " & SelectItems & " from [Buchhaltung\sqlexpress].doku.dbo.tbl_domuser as Doku left join [Buchhaltung\sqlexpress].ADMIN.dbo.tblMitarbeiter on mit_AliasAD_Username = du_sAMAc WHERE du_ID = '" & ID & "'", ds)
|
||||
|
||||
If ds.Tables(0).Rows.Count > 0 Then Exist = True
|
||||
|
||||
For Each c As DataColumn In ds.Tables(0).Columns
|
||||
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(c.ColumnName)
|
||||
If propInfo IsNot Nothing Then
|
||||
If Not IsDBNull(c.Table.Rows(0).Item(c)) Then
|
||||
propInfo.SetValue(Me, c.Table.Rows(0).Item(c))
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
' MsgBox("hier")
|
||||
End Function
|
||||
|
||||
Public Function Save()
|
||||
If du_sAMAc = "" Or du_Dom = "" Then
|
||||
MsgBox("Domänen-Benutzer und Domäne sind Pflichtfelder!") : Exit Function
|
||||
End If
|
||||
|
||||
If CheckExist() = True Then
|
||||
'-------------------------------------------------------------------------Update
|
||||
Dim update, where As String
|
||||
Dim list = getparameterlistMaster()
|
||||
For Each i In list
|
||||
If i.SQLText = "mit_pwd" Or i.SQLText = "mit_username" Then
|
||||
ElseIf Not i.SQLText = "du_ID" Then
|
||||
update &= "[" & i.SQLText & "]='" & i.SQLValue & "',"
|
||||
Else
|
||||
where &= "du_ID = '" & i.SQLValue & "'"
|
||||
End If
|
||||
Next
|
||||
update = update.Substring(0, update.Length - 1)
|
||||
cSQL.UpdateSQL("TbL_DomUser", update, where, Class1.DBDoku)
|
||||
|
||||
ElseIf CheckExist() = -1 Then
|
||||
Exit Function
|
||||
Else
|
||||
'-------------------------------------------------------------------------Insert
|
||||
Dim Spalten As String = ""
|
||||
Dim Werte As String = ""
|
||||
Dim InsertString As String = ""
|
||||
du_ID = Guid.NewGuid().ToString("N")
|
||||
Dim List As List(Of SQLVariable) = getparameterlistMaster()
|
||||
For Each i In List
|
||||
If i.SQLText = "mit_pwd" Or i.SQLText = "mit_username" Then
|
||||
Else
|
||||
Spalten &= i.SQLText & ","
|
||||
Werte &= "'" & i.SQLValue & "',"
|
||||
End If
|
||||
Next
|
||||
Spalten = Spalten.Substring(0, Spalten.Length - 1)
|
||||
Werte = Werte.Substring(0, Werte.Length - 1)
|
||||
|
||||
cSQL.InsertSQL("TbL_DomUser", "(" & Spalten & ") VALUES (" & Werte & ")", Class1.DBDoku)
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
Function CheckExist() As Boolean
|
||||
Dim ds As New DataSet
|
||||
cSQL.SQL2DS("select * from Doku.dbo.TbL_DomUser where du_ID = '" & du_ID & "'", ds, Class1.DBADMINBuchhaltung)
|
||||
|
||||
If ds.Tables(0).Rows.Count > 0 Then
|
||||
Return True
|
||||
Else
|
||||
Dim dsa As New DataSet
|
||||
cSQL.SQL2DS("select * from Doku.dbo.TbL_DomUser where du_sAMAc = '" & du_sAMAc & "' AND du_Dom = '" & du_Dom & "'", dsa, Class1.DBADMINBuchhaltung)
|
||||
If dsa.Tables(0).Rows.Count > 0 Then
|
||||
If MsgBox("Achtung! Die Kombination aus Domäne und Benutzer existiert bereits! Trotzdem speichern?", MsgBoxStyle.YesNo, "Speichern...") = MsgBoxResult.No Then
|
||||
Return -1
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
End If
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
Public Function getFromAvisoUser(Optional ByVal AvisoUser As String = "")
|
||||
If AvisoUser = "" Then
|
||||
AvisoUser = Me.mit_username
|
||||
End If
|
||||
|
||||
Dim ds As New DataSet
|
||||
cSQL.SQL2DS("select * from ADMIN.dbo.tblMitarbeiter where mit_username = '" & AvisoUser & "'", ds, Class1.DBADMINBuchhaltung)
|
||||
|
||||
If ds.Tables(0).Rows.Count = 0 Then MsgBox("Benutzer nicht gefunden.") : Exit Function
|
||||
If ds.Tables(0).Rows.Count = 1 Then
|
||||
du_EMail = Class1.DBNull2emptyString(ds.Tables(0).Rows(0).Item("mit_email"))
|
||||
If du_EMail.Length > 1 Then du_Email_Activated = True
|
||||
mit_username = Class1.DBNull2emptyString(ds.Tables(0).Rows(0).Item("mit_username"))
|
||||
mit_pwd = Class1.DBNull2emptyString(ds.Tables(0).Rows(0).Item("mit_pwd"))
|
||||
du_Vorname = Class1.DBNull2emptyString(ds.Tables(0).Rows(0).Item("mit_vname"))
|
||||
du_Nachname = Class1.DBNull2emptyString(ds.Tables(0).Rows(0).Item("mit_nname"))
|
||||
du_Abteilung = Class1.DBNull2emptyString(ds.Tables(0).Rows(0).Item("mit_abteilung"))
|
||||
du_TelNummer = Class1.DBNull2emptyString(ds.Tables(0).Rows(0).Item("mit_mobiltel"))
|
||||
du_DW = Class1.DBNull2emptyString(ds.Tables(0).Rows(0).Item("mit_durchwahl"))
|
||||
du_Dom = Class1.DBNull2emptyString(ds.Tables(0).Rows(0).Item("mit_aliasad_domain"))
|
||||
du_sAMAc = Class1.DBNull2emptyString(ds.Tables(0).Rows(0).Item("mit_aliasad_username"))
|
||||
End If
|
||||
|
||||
Exist = True
|
||||
|
||||
' MsgBox(du_EMail)
|
||||
End Function
|
||||
|
||||
Public Function getFromAvisoUserLIST(AvisoUser As String)
|
||||
Dim ds As New DataSet
|
||||
Dim AvisoUserList As New List(Of cDomUser)
|
||||
cSQL.SQL2DS("select * from ADMIN.dbo.tblMitarbeiter where mit_username = '" & AvisoUser & "'", ds, Class1.DBADMINBuchhaltung)
|
||||
For Each row As DataRow In ds.Tables(0).Rows
|
||||
Dim tempdu As New cDomUser
|
||||
tempdu.du_EMail = Class1.DBNull2emptyString(row.Item("mit_email"))
|
||||
If tempdu.du_EMail.Length > 1 Then tempdu.du_Email_Activated = True
|
||||
tempdu.mit_username = Class1.DBNull2emptyString(row.Item("mit_username"))
|
||||
tempdu.mit_pwd = Class1.DBNull2emptyString(row.Item("mit_pwd"))
|
||||
tempdu.du_Vorname = Class1.DBNull2emptyString(row.Item("mit_vname"))
|
||||
tempdu.du_Nachname = Class1.DBNull2emptyString(row.Item("mit_nname"))
|
||||
tempdu.du_Abteilung = Class1.DBNull2emptyString(row.Item("mit_abteilung"))
|
||||
tempdu.du_TelNummer = Class1.DBNull2emptyString(row.Item("mit_mobiltel"))
|
||||
tempdu.du_DW = Class1.DBNull2emptyString(row.Item("mit_durchwahl"))
|
||||
tempdu.du_Dom = Class1.DBNull2emptyString(row.Item("mit_aliasad_domain"))
|
||||
tempdu.du_sAMAc = Class1.DBNull2emptyString(row.Item("mit_aliasad_username"))
|
||||
AvisoUserList.Add(tempdu)
|
||||
Next
|
||||
Return AvisoUserList
|
||||
End Function
|
||||
|
||||
Public Function Selectinator3000(varlist As List(Of SQLVariable)) As String
|
||||
Dim Ding As String = ""
|
||||
|
||||
For Each var In varlist
|
||||
Ding &= var.SQLText & ", "
|
||||
Next
|
||||
Ding = Ding.Substring(0, (Ding.Length - 2))
|
||||
|
||||
Return Ding
|
||||
End Function
|
||||
|
||||
Public Function Delete()
|
||||
If MsgBox("Benutzer " & du_Vorname & " " & du_Nachname & ", " & du_sAMAc & " löschen?", MsgBoxStyle.OkCancel, "Benutzer löschen?") = MsgBoxResult.Ok Then
|
||||
cSQL.DeleteSQL("Doku.dbo.TbL_DomUser", "du_ID = '" & du_ID & "'", Class1.DBADMINBuchhaltung)
|
||||
Else
|
||||
Exit Function
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Shared Function Delete(ID As String)
|
||||
If MsgBox("Benutzer löschen?", MsgBoxStyle.OkCancel, "Benutzer löschen?") = MsgBoxResult.Ok Then
|
||||
cSQL.DeleteSQL("Doku.dbo.TbL_DomUser", "du_ID = '" & ID & "'", Class1.DBADMINBuchhaltung)
|
||||
Else
|
||||
Exit Function
|
||||
End If
|
||||
End Function
|
||||
|
||||
|
||||
End Class
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
Public Class cSQL
|
||||
|
||||
Public Shared Sub SQL2DS(ByRef selector As String, ByRef ds As DataSet)
|
||||
Public Shared Sub SQL2DS(ByRef selector As String, ByRef ds As DataSet, Optional ByRef DBConnect As String = "")
|
||||
If DBConnect = "" Then DBConnect = Class1.DBConString
|
||||
Dim con As New SqlConnection
|
||||
Dim cmd As New SqlCommand
|
||||
con.ConnectionString = Class1.DBConString
|
||||
con.ConnectionString = DBConnect 'Class1.DBConString
|
||||
cmd.Connection = con
|
||||
|
||||
Dim dataadapter As New SqlDataAdapter(selector, con)
|
||||
@@ -14,10 +15,11 @@ Public Class cSQL
|
||||
con.Close()
|
||||
End Sub
|
||||
|
||||
Public Shared Sub UpdateSQL(ByRef table As String, ByRef values As String, ByRef where As String)
|
||||
Public Shared Sub UpdateSQL(ByRef table As String, ByRef values As String, ByRef where As String, Optional ByRef DBConnect As String = "")
|
||||
If DBConnect = "" Then DBConnect = Class1.DBConString
|
||||
Dim con As New SqlConnection
|
||||
Dim cmd As New SqlCommand
|
||||
con.ConnectionString = Class1.DBConString
|
||||
con.ConnectionString = DBConnect ' Class1.DBConString
|
||||
cmd.Connection = con
|
||||
|
||||
con.Open()
|
||||
@@ -26,10 +28,11 @@ Public Class cSQL
|
||||
con.Close()
|
||||
End Sub
|
||||
|
||||
Public Shared Sub InsertSQL(ByRef table As String, ByRef insert As String)
|
||||
Public Shared Sub InsertSQL(ByRef table As String, ByRef insert As String, Optional ByRef DBConnect As String = "")
|
||||
If DBConnect = "" Then DBConnect = Class1.DBConString
|
||||
Dim con As New SqlConnection
|
||||
Dim cmd As New SqlCommand
|
||||
con.ConnectionString = Class1.DBConString
|
||||
con.ConnectionString = DBConnect ' Class1.DBConString
|
||||
cmd.Connection = con
|
||||
|
||||
con.Open()
|
||||
@@ -38,10 +41,11 @@ Public Class cSQL
|
||||
con.Close()
|
||||
End Sub
|
||||
|
||||
Public Shared Sub DeleteSQL(ByRef table As String, ByRef where As String)
|
||||
Public Shared Sub DeleteSQL(ByRef table As String, ByRef where As String, Optional ByRef DBConnect As String = "")
|
||||
If DBConnect = "" Then DBConnect = Class1.DBConString
|
||||
Dim con As New SqlConnection
|
||||
Dim cmd As New SqlCommand
|
||||
con.ConnectionString = Class1.DBConString
|
||||
con.ConnectionString = DBConnect ' Class1.DBConString
|
||||
cmd.Connection = con
|
||||
|
||||
con.Open()
|
||||
@@ -50,10 +54,11 @@ Public Class cSQL
|
||||
con.Close()
|
||||
End Sub
|
||||
|
||||
Public Shared Sub SQLCommand(command As String)
|
||||
Public Shared Sub SQLCommand(command As String, Optional ByRef DBConnect As String = "")
|
||||
If DBConnect = "" Then DBConnect = Class1.DBConString
|
||||
Dim con As New SqlConnection
|
||||
Dim cmd As New SqlCommand
|
||||
con.ConnectionString = Class1.DBConString
|
||||
con.ConnectionString = DBConnect ' Class1.DBConString
|
||||
cmd.Connection = con
|
||||
|
||||
con.Open()
|
||||
|
||||
Reference in New Issue
Block a user