Imports System.Data.SqlClient


Public Class cMitarbeiter
    Property mit_id As Integer
    Property mit_username As String = ""
    Property mit_abweichenderAnzeigename As String = ""
    Property mit_pwd As String = ""
    Property mit_geschlecht As String = ""
    Property mit_affix As String = ""
    Property mit_vname As String = ""
    Property mit_nname As String = ""
    Property mit_gebdat As String = ""
    Property mit_strasse As String = ""
    Property mit_hausnr As String = ""
    Property mit_land As String = ""
    Property mit_plz As String = ""
    Property mit_ort As String = ""
    Property mit_niederlassung As String = ""
    Property mit_abteilung As String = ""
    Property mit_position As String = ""
    Property mit_durchwahl As String = ""
    Property mit_email As String = ""
    Property mit_mobiltel As String = ""
    Property mit_allowAnruf As Boolean
    Property mit_info As String = ""
    Property mit_einstiegsdatum As String = ""
    Property mit_gekuendigt As Boolean
    Property mit_kuendigungsdatum As String = ""
    Property mit_foto As String = ""
    Property mit_firma As String = "VERAG"
    Property mit_firmaFMZoll As Object = Nothing
    Property mit_FMZollPersID As Object = Nothing
    Property mit_standartFiliale As Integer = -1
    Property mit_standardPreisliste As Integer = -1
    Property mit_FMZollPersIDKasseIsnotSpedBuch As Boolean = False
    Property mit_FMZollPersIDSpedBuch As Object = Nothing
    Property mit_DpUserStandardDP As Object = Nothing
    Property mit_DpUserStandardFirma As Object = Nothing
    Property mit_DpUserStandardFirma2 As Object = Nothing

    Property mit_EZOLL_SB As Object = Nothing
    Property mit_ATLAS_SB As Object = Nothing
    Property mit_pseudoUser As Boolean = False

    Property mit_FirmenDatenAnzeige As Object = Nothing

    Property mit_DAKOSY_SB As Object = Nothing
    Property mit_DAKOSY_SBFull As Object = Nothing
    Property mit_TESTonly As Object = Nothing
    Property mit_PasswortChanged As Object = Nothing
    Property mit_TELOTEC_SB As Object = Nothing


    Property mit_AliasAD_Domain As Object = Nothing
    Property mit_AliasAD_Username As Object = Nothing
    Property mit_AliasAD_Domain2 As Object = Nothing
    Property mit_AliasAD_Username2 As Object = Nothing

    Property mit_teamId As Object = Nothing
    Property mit_ChatBenutzer As Boolean = True
    Property mit_FirmaHaupt As Object = Nothing
    Property mit_ChatEasteregg As Boolean = False



    Property mit_MAVerzeichnis_SettingsTstmp As Object = Nothing
    Property mit_MAVerzeichnis_allowGebDat As Boolean = False
    Property mit_MAVerzeichnis_allowWohnadresse As Boolean = False
    Property mit_MAVerzeichnis_allowGebDatOhneJahr As Boolean = False
    Property mit_MAVerzeichnis_allowHandynummer As Boolean = False
    Property mit_MAVerzeichnis_allowFoto As Boolean = False


    Property mit_MAVerzeichnis_Motto As Object = Nothing
    Property mit_MAVerzeichnis_Spitzname As Object = Nothing

    Property mit_foto_DocId As Object = Nothing
    Property mit_sprache As String = "DE"
    Property mit_fakturierungsgruppe As String = ""


    Dim SQL As New SQL

    Sub New()

    End Sub

    Sub New(id)
        Me.mit_id = id
        LOAD(id)

    End Sub
    ' Dim SQL As New SQL

    Public Function Fullname() As String
        Return (If(mit_vname, "") & " " & If(mit_nname, "")).Trim
    End Function


    Public Function getFirma() As String
        If mit_firma Is Nothing Then Return ""
        Select Case mit_firma
            Case "ALLE", "BEIDE", "ALL"
                Return If(mit_FirmaHaupt, "")
        End Select
        Return mit_firma
    End Function

    Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_id", mit_id,, True, True))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_username", mit_username))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_abweichenderAnzeigename", mit_abweichenderAnzeigename))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_pwd", mit_pwd))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_geschlecht", mit_geschlecht))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_affix", mit_affix))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_vname", mit_vname))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_nname", mit_nname))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_gebdat", mit_gebdat))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_strasse", mit_strasse))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_hausnr", mit_hausnr))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_land", mit_land))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_plz", mit_plz))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_ort", mit_ort))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_niederlassung", mit_niederlassung))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_abteilung", mit_abteilung))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_position", mit_position))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_durchwahl", mit_durchwahl))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_email", mit_email))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_mobiltel", mit_mobiltel))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_allowAnruf", mit_allowAnruf))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_info", mit_info))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_einstiegsdatum", mit_einstiegsdatum))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_gekuendigt", mit_gekuendigt))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_kuendigungsdatum", mit_kuendigungsdatum))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_foto", mit_foto))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_firma", mit_firma))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_firmaFMZoll", mit_firmaFMZoll))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_FMZollPersID", mit_FMZollPersID))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_standartFiliale", mit_standartFiliale))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_standardPreisliste", mit_standardPreisliste))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_FMZollPersIDKasseIsnotSpedBuch", mit_FMZollPersIDKasseIsnotSpedBuch))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_FMZollPersIDSpedBuch", mit_FMZollPersIDSpedBuch))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_DpUserStandardDP", mit_DpUserStandardDP))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_DpUserStandardFirma", mit_DpUserStandardFirma))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_DpUserStandardFirma2", mit_DpUserStandardFirma2))

        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_EZOLL_SB", mit_EZOLL_SB))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_ATLAS_SB", mit_ATLAS_SB))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_pseudoUser", mit_pseudoUser))

        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_FirmenDatenAnzeige", mit_FirmenDatenAnzeige))

        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_DAKOSY_SB", mit_DAKOSY_SB))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_DAKOSY_SBFull", mit_DAKOSY_SBFull))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_TESTonly", mit_TESTonly))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_PasswortChanged", mit_PasswortChanged))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_TELOTEC_SB", mit_TELOTEC_SB))


        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_AliasAD_Domain", mit_AliasAD_Domain))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_AliasAD_Username", mit_AliasAD_Username))

        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_AliasAD_Domain2", mit_AliasAD_Domain2))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_AliasAD_Username2", mit_AliasAD_Username2))

        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_teamId", mit_teamId))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_ChatBenutzer", mit_ChatBenutzer))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_FirmaHaupt", mit_FirmaHaupt))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_ChatEasteregg", mit_ChatEasteregg))



        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_MAVerzeichnis_SettingsTstmp", mit_MAVerzeichnis_SettingsTstmp))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_MAVerzeichnis_allowGebDat", mit_MAVerzeichnis_allowGebDat))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_MAVerzeichnis_allowWohnadresse", mit_MAVerzeichnis_allowWohnadresse))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_MAVerzeichnis_allowGebDatOhneJahr", mit_MAVerzeichnis_allowGebDatOhneJahr))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_MAVerzeichnis_allowHandynummer", mit_MAVerzeichnis_allowHandynummer))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_MAVerzeichnis_allowFoto", mit_MAVerzeichnis_allowFoto))

        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_MAVerzeichnis_Motto", mit_MAVerzeichnis_Motto))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_MAVerzeichnis_Spitzname", mit_MAVerzeichnis_Spitzname))

        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_foto_DocId", mit_foto_DocId))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_sprache", mit_sprache))
        list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("mit_fakturierungsgruppe", mit_fakturierungsgruppe))

        Return list
    End Function



    Public Function SAVE() As Boolean
        Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
        Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblMitarbeiter WHERE mit_id=@mit_id) " &
                       " BEGIN " & getUpdateCmd() & " End " &
                       " Else " &
                       " BEGIN " & getInsertCmd() & " End " &
                       " commit tran "

        Dim id = SQL.doSQLVarListID(mit_id, sqlstr, "ADMIN", , list)
        If id > 0 Then
            mit_id = id
            Return mit_id
        Else
            Return -1
        End If

    End Function

    Public Function getUpdateCmd() As String
        Try
            Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()

            Dim str As String = ""
            For Each i In list
                If Not i.isPrimaryParam Then
                    str &= "[" & i.Text & "] = @" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
                End If
            Next
            str = str.Substring(0, str.Length - 1) 'wg. ','
            Return (" UPDATE [tblMitarbeiter] SET " & str & " WHERE mit_id=@mit_id ")

        Catch ex As Exception
            MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
        End Try
        Return ""
    End Function


    Public Function getInsertCmd() As String
        Try
            Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
            Dim str As String = ""
            Dim values As String = ""
            For Each i In list
                If Not i.isPrimaryParam Then
                    str &= "[" & i.Text & "],"
                    values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
                End If
            Next
            str = str.Substring(0, str.Length - 1) 'wg. ','
            values = values.Substring(0, values.Length - 1) 'wg. ','
            Return (" INSERT INTO tblMitarbeiter  (" & str & ") VALUES(" & values & ")  ")
        Catch ex As Exception
            MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
        End Try
        Return ""
    End Function


    Public Function DELETE() As Boolean 'obj As Object, tablename As String, where As String) As Boolean
        Dim sqlstr = " DELETE FROM [tblMitarbeiter] WHERE mit_id=" & Me.mit_id
        Return SQL.doSQL(sqlstr, "ADMIN")
    End Function



    'Public Sub LOAD(Optional topMax As String = "")
    '    Try
    '        Using conn As SqlConnection = SQL.GetNewOpenConnectionADMIN()
    '            Using cmd As New SqlCommand("Select * FROM tblMitarbeiter WHERE mit_id=@mit_id  ", conn)
    '                cmd.Parameters.AddWithValue("@mit_id", mit_id)
    '                Dim dr = cmd.ExecuteReader()
    '                If dr.Read Then
    '                    For Each l In getParameterList()
    '                        Dim propInfo As PropertyInfo = Me.GetType.GetProperty(l.Scalarvariable)

    '                        If dr.Item(l.Text) Is DBNull.Value Then
    '                            propInfo.SetValue(Me, Nothing)
    '                        Else
    '                            propInfo.SetValue(Me, dr.Item(l.Text))
    '                        End If

    '                    Next
    '                    Me.LOAD_MEMBERS()
    '                    Me.LOAD_MESSAGES(topMax)
    '                End If
    '                dr.Close()
    '            End Using
    '        End Using
    '    Catch ex As Exception
    '        MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
    '    End Try
    'End Sub


    Public Function LOAD(ByVal id As Integer) As Boolean
        Dim sqlstr As String = "SELECT * FROM tblMitarbeiter WHERE mit_id = " & id & ""
        '  adasdas()
        '       Dim d As VERAG_PROG_ALLGEMEIN.cMitarbeiter = Nothing
        Try
            Using conn As SqlConnection = SQL.GetNewOpenConnectionADMIN
                Using cmd As New SqlCommand(sqlstr, conn)
                    Dim dr = cmd.ExecuteReader()
                    If dr.HasRows Then
                        dr.Read()
                        '   d = New VERAG_PROG_ALLGEMEIN.cMitarbeiter()
                        Try
                            Me.mit_id = dr.Item("mit_id")
                            Me.mit_username = dr.Item("mit_username")
                            Me.mit_abweichenderAnzeigename = dr.Item("mit_abweichenderAnzeigename")
                            Me.mit_pwd = dr.Item("mit_pwd")
                            Me.mit_affix = dr.Item("mit_affix")
                            If Not dr.Item("mit_geschlecht") Is DBNull.Value Then Me.mit_geschlecht = dr.Item("mit_geschlecht")
                            Me.mit_vname = dr.Item("mit_vname")
                            Me.mit_nname = dr.Item("mit_nname")
                            If Not dr.Item("mit_gebdat") Is DBNull.Value Then Me.mit_gebdat = dr.Item("mit_gebdat")
                            Me.mit_strasse = dr.Item("mit_strasse")
                            Me.mit_hausnr = dr.Item("mit_hausnr")
                            Me.mit_land = dr.Item("mit_land")
                            Me.mit_plz = dr.Item("mit_plz")
                            Me.mit_ort = dr.Item("mit_ort")
                            Me.mit_niederlassung = dr.Item("mit_niederlassung")
                            Me.mit_abteilung = dr.Item("mit_abteilung")
                            Me.mit_position = dr.Item("mit_position")
                            Me.mit_durchwahl = dr.Item("mit_durchwahl")
                            Me.mit_email = dr.Item("mit_email")
                            Me.mit_mobiltel = dr.Item("mit_mobiltel")
                            Me.mit_allowAnruf = dr.Item("mit_allowAnruf")
                            If Not dr.Item("mit_FMZollPersID") Is DBNull.Value Then Me.mit_FMZollPersID = dr.Item("mit_FMZollPersID")
                            If Not dr.Item("mit_FMZollPersIDKasseIsnotSpedBuch") Is DBNull.Value Then Me.mit_FMZollPersIDKasseIsnotSpedBuch = dr.Item("mit_FMZollPersIDKasseIsnotSpedBuch")
                            If Not dr.Item("mit_FMZollPersIDSpedBuch") Is DBNull.Value Then Me.mit_FMZollPersIDSpedBuch = dr.Item("mit_FMZollPersIDSpedBuch")
                            If Not dr.Item("mit_DpUserStandardDP") Is DBNull.Value Then Me.mit_DpUserStandardDP = dr.Item("mit_DpUserStandardDP")
                            If Not dr.Item("mit_DpUserStandardFirma") Is DBNull.Value Then Me.mit_DpUserStandardFirma = dr.Item("mit_DpUserStandardFirma")
                            If Not dr.Item("mit_DpUserStandardFirma2") Is DBNull.Value Then Me.mit_DpUserStandardFirma2 = dr.Item("mit_DpUserStandardFirma2")


                            If Not dr.Item("mit_standartFiliale") Is DBNull.Value Then Me.mit_standartFiliale = dr.Item("mit_standartFiliale")
                            If Not dr.Item("mit_standardPreisliste") Is DBNull.Value Then Me.mit_standardPreisliste = dr.Item("mit_standardPreisliste")

                            Me.mit_info = dr.Item("mit_info")
                            If Not dr.Item("mit_einstiegsdatum") Is DBNull.Value Then Me.mit_einstiegsdatum = dr.Item("mit_einstiegsdatum")
                            Me.mit_gekuendigt = dr.Item("mit_gekuendigt")
                            If Not dr.Item("mit_kuendigungsdatum") Is DBNull.Value Then Me.mit_kuendigungsdatum = dr.Item("mit_kuendigungsdatum")
                            If Not dr.Item("mit_foto") Is DBNull.Value Then Me.mit_foto = dr.Item("mit_foto")
                            Me.mit_firma = dr.Item("mit_firma")
                            If Not dr.Item("mit_firmaFMZoll") Is DBNull.Value Then Me.mit_firmaFMZoll = dr.Item("mit_firmaFMZoll")
                            If Not dr.Item("mit_EZOLL_SB") Is DBNull.Value Then Me.mit_EZOLL_SB = dr.Item("mit_EZOLL_SB")
                            If Not dr.Item("mit_ATLAS_SB") Is DBNull.Value Then Me.mit_ATLAS_SB = dr.Item("mit_ATLAS_SB")
                            Me.mit_pseudoUser = dr.Item("mit_pseudoUser")
                            If Not dr.Item("mit_DAKOSY_SB") Is DBNull.Value Then Me.mit_DAKOSY_SB = dr.Item("mit_DAKOSY_SB")
                            If Not dr.Item("mit_DAKOSY_SBFull") Is DBNull.Value Then Me.mit_DAKOSY_SBFull = dr.Item("mit_DAKOSY_SBFull")
                            If Not dr.Item("mit_TESTonly") Is DBNull.Value Then Me.mit_TESTonly = dr.Item("mit_TESTonly")
                            If Not dr.Item("mit_PasswortChanged") Is DBNull.Value Then Me.mit_PasswortChanged = dr.Item("mit_PasswortChanged")

                            If Not dr.Item("mit_FirmenDatenAnzeige") Is DBNull.Value Then Me.mit_FirmenDatenAnzeige = dr.Item("mit_FirmenDatenAnzeige")
                            If Not dr.Item("mit_TELOTEC_SB") Is DBNull.Value Then Me.mit_TELOTEC_SB = dr.Item("mit_TELOTEC_SB")
                            If Not dr.Item("mit_AliasAD_Domain") Is DBNull.Value Then Me.mit_AliasAD_Domain = dr.Item("mit_AliasAD_Domain")
                            If Not dr.Item("mit_AliasAD_Username") Is DBNull.Value Then Me.mit_AliasAD_Username = dr.Item("mit_AliasAD_Username")
                            If Not dr.Item("mit_AliasAD_Domain2") Is DBNull.Value Then Me.mit_AliasAD_Domain2 = dr.Item("mit_AliasAD_Domain2")
                            If Not dr.Item("mit_AliasAD_Username2") Is DBNull.Value Then Me.mit_AliasAD_Username2 = dr.Item("mit_AliasAD_Username2")
                            If Not dr.Item("mit_teamId") Is DBNull.Value Then Me.mit_teamId = dr.Item("mit_teamId")


                            Me.mit_ChatBenutzer = dr.Item("mit_ChatBenutzer")
                            Me.mit_ChatEasteregg = dr.Item("mit_ChatEasteregg")


                            If Not dr.Item("mit_FirmaHaupt") Is DBNull.Value Then Me.mit_FirmaHaupt = dr.Item("mit_FirmaHaupt")


                            If Not dr.Item("mit_MAVerzeichnis_SettingsTstmp") Is DBNull.Value Then Me.mit_MAVerzeichnis_SettingsTstmp = dr.Item("mit_MAVerzeichnis_SettingsTstmp")
                            Me.mit_MAVerzeichnis_allowGebDat = dr.Item("mit_MAVerzeichnis_allowGebDat")
                            Me.mit_MAVerzeichnis_allowGebDatOhneJahr = dr.Item("mit_MAVerzeichnis_allowGebDatOhneJahr")
                            Me.mit_MAVerzeichnis_allowWohnadresse = dr.Item("mit_MAVerzeichnis_allowWohnadresse")
                            Me.mit_MAVerzeichnis_allowHandynummer = dr.Item("mit_MAVerzeichnis_allowHandynummer")
                            Me.mit_MAVerzeichnis_allowFoto = dr.Item("mit_MAVerzeichnis_allowFoto")

                            If Not dr.Item("mit_foto_DocId") Is DBNull.Value Then Me.mit_foto_DocId = dr.Item("mit_foto_DocId")
                            If Not dr.Item("mit_MAVerzeichnis_Spitzname") Is DBNull.Value Then Me.mit_MAVerzeichnis_Spitzname = dr.Item("mit_MAVerzeichnis_Spitzname")
                            If Not dr.Item("mit_MAVerzeichnis_Motto") Is DBNull.Value Then Me.mit_MAVerzeichnis_Motto = dr.Item("mit_MAVerzeichnis_Motto")
                            If Not dr.Item("mit_sprache") Is DBNull.Value Then Me.mit_sprache = dr.Item("mit_sprache")
                            If Not dr.Item("mit_fakturierungsgruppe") Is DBNull.Value Then Me.mit_fakturierungsgruppe = dr.Item("mit_fakturierungsgruppe")




                        Catch ex As Exception
                            MsgBox(System.Reflection.MethodInfo.GetCurrentMethod.Name & ": Fehler beim Einlesen der Mitarbeiter-Details " & vbCrLf & vbCrLf & ex.Message, MsgBoxStyle.Exclamation)
                        End Try
                    End If
                    dr.Close()
                End Using
            End Using
            Return True
        Catch ex As Exception
            MsgBox(System.Reflection.MethodInfo.GetCurrentMethod.Name & ": Fehler beim Lesen der Mitarbeiter-Details:" & vbCrLf & vbCrLf & ex.Message, vbExclamation, "Datenbankfehler")
            Return Nothing
        End Try
        Return False
    End Function

    Public Shared Sub UPDATE_EASTEREGG(egg As Boolean, Optional mit_id As Integer = -1)
        Try
            If cAllgemein.MITARBEITER IsNot Nothing Then
                If mit_id <= 0 Then
                    mit_id = cAllgemein.MITARBEITER.mit_id
                End If
            End If
        Dim sql As New SQL
            If mit_id > 0 Then sql.doSQL("UPDATE tblMitarbeiter SET mit_ChatEasteregg='" & If(egg, 1, 0) & "' WHERE mit_id=" & mit_id, "ADMIN")

        Catch ex As Exception

        End Try
    End Sub
End Class
