319 lines
10 KiB
VB.net
319 lines
10 KiB
VB.net
|
|
Imports System.DirectoryServices
|
|
Imports System.Globalization
|
|
Imports System.IO
|
|
Imports System.Net
|
|
Imports System.Net.Http
|
|
Imports System.Net.WebRequestMethods
|
|
Imports System.Security.Policy
|
|
Imports System.Text
|
|
Imports System.Text.RegularExpressions
|
|
Imports System.Windows
|
|
Imports System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel
|
|
Imports DAKOSY_Worker.DEERRE
|
|
Imports DocumentFormat.OpenXml.Spreadsheet
|
|
Imports GrapeCity.ActiveReports.ReportsCore.Tools
|
|
Imports itextsharp.text.pdf.codec.wmf
|
|
Imports Microsoft.VisualBasic.ApplicationServices
|
|
Imports Newtonsoft.Json
|
|
Imports VERAG_PROG_ALLGEMEIN
|
|
|
|
Public Class frmMitarbTimas
|
|
|
|
Public mid As Integer = -1
|
|
Public isUpdate As Boolean = False
|
|
Dim emp As cTimasEmployee
|
|
Dim timas As cTimasAPI
|
|
Dim dtTimas As New DataTable
|
|
|
|
Sub New()
|
|
|
|
' Dieser Aufruf ist für den Designer erforderlich.
|
|
InitializeComponent()
|
|
|
|
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub frmMitarbDetails_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
|
|
txtPwd.Visible = False
|
|
cbxEinsteigsDat.Checked = False
|
|
cbxGebDat.Checked = False
|
|
|
|
|
|
txtGebDat.Format = DateTimePickerFormat.Custom
|
|
txtGebDat.CustomFormat = "dd.MM.yyyy"
|
|
datGekuendigtAm.Format = DateTimePickerFormat.Custom
|
|
datGekuendigtAm.CustomFormat = "dd.MM.yyyy"
|
|
datEinstiegsdatum.Format = DateTimePickerFormat.Custom
|
|
datEinstiegsdatum.CustomFormat = "dd.MM.yyyy"
|
|
|
|
|
|
If mid > 0 Then
|
|
initMitarbeiter(mid)
|
|
Else
|
|
MsgBox("Fehler beim Laden der Daten!")
|
|
End If
|
|
|
|
End Sub
|
|
Private Sub initMitarbeiter(Optional _isUpdate As Boolean = True)
|
|
timas = New cTimasAPI
|
|
emp = timas.getEmployee(mid)
|
|
|
|
timas.getAllGroups(dtTimas)
|
|
|
|
initDGV(dtTimas)
|
|
|
|
isUpdate = _isUpdate
|
|
Label48.Text = emp.externid
|
|
txtUsername.Text = emp.login
|
|
txtVname.Text = emp.firstname
|
|
txtNname.Text = emp.lastname
|
|
txtPwd.Text = emp.password
|
|
If emp.gender = "male" Then rbtnGeschlechtM.Checked = True
|
|
If emp.gender = "female" Then rbtnGeschlechtW.Checked = True
|
|
|
|
If emp.birthdayDate = "null" Then
|
|
cbxGebDat.Checked = False
|
|
Else
|
|
cbxGebDat.Checked = True : txtGebDat.Text = emp.birthdayDate
|
|
End If
|
|
txtStrasse.Text = emp.street
|
|
txtLohn.Text = emp.pnr1
|
|
txtPlz.Text = emp.zipcode
|
|
txtCard.Text = emp.card
|
|
txtOrt.Text = emp.city
|
|
txtInfo.Text = emp.info
|
|
'cboNiederlassung.changeItem(mitarbeiter.mit_niederlassung)
|
|
'cboAbteilung.changeItem(mitarbeiter.mit_abteilung)
|
|
txtTelNr.Text = emp.phone1
|
|
txtEmail.Text = emp.email
|
|
txtMobiltel.Text = emp.phone2
|
|
|
|
'txtPersonalNr.Text = emp.pnr1
|
|
|
|
cbxAccount.Checked = emp.loginActive
|
|
|
|
If emp.entryDate Is Nothing Then
|
|
cbxEinsteigsDat.Checked = False
|
|
Else
|
|
cbxEinsteigsDat.Checked = True : datEinstiegsdatum.Text = emp.entryDate
|
|
End If
|
|
|
|
|
|
If emp.exitDate IsNot Nothing Then
|
|
cbxGekuendigt.Checked = True
|
|
datGekuendigtAm.Text = emp.exitDate
|
|
Else
|
|
cbxGekuendigt.Checked = False
|
|
End If
|
|
|
|
If emp.birthdayDate Is Nothing Then
|
|
cbxGebDat.Checked = False
|
|
Else
|
|
cbxGebDat.Checked = True : txtGebDat.Text = emp.birthdayDate
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click
|
|
Me.Close()
|
|
End Sub
|
|
|
|
Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click
|
|
Dim newMid As Integer = 0
|
|
If txtVname.Text = "" And txtNname.Text = "" Then MsgBox("Bitte geben Sie einen Namen ein!") : Exit Sub
|
|
getMitarbeiter()
|
|
Me.Refresh()
|
|
Me.Close()
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub getMitarbeiter()
|
|
|
|
emp.login = txtUsername.Text
|
|
emp.password = txtPwd.Text
|
|
If rbtnGeschlechtM.Checked Then emp.gender = "male"
|
|
If rbtnGeschlechtW.Checked Then emp.gender = "female"
|
|
emp.firstname = txtVname.Text
|
|
emp.lastname = txtNname.Text
|
|
If cbxGebDat.Checked Then emp.birthdayDate = txtGebDat.Text Else emp.birthdayDate = "null"
|
|
emp.street = txtStrasse.Text
|
|
emp.zipcode = txtPlz.Text
|
|
emp.street = txtOrt.Text
|
|
emp.pnr1 = txtLohn.Text
|
|
emp.phone1 = txtTelNr.Text & " " & txtDurchwahl.Text
|
|
emp.email = txtEmail.Text
|
|
emp.phone2 = txtMobiltel.Text
|
|
emp.info = txtInfo.Text
|
|
emp.card = txtCard.Text
|
|
|
|
|
|
If cbxEinsteigsDat.Checked Then emp.entryDate = datEinstiegsdatum.Text Else emp.entryDate = "null"
|
|
If cbxGekuendigt.Checked Then emp.exitDate = datGekuendigtAm.Text Else emp.exitDate = "null"
|
|
If cbxGebDat.Checked Then emp.birthdayDate = txtGebDat.Text Else emp.birthdayDate = "null"
|
|
|
|
'mitarbeiter.mit_TESTonly = cbxTestaccount.Checked
|
|
If checkMandatoryFields() Then
|
|
timas.updateEmployee(emp, dgvData)
|
|
|
|
End If
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub Label8_Click_1(sender As Object, e As EventArgs)
|
|
txtPwd.Visible = True
|
|
Label8.Visible = False
|
|
End Sub
|
|
|
|
Private Sub btnSave_Click(sender As Object, e As EventArgs)
|
|
If txtVname.Text = "" And txtNname.Text = "" Then MsgBox("Bitte geben Sie einen Namen ein!") : Exit Sub
|
|
getMitarbeiter()
|
|
If isUpdate Then
|
|
emp.ID = mid
|
|
'If UID.updateMitarbeiter(mitarbeiter) Then Me.Close()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs)
|
|
datEinstiegsdatum.Enabled = cbxEinsteigsDat.Checked
|
|
End Sub
|
|
|
|
Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs)
|
|
txtGebDat.Enabled = cbxGebDat.Checked
|
|
End Sub
|
|
|
|
|
|
Private Sub cbxGekuendigt_CheckedChanged(sender As Object, e As EventArgs)
|
|
datGekuendigtAm.Enabled = cbxGekuendigt.Checked
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub cboNiederlassung_SelectedIndexChanged(sender As Object, e As EventArgs)
|
|
|
|
End Sub
|
|
|
|
Private Sub Button5_Click(sender As Object, e As EventArgs)
|
|
Dim frmBenutzerBerGruppen As New frmBenutzerBerGruppen(mid, 3, "DISPO")
|
|
frmBenutzerBerGruppen.Show(Me)
|
|
End Sub
|
|
|
|
Private Sub lkl_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles lkl.LinkClicked
|
|
If vbYes = MsgBox("Möchten Sie das Kennwort wirklich zurücksetzen? " & vbNewLine & "Der Benutzer wird beim nächsten Login zur Eingabe aufgefordert.", vbYesNoCancel) Then
|
|
' txtPwd.Text = "0000"
|
|
getMitarbeiter()
|
|
emp.password = "null"
|
|
If checkMandatoryFields() Then
|
|
timas.updateEmployee(emp, Nothing)
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
|
|
|
|
Private Function checkMandatoryFields() As Boolean
|
|
|
|
|
|
If Not cbxEinsteigsDat.Checked Or emp.entryDate = "" Then
|
|
MsgBox("Einstiegsdatum prüfen!")
|
|
Return False
|
|
End If
|
|
|
|
If CDate(emp.entryDate).ToShortDateString <= DateTime.Parse("01/01/2000") Then
|
|
MsgBox("Einstiegsdatum darf nicht vor 01.01.2000 liegen!")
|
|
Return False
|
|
End If
|
|
|
|
|
|
|
|
If emp.firstname = "" Or emp.lastname = "" Then
|
|
MsgBox("Vor- und Nachnamen angeben!")
|
|
Return False
|
|
End If
|
|
|
|
If emp.info = "" Then
|
|
MsgBox("Firma/Info angeben!")
|
|
Return False
|
|
End If
|
|
|
|
Return True
|
|
|
|
End Function
|
|
|
|
Sub initDGV(dt As DataTable)
|
|
|
|
|
|
If dtTimas.Columns.Count > 0 Then
|
|
|
|
If TabControl1.TabCount = 0 Then
|
|
For Each row As DataRow In dt.DefaultView.ToTable(True, "groupType").Rows
|
|
Dim TabIndex As Integer 'Anzahl der erstellten Tabs, bei keinem Tab ist der Index 0
|
|
TabIndex = TabControl1.TabCount
|
|
TabControl1.TabPages.Add(row("groupType"))
|
|
If TabIndex = 0 Then
|
|
Dim tab As TabPage = Me.TabControl1.SelectedTab
|
|
Dim dv = New DataView(dt)
|
|
dv.RowFilter = "groupType = '" & tab.Text & "'"
|
|
dgvData.DataSource = dv
|
|
If dgvData.Columns.Count > 0 Then
|
|
With dgvData
|
|
.RowHeadersWidth = 10
|
|
.Columns("id").Visible = True
|
|
.Columns("name").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
|
|
.Columns("groupType").Visible = False
|
|
.Columns("info").Width = 200
|
|
.Columns("set").Width = 20
|
|
.Columns("set").HeaderText = "X"
|
|
.Dock = DockStyle.Fill
|
|
|
|
For Each r As DataGridViewRow In dgvData.Rows
|
|
For Each i As cTimasGruppe In emp.Gruppen
|
|
If r.Cells("id").Value = i.Id Then r.Cells("set").Value = True
|
|
Next
|
|
Next
|
|
End With
|
|
tab.Controls.Add(Me.dgvData)
|
|
End If
|
|
End If
|
|
|
|
Next
|
|
End If
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub PictureBox9_Click_1(sender As Object, e As EventArgs)
|
|
Dim webAddress As String = "https://zeit.verag.ag/"
|
|
Process.Start(webAddress)
|
|
End Sub
|
|
|
|
Private Sub TabControl1_SelectedIndexChanged_1(sender As Object, e As EventArgs) Handles TabControl1.SelectedIndexChanged
|
|
If dgvData Is Nothing And dgvData.Rows.Count < 1 Then Exit Sub
|
|
Dim tab As TabPage = Me.TabControl1.SelectedTab
|
|
If ((Not tab Is Nothing) AndAlso (Not tab.Controls.Contains(Me.dgvData))) Then
|
|
Dim dv = New DataView(dtTimas)
|
|
dv.RowFilter = "groupType = '" & tab.Text & "'"
|
|
dgvData.DataSource = dv
|
|
If dgvData.Columns.Count > 0 Then
|
|
tab.Controls.Add(Me.dgvData)
|
|
End If
|
|
|
|
|
|
End If
|
|
End Sub
|
|
|
|
|
|
|
|
End Class
|
|
|