245 lines
9.4 KiB
VB.net
245 lines
9.4 KiB
VB.net
Imports System.ComponentModel
|
|
Imports System.Drawing
|
|
|
|
Public Class frmMitarbeitersucheBearbeiten
|
|
Dim MA As cMitarbeiter = Nothing
|
|
|
|
|
|
Sub New(mit_id)
|
|
|
|
' Dieser Aufruf ist für den Designer erforderlich.
|
|
InitializeComponent()
|
|
|
|
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
|
MA = New cMitarbeiter(mit_id)
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub frmMitarbeitersuche_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If MA Is Nothing Then Me.Close()
|
|
txtKonfigHinweis.Visible = False
|
|
initMA()
|
|
|
|
If VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("ADMIN", "SDL") Then
|
|
pnlHoverPic.Visible = True
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Sub initMA()
|
|
If MA Is Nothing OrElse MA.mit_id <= 0 Then MsgBox("Fehler Benutzer!") : Exit Sub
|
|
|
|
lblName.Text = If(MA.mit_vname, "") & " " & If(MA.mit_nname, "")
|
|
|
|
cbxSpitzname.Checked = Not (MA.mit_MAVerzeichnis_Spitzname Is Nothing)
|
|
cbxMotto.Checked = Not (MA.mit_MAVerzeichnis_Motto Is Nothing)
|
|
cbxHandynummer.Checked = MA.mit_MAVerzeichnis_allowHandynummer
|
|
cbxGeburtsdatumOhneJahr.Checked = MA.mit_MAVerzeichnis_allowGebDatOhneJahr
|
|
cbxGeburtsdatum.Checked = MA.mit_MAVerzeichnis_allowGebDat
|
|
cbxWohnort.Checked = MA.mit_MAVerzeichnis_allowWohnadresse
|
|
cbxAllowFoto.Checked = MA.mit_MAVerzeichnis_allowFoto
|
|
|
|
|
|
|
|
txtSpitzname.Text = If(MA.mit_MAVerzeichnis_Spitzname, "")
|
|
txtHandynummer.Text = If(MA.mit_mobiltel, "")
|
|
txtMotto.Text = If(MA.mit_MAVerzeichnis_Motto, "")
|
|
|
|
lblWohnadresse.Text = (If(MA.mit_land, "") & " " & If(MA.mit_plz, "") & " " & If(MA.mit_ort, "")).Trim
|
|
lblGeburtstag.Text = If(MA.mit_gebdat, "")
|
|
|
|
pic.BackgroundImage = My.Resources.personGray_m
|
|
|
|
If MA.mit_foto_DocId IsNot Nothing Then
|
|
Try
|
|
pic.BackgroundImage = Image.FromFile(cDATENSERVER.GET_PDFPath_BY_DocID(MA.mit_foto_DocId))
|
|
Catch ex As Exception
|
|
pic.BackgroundImage = My.Resources.personGray_m
|
|
End Try
|
|
ElseIf MA.mit_geschlecht = "w" Then
|
|
pic.BackgroundImage = My.Resources.personGray_w
|
|
Else
|
|
pic.BackgroundImage = My.Resources.personGray_m
|
|
End If
|
|
|
|
If MA.mit_fotoHover1_DocId IsNot Nothing Then
|
|
Try
|
|
PictureBox1.BackgroundImage = Image.FromFile(cDATENSERVER.GET_PDFPath_BY_DocID(MA.mit_fotoHover1_DocId))
|
|
Catch ex As Exception
|
|
PictureBox1.BackgroundImage = My.Resources.personGray_m
|
|
End Try
|
|
ElseIf MA.mit_geschlecht = "w" Then
|
|
PictureBox1.BackgroundImage = My.Resources.personGray_w
|
|
Else
|
|
PictureBox1.BackgroundImage = My.Resources.personGray_m
|
|
End If
|
|
|
|
If MA.mit_fotoHover2_DocId IsNot Nothing Then
|
|
Try
|
|
PictureBox2.BackgroundImage = Image.FromFile(cDATENSERVER.GET_PDFPath_BY_DocID(MA.mit_fotoHover2_DocId))
|
|
Catch ex As Exception
|
|
PictureBox2.BackgroundImage = My.Resources.personGray_m
|
|
End Try
|
|
ElseIf MA.mit_geschlecht = "w" Then
|
|
PictureBox2.BackgroundImage = My.Resources.personGray_w
|
|
Else
|
|
PictureBox2.BackgroundImage = My.Resources.personGray_m
|
|
End If
|
|
|
|
|
|
If VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_MAVerzeichnis_SettingsTstmp Is Nothing And Not VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_pseudoUser Then txtKonfigHinweis.Visible = True
|
|
|
|
End Sub
|
|
|
|
Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
|
|
Me.Close()
|
|
End Sub
|
|
|
|
Private Sub cbxSpitzname_CheckedChanged(sender As Object, e As EventArgs) Handles cbxSpitzname.CheckedChanged
|
|
txtSpitzname.Enabled = sender.Checked
|
|
If Not sender.Checked Then txtSpitzname.Text = ""
|
|
End Sub
|
|
|
|
Private Sub cbxHandynummer_CheckedChanged(sender As Object, e As EventArgs) Handles cbxHandynummer.CheckedChanged
|
|
txtHandynummer.Enabled = sender.Checked
|
|
End Sub
|
|
|
|
Private Sub cbxMotto_CheckedChanged(sender As Object, e As EventArgs) Handles cbxMotto.CheckedChanged
|
|
txtMotto.Enabled = sender.Checked
|
|
If Not sender.Checked Then txtMotto.Text = ""
|
|
End Sub
|
|
|
|
Private Sub btn_Click(sender As Object, e As EventArgs) Handles btn.Click
|
|
|
|
If cbxSpitzname.Checked Then
|
|
MA.mit_MAVerzeichnis_Spitzname = txtSpitzname.Text
|
|
Else
|
|
MA.mit_MAVerzeichnis_Spitzname = Nothing
|
|
End If
|
|
|
|
If cbxHandynummer.Checked Then
|
|
MA.mit_mobiltel = txtHandynummer.Text
|
|
Else
|
|
MA.mit_mobiltel = ""
|
|
End If
|
|
If cbxMotto.Checked Then
|
|
MA.mit_MAVerzeichnis_Motto = txtMotto.Text
|
|
Else
|
|
MA.mit_MAVerzeichnis_Motto = Nothing
|
|
End If
|
|
|
|
MA.mit_MAVerzeichnis_allowGebDat = cbxGeburtsdatum.Checked
|
|
MA.mit_MAVerzeichnis_allowGebDatOhneJahr = cbxGeburtsdatumOhneJahr.Checked
|
|
MA.mit_MAVerzeichnis_allowWohnadresse = cbxWohnort.Checked
|
|
MA.mit_MAVerzeichnis_allowHandynummer = cbxHandynummer.Checked
|
|
MA.mit_MAVerzeichnis_allowFoto = cbxAllowFoto.Checked
|
|
|
|
If MA.mit_id = VERAG_PROG_ALLGEMEIN.cAllgemein.USRID Then
|
|
MA.mit_MAVerzeichnis_SettingsTstmp = Now
|
|
End If
|
|
|
|
If MA.mit_id <= 0 Then MsgBox("Fehler ID!") : Exit Sub
|
|
|
|
If MA.SAVE Then
|
|
Me.DialogResult = Windows.Forms.DialogResult.OK
|
|
Me.Close()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub pic_Click(sender As Object, e As EventArgs) Handles pic.Click
|
|
Dim fd As Windows.Forms.OpenFileDialog = New Windows.Forms.OpenFileDialog()
|
|
|
|
fd.Title = "Bild auswählen"
|
|
' fd.InitialDirectory = "F:\PROGRAMME\ADMIN_DATA\Fotos_Mitarbeiter\"
|
|
fd.Filter = "Image Files(*.BMP;*.JPG;*.GIF;*.PNG)|*.BMP;*.JPG;*.GIF;*.PNG"
|
|
fd.FilterIndex = 2
|
|
fd.RestoreDirectory = True
|
|
|
|
If fd.ShowDialog() = DialogResult.OK AndAlso fd.FileName <> "" Then
|
|
|
|
Dim Extension = New IO.FileInfo(fd.FileName).Extension
|
|
Dim docId = -1
|
|
If saveToDS(Extension, fd.FileName, "FRONT", docId) Then
|
|
|
|
MA.mit_foto_DocId = docId
|
|
Try
|
|
pic.BackgroundImage = Image.FromFile(cDATENSERVER.GET_PDFPath_BY_DocID(MA.mit_foto_DocId))
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message & ex.StackTrace)
|
|
End Try
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Public Function saveToDS(Extension, sourcePath, art, Optional ByRef da_id = -1) As Boolean
|
|
|
|
Dim DS As VERAG_PROG_ALLGEMEIN.cDATENSERVER = Nothing
|
|
If da_id > 0 Then
|
|
DS = New cDATENSERVER(da_id)
|
|
Else
|
|
DS = New VERAG_PROG_ALLGEMEIN.cDATENSERVER("DOKUMENTE", "MITARBEITER", "PERSONAL_FOTOS", "", "", MA.mit_nname & "_" & MA.mit_id & "_" & art & Extension, -1, False)
|
|
End If
|
|
|
|
' Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER("DOKUMENTE", "MITARBEITER", "PERSONAL_FOTOS", "", "", MA.mit_nname & "_" & MA.mit_id, -1, False)
|
|
' MsgBox(DS.da_id)
|
|
If Not DS.uploadDataToDATENSERVER(sourcePath,,, False,, False) Then MsgBox("Fehler beim Speichern: Datenserver!") : Return False
|
|
If DS.da_id <= 0 Then MsgBox("Keine DocId!") : Return False
|
|
da_id = DS.da_id
|
|
' destPath = DS.GET_TOP1_PATH
|
|
Return True
|
|
End Function
|
|
|
|
Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
|
|
Dim fd As Windows.Forms.OpenFileDialog = New Windows.Forms.OpenFileDialog()
|
|
|
|
fd.Title = "Bild auswählen"
|
|
' fd.InitialDirectory = "F:\PROGRAMME\ADMIN_DATA\Fotos_Mitarbeiter\"
|
|
fd.Filter = "Image Files(*.BMP;*.JPG;*.GIF;*.PNG)|*.BMP;*.JPG;*.GIF;*.PNG"
|
|
fd.FilterIndex = 2
|
|
fd.RestoreDirectory = True
|
|
|
|
If fd.ShowDialog() = DialogResult.OK AndAlso fd.FileName <> "" Then
|
|
|
|
Dim Extension = New IO.FileInfo(fd.FileName).Extension
|
|
Dim docId = -1
|
|
If saveToDS(Extension, fd.FileName, "HOVER1", docId) Then
|
|
|
|
MA.mit_fotoHover1_DocId = docId
|
|
Try
|
|
PictureBox1.BackgroundImage = Image.FromFile(cDATENSERVER.GET_PDFPath_BY_DocID(MA.mit_fotoHover1_DocId))
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message & ex.StackTrace)
|
|
End Try
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click
|
|
Dim fd As Windows.Forms.OpenFileDialog = New Windows.Forms.OpenFileDialog()
|
|
|
|
fd.Title = "Bild auswählen"
|
|
' fd.InitialDirectory = "F:\PROGRAMME\ADMIN_DATA\Fotos_Mitarbeiter\"
|
|
fd.Filter = "Image Files(*.BMP;*.JPG;*.GIF;*.PNG)|*.BMP;*.JPG;*.GIF;*.PNG"
|
|
fd.FilterIndex = 2
|
|
fd.RestoreDirectory = True
|
|
|
|
If fd.ShowDialog() = DialogResult.OK AndAlso fd.FileName <> "" Then
|
|
|
|
Dim Extension = New IO.FileInfo(fd.FileName).Extension
|
|
Dim docId = -1
|
|
If saveToDS(Extension, fd.FileName, "HOVER2", docId) Then
|
|
|
|
MA.mit_fotoHover2_DocId = docId
|
|
Try
|
|
PictureBox2.BackgroundImage = Image.FromFile(cDATENSERVER.GET_PDFPath_BY_DocID(MA.mit_fotoHover2_DocId))
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message & ex.StackTrace)
|
|
End Try
|
|
End If
|
|
End If
|
|
End Sub
|
|
End Class |