NEU
This commit is contained in:
693
UID/Dienstplan/frmDiestAddMa.vb
Normal file
693
UID/Dienstplan/frmDiestAddMa.vb
Normal file
@@ -0,0 +1,693 @@
|
||||
Imports System.Text.RegularExpressions
|
||||
|
||||
Public Class frmDiestAddMa
|
||||
|
||||
Dim SQLDienst As New cDienstplan
|
||||
Public niederlassung = ""
|
||||
Dim ListMA As New List(Of cMAShort)
|
||||
Dim MA As New cDienstMA
|
||||
Public MA_ID As Integer = -1
|
||||
Dim DienstDetails As List(Of cDienstDetails)
|
||||
Dim loaded As Boolean = False
|
||||
Dim MusterErr As Boolean = False
|
||||
Dim SCHICHTEN_ARTEN As New List(Of cDienstplanSchicht)
|
||||
Dim ADMIN As New cOptionenDAL
|
||||
|
||||
Private Sub frmDiestAddMa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles Me.KeyPress
|
||||
If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then
|
||||
MessageBox.Show("Enter key pressed")
|
||||
End If
|
||||
End Sub
|
||||
Private Sub frmDiestAddMa_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Dim dt As DataTable = ADMIN.AnzeigeTabelle(" SELECT * FROM [tblDienstplanEintraegeDetails] WHERE [dedet_niederlassung]='" & niederlassung & "' AND dedet_benutzerdefinierteSchicht=1 ")
|
||||
cboStammSchicht.Items.Clear()
|
||||
cboStammSchicht.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("", ""))
|
||||
For Each r As DataRow In dt.Rows
|
||||
Dim SCHICHT As New cDienstplanSchicht(r("dedet_id"))
|
||||
SCHICHTEN_ARTEN.Add(SCHICHT)
|
||||
cboStammSchicht.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem(SCHICHT.dedet_abt, SCHICHT.dedet_abt))
|
||||
Next
|
||||
|
||||
|
||||
ListMA = SQLDienst.getAllMA("BEIDE")
|
||||
DienstDetails = SQLDienst.getAllDienstDetails(niederlassung)
|
||||
initCboMuster()
|
||||
fillCboMA()
|
||||
|
||||
'
|
||||
|
||||
|
||||
If niederlassung = "ATILLA" Then
|
||||
cboAbt.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("ZOLL", "ZOLL"))
|
||||
cboAbt.SelectedIndex = 0
|
||||
Else
|
||||
cboAbt.fillWithSQL("SELECT [abt_kuerzel],abt_bezeichnung FROM [tblAbteilungen] ORDER BY abt_bezeichnung", False, "ADMIN", True)
|
||||
End If
|
||||
|
||||
|
||||
cboArbVerh.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Vollzeit", "VZ"))
|
||||
cboArbVerh.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Teilzeit", "TZ"))
|
||||
|
||||
cboFunktion.Items.Clear()
|
||||
cboFunktion.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Mitarbeiter", "Mitarbeiter"))
|
||||
cboFunktion.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Schicht-/Abteilungsleiter", "Leiter"))
|
||||
cboFunktion.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Lehrling", "Lehrling"))
|
||||
cboFunktion.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Probe", "Probe"))
|
||||
cboFunktion.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Ferialpraktikant", "Ferialpraktikant"))
|
||||
cboFunktion.SelectedIndex = 0
|
||||
|
||||
|
||||
|
||||
|
||||
If MA_ID >= 0 Then
|
||||
Me.Text = "Änderung"
|
||||
If cboMyItemSelect(cboMA, SQLDienst.getValueTxtBySql("SELECT isnull([dstma_mitId],-1) FROM [tblDienstMitarb] WHERE dstma_id=" & MA_ID, "ADMIN")) Then
|
||||
loadMA()
|
||||
End If
|
||||
End If
|
||||
loaded = True
|
||||
End Sub
|
||||
Sub fillCboMA()
|
||||
For Each m In ListMA
|
||||
cboMA.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem(m.mit_nname & " " & m.mit_vname, m.mit_id))
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click
|
||||
' MsgBox(txtRotVonMo.Text)
|
||||
MusterErr = False
|
||||
If checkValues() Then
|
||||
If initMA() Then
|
||||
Dim tz As List(Of cDienstTeilzeit) = initArbVerh()
|
||||
If MusterErr Then MsgBox("Bei der Prüfung der Daten für die Muster-Vorlage ist ein Fehler aufgetreten! Bitte um Prüfung!") : Exit Sub
|
||||
If SQLDienst.insertDienstMA(MA, niederlassung) Then ' Me.Close()
|
||||
SQLDienst.delDienstTeilzeit(MA.dstma_id)
|
||||
If cbxMuster.Checked Then 'cboArbVerh.SelectedIndex = 1 Then
|
||||
For Each t In tz
|
||||
SQLDienst.insertDienstTeilzeit(t)
|
||||
Next
|
||||
End If
|
||||
Me.Close()
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
MsgBox("Bei der Überprüfung der Daten ist ein Fehler aufgetreten!")
|
||||
End If
|
||||
End Sub
|
||||
Sub initCboMuster()
|
||||
Dim ll As New List(Of VERAG_PROG_ALLGEMEIN.MyListItem)
|
||||
ll.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("", ""))
|
||||
For Each i In SCHICHTEN_ARTEN
|
||||
' ll.Add(New VERAG_PROG_ALLGEMEIN.MyListItem(i.dedet_abt, i.dedet_abt))
|
||||
Dim schicht_Name = i.dedet_abt
|
||||
If i.dedet_bezeichnungDP <> "" Then schicht_Name = i.dedet_bezeichnungDP
|
||||
'll.Add(New VERAG_PROG_ALLGEMEIN.MyListItem(schicht_Name, i.dedet_abt))
|
||||
ll.Add(New VERAG_PROG_ALLGEMEIN.MyListItem(schicht_Name, schicht_Name))
|
||||
Next
|
||||
'll.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("ZOLL Vormittag", "ZOLL_VM"))
|
||||
'll.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("ZOLL Nachmittag", "ZOLL_NM"))
|
||||
'll.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("ZOLL_TAG", "ZOLL_TAG"))
|
||||
'll.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("QS (nur SUBEN)", "QS"))
|
||||
'll.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("ZOLL_NACHT (nur ATILLA)", "NACHT"))
|
||||
|
||||
Dim lcbo As New List(Of ComboBox)
|
||||
|
||||
lcbo.Add(cboBlauMo)
|
||||
lcbo.Add(cboBlauDi)
|
||||
lcbo.Add(cboBlauMi)
|
||||
lcbo.Add(cboBlauDo)
|
||||
lcbo.Add(cboBlauFr)
|
||||
lcbo.Add(cboBlauSa)
|
||||
lcbo.Add(cboBlauSo)
|
||||
|
||||
lcbo.Add(cboRotMo)
|
||||
lcbo.Add(cboRotDi)
|
||||
lcbo.Add(cboRotMi)
|
||||
lcbo.Add(cboRotDo)
|
||||
lcbo.Add(cboRotFr)
|
||||
lcbo.Add(cboRotSa)
|
||||
lcbo.Add(cboRotSo)
|
||||
|
||||
lcbo.Add(cboBlau2Mo)
|
||||
lcbo.Add(cboBlau2Di)
|
||||
lcbo.Add(cboBlau2Mi)
|
||||
lcbo.Add(cboBlau2Do)
|
||||
lcbo.Add(cboBlau2Fr)
|
||||
lcbo.Add(cboBlau2Sa)
|
||||
lcbo.Add(cboBlau2So)
|
||||
|
||||
lcbo.Add(cboRot2Mo)
|
||||
lcbo.Add(cboRot2Di)
|
||||
lcbo.Add(cboRot2Mi)
|
||||
lcbo.Add(cboRot2Do)
|
||||
lcbo.Add(cboRot2Fr)
|
||||
lcbo.Add(cboRot2Sa)
|
||||
lcbo.Add(cboRot2So)
|
||||
|
||||
For Each cbo In lcbo
|
||||
cbo.Items.Clear()
|
||||
AddHandler cbo.SelectedIndexChanged, AddressOf cboSelectedIndexChanged
|
||||
For Each o In ll
|
||||
cbo.Items.Add(o)
|
||||
Next
|
||||
cbo.SelectedIndex = 0
|
||||
Next
|
||||
|
||||
|
||||
|
||||
Dim lcbx As New List(Of CheckBox)
|
||||
|
||||
lcbx.Add(cbxBlauMo)
|
||||
lcbx.Add(cbxBlauDi)
|
||||
lcbx.Add(cbxBlauMi)
|
||||
lcbx.Add(cbxBlauDo)
|
||||
lcbx.Add(cbxBlauFr)
|
||||
lcbx.Add(cbxBlauSa)
|
||||
lcbx.Add(cbxBlauSo)
|
||||
|
||||
lcbx.Add(cbxRotMo)
|
||||
lcbx.Add(cbxRotDi)
|
||||
lcbx.Add(cbxRotMi)
|
||||
lcbx.Add(cbxRotDo)
|
||||
lcbx.Add(cbxRotFr)
|
||||
lcbx.Add(cbxRotSa)
|
||||
lcbx.Add(cbxRotSo)
|
||||
|
||||
lcbx.Add(cbxBlau2Mo)
|
||||
lcbx.Add(cbxBlau2Di)
|
||||
lcbx.Add(cbxBlau2Mi)
|
||||
lcbx.Add(cbxBlau2Do)
|
||||
lcbx.Add(cbxBlau2Fr)
|
||||
lcbx.Add(cbxBlau2Sa)
|
||||
lcbx.Add(cbxBlau2So)
|
||||
|
||||
lcbx.Add(cbxRot2Mo)
|
||||
lcbx.Add(cbxRot2Di)
|
||||
lcbx.Add(cbxRot2Mi)
|
||||
lcbx.Add(cbxRot2Do)
|
||||
lcbx.Add(cbxRot2Fr)
|
||||
lcbx.Add(cbxRot2Sa)
|
||||
lcbx.Add(cbxRot2So)
|
||||
For Each cbx In lcbx
|
||||
AddHandler cbx.CheckedChanged, AddressOf cboSelectedIndexChanged
|
||||
Next
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub cboSelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
If loaded Then
|
||||
|
||||
Dim tag = sender.name.ToString.Substring(sender.name.length - 2)
|
||||
Dim tmpDPSchicht = ""
|
||||
'If tag <> "Sa" And tag <> "So" Then
|
||||
If sender.name.contains("Blau2") Then
|
||||
tmpDPSchicht = "Blau2"
|
||||
ElseIf sender.name.contains("Rot2") Then
|
||||
tmpDPSchicht = "Rot2"
|
||||
ElseIf sender.name.contains("Blau") Then
|
||||
tmpDPSchicht = "Blau"
|
||||
ElseIf sender.name.contains("Rot") Then
|
||||
tmpDPSchicht = "Rot"
|
||||
End If
|
||||
Dim tmpSchicht = ""
|
||||
Dim cbo As ComboBox = DirectCast(FindControl(Me, "cbo" & tmpDPSchicht & tag), ComboBox)
|
||||
tmpSchicht = DirectCast(cbo.SelectedItem, VERAG_PROG_ALLGEMEIN.MyListItem).Value
|
||||
|
||||
For Each i In SCHICHTEN_ARTEN
|
||||
If tmpSchicht = i.dedet_bezeichnungDP Then
|
||||
tmpSchicht = i.dedet_abt
|
||||
End If
|
||||
Next
|
||||
tmpSchicht = DirectCast(cbo.SelectedItem, VERAG_PROG_ALLGEMEIN.MyListItem).Value
|
||||
|
||||
Dim Von = FindControl(Me, "txt" & tmpDPSchicht & "Von" & tag)
|
||||
Dim Bis = FindControl(Me, "txt" & tmpDPSchicht & "Bis" & tag)
|
||||
Dim Pause = FindControl(Me, "txt" & tmpDPSchicht & "Pause" & tag)
|
||||
Dim cbx As CheckBox = FindControl(Me, "cbx" & tmpDPSchicht & tag)
|
||||
|
||||
If tmpSchicht = "" Then
|
||||
cbx.Checked = False
|
||||
If Von IsNot Nothing Then Von.Text = "00:00"
|
||||
If Bis IsNot Nothing Then Bis.Text = "00:00"
|
||||
If Pause IsNot Nothing Then Pause.Text = "0"
|
||||
Else
|
||||
For Each s In SCHICHTEN_ARTEN
|
||||
|
||||
cbx.Checked = True
|
||||
If s.dedet_abt = tmpSchicht Or s.dedet_bezeichnungDP = tmpSchicht Then
|
||||
For Each z In s.ZEITEN
|
||||
If z.dsz_woTag.ToUpper = tag.ToUpper Then
|
||||
If Von IsNot Nothing Then Von.Text = z.dsz_von
|
||||
If Bis IsNot Nothing Then Bis.Text = z.dsz_bis
|
||||
If Pause IsNot Nothing Then Pause.Text = z.dsz_pause
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Function FindControl(control As Control, name As String) As Control
|
||||
Try
|
||||
Return Me.Controls.Find(name, True)(0)
|
||||
Catch ex As Exception
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
Function initArbVerh() As List(Of cDienstTeilzeit)
|
||||
Dim tz As New List(Of cDienstTeilzeit)
|
||||
If Not cbxMuster.Checked Then Return tz
|
||||
If cbxBlauMo.Checked Then tz.Add(newTZ(MA.dstma_id, "BLAU1", "MO", getTZSchicht(cboBlauMo), txtBlauVonMo.Text, txtBlauBisMo.Text, txtBlauPauseMo.Text, txtBlauBemMo.Text))
|
||||
If cbxBlauDi.Checked Then tz.Add(newTZ(MA.dstma_id, "BLAU1", "DI", getTZSchicht(cboBlauDi), txtBlauVonDi.Text, txtBlauBisDi.Text, txtBlauPauseDi.Text, txtBlauBemDi.Text))
|
||||
If cbxBlauMi.Checked Then tz.Add(newTZ(MA.dstma_id, "BLAU1", "MI", getTZSchicht(cboBlauMi), txtBlauVonMi.Text, txtBlauBisMi.Text, txtBlauPauseMi.Text, txtBlauBemMi.Text))
|
||||
If cbxBlauDo.Checked Then tz.Add(newTZ(MA.dstma_id, "BLAU1", "DO", getTZSchicht(cboBlauDo), txtBlauVonDo.Text, txtBlauBisDo.Text, txtBlauPauseDo.Text, txtBlauBemDo.Text))
|
||||
If cbxBlauFr.Checked Then tz.Add(newTZ(MA.dstma_id, "BLAU1", "FR", getTZSchicht(cboBlauFr), txtBlauVonFr.Text, txtBlauBisFr.Text, txtBlauPauseFr.Text, txtBlauBemFr.Text))
|
||||
If cbxBlauSa.Checked Then tz.Add(newTZ(MA.dstma_id, "BLAU1", "SA", getTZSchicht(cboBlauSa), txtBlauVonSa.Text, txtBlauBisSa.Text, txtBlauPauseSo.Text, txtBlauBemSa.Text))
|
||||
If cbxBlauSo.Checked Then tz.Add(newTZ(MA.dstma_id, "BLAU1", "SO", getTZSchicht(cboBlauSo), txtBlauVonSo.Text, txtBlauBisSo.Text, txtBlauPauseSo.Text, txtBlauBemSo.Text))
|
||||
If cbxRotMo.Checked Then tz.Add(newTZ(MA.dstma_id, "ROT1", "MO", getTZSchicht(cboRotMo), txtRotVonMo.Text, txtRotBisMo.Text, txtRotPauseMo.Text, txtRotBemMo.Text))
|
||||
If cbxRotDi.Checked Then tz.Add(newTZ(MA.dstma_id, "ROT1", "DI", getTZSchicht(cboRotDi), txtRotVonDi.Text, txtRotBisDi.Text, txtRotPauseDi.Text, txtRotBemDi.Text))
|
||||
If cbxRotMi.Checked Then tz.Add(newTZ(MA.dstma_id, "ROT1", "MI", getTZSchicht(cboRotMi), txtRotVonMi.Text, txtRotBisMi.Text, txtRotPauseMi.Text, txtRotBemMi.Text))
|
||||
If cbxRotDo.Checked Then tz.Add(newTZ(MA.dstma_id, "ROT1", "DO", getTZSchicht(cboRotDo), txtRotVonDo.Text, txtRotBisDo.Text, txtRotPauseDo.Text, txtRotBemDo.Text))
|
||||
If cbxRotFr.Checked Then tz.Add(newTZ(MA.dstma_id, "ROT1", "FR", getTZSchicht(cboRotFr), txtRotVonFr.Text, txtRotBisFr.Text, txtRotPauseFr.Text, txtRotBemFr.Text))
|
||||
If cbxRotSa.Checked Then tz.Add(newTZ(MA.dstma_id, "ROT1", "SA", getTZSchicht(cboRotSa), txtRotVonSa.Text, txtRotBisSa.Text, txtRotPauseSa.Text, txtRotBemSa.Text))
|
||||
If cbxRotSo.Checked Then tz.Add(newTZ(MA.dstma_id, "ROT1", "SO", getTZSchicht(cboRotSo), txtRotVonSo.Text, txtRotBisSo.Text, txtRotPauseSo.Text, txtRotBemSo.Text))
|
||||
|
||||
If Not cbx4WoRhythmus.Checked Then Return tz
|
||||
|
||||
If cbxBlauMo.Checked Then tz.Add(newTZ(MA.dstma_id, "BLAU2", "MO", getTZSchicht(cboBlau2Mo), txtBlau2VonMo.Text, txtBlau2BisMo.Text, txtBlau2PauseMo.Text, txtBlau2BemMo.Text))
|
||||
If cbxBlau2Di.Checked Then tz.Add(newTZ(MA.dstma_id, "BLAU2", "DI", getTZSchicht(cboBlau2Di), txtBlau2VonDi.Text, txtBlau2BisDi.Text, txtBlau2PauseDi.Text, txtBlau2BemDi.Text))
|
||||
If cbxBlau2Mi.Checked Then tz.Add(newTZ(MA.dstma_id, "BLAU2", "MI", getTZSchicht(cboBlau2Mi), txtBlau2VonMi.Text, txtBlau2BisMi.Text, txtBlau2PauseMi.Text, txtBlau2BemMi.Text))
|
||||
If cbxBlau2Do.Checked Then tz.Add(newTZ(MA.dstma_id, "BLAU2", "DO", getTZSchicht(cboBlau2Do), txtBlau2VonDo.Text, txtBlau2BisDo.Text, txtBlau2PauseDo.Text, txtBlau2BemDo.Text))
|
||||
If cbxBlau2Fr.Checked Then tz.Add(newTZ(MA.dstma_id, "BLAU2", "FR", getTZSchicht(cboBlau2Fr), txtBlau2VonFr.Text, txtBlau2BisFr.Text, txtBlau2PauseFr.Text, txtBlau2BemFr.Text))
|
||||
If cbxBlau2Sa.Checked Then tz.Add(newTZ(MA.dstma_id, "BLAU2", "SA", getTZSchicht(cboBlau2Sa), txtBlau2VonSa.Text, txtBlau2BisSa.Text, txtBlau2PauseSo.Text, txtBlau2BemSa.Text))
|
||||
If cbxBlau2So.Checked Then tz.Add(newTZ(MA.dstma_id, "BLAU2", "SO", getTZSchicht(cboBlau2So), txtBlau2VonSo.Text, txtBlau2BisSo.Text, txtBlau2PauseSo.Text, txtBlau2BemSo.Text))
|
||||
If cbxRot2Mo.Checked Then tz.Add(newTZ(MA.dstma_id, "ROT2", "MO", getTZSchicht(cboRot2Mo), txtRot2VonMo.Text, txtRot2BisMo.Text, txtRot2PauseMo.Text, txtRot2BemMo.Text))
|
||||
If cbxRot2Di.Checked Then tz.Add(newTZ(MA.dstma_id, "ROT2", "DI", getTZSchicht(cboRot2Di), txtRot2VonDi.Text, txtRot2BisDi.Text, txtRot2PauseDi.Text, txtRot2BemDi.Text))
|
||||
If cbxRot2Mi.Checked Then tz.Add(newTZ(MA.dstma_id, "ROT2", "MI", getTZSchicht(cboRot2Mi), txtRot2VonMi.Text, txtRot2BisMi.Text, txtRot2PauseMi.Text, txtRot2BemMi.Text))
|
||||
If cbxRot2Do.Checked Then tz.Add(newTZ(MA.dstma_id, "ROT2", "DO", getTZSchicht(cboRot2Do), txtRot2VonDo.Text, txtRot2BisDo.Text, txtRot2PauseDo.Text, txtRot2BemDo.Text))
|
||||
If cbxRot2Fr.Checked Then tz.Add(newTZ(MA.dstma_id, "ROT2", "FR", getTZSchicht(cboRot2Fr), txtRot2VonFr.Text, txtRot2BisFr.Text, txtRot2PauseFr.Text, txtRot2BemFr.Text))
|
||||
If cbxRot2Sa.Checked Then tz.Add(newTZ(MA.dstma_id, "ROT2", "SA", getTZSchicht(cboRot2Sa), txtRot2VonSa.Text, txtRot2BisSa.Text, txtRot2PauseSa.Text, txtRot2BemSa.Text))
|
||||
If cbxRot2So.Checked Then tz.Add(newTZ(MA.dstma_id, "ROT2", "SO", getTZSchicht(cboRot2So), txtRot2VonSo.Text, txtRot2BisSo.Text, txtRot2PauseSo.Text, txtRot2BemSo.Text))
|
||||
|
||||
Return tz
|
||||
End Function
|
||||
Function newTZ(dsttz_maId As Integer, dsttz_dienstplan As String, dsttz_wotag As String, dsttz_abt As String, dsttz_von As String, dsttz_bis As String, dsttz_pause As String, dsttz_bemerkung As String) As cDienstTeilzeit
|
||||
Dim tz As New cDienstTeilzeit
|
||||
Dim rgx As New Regex("^\d{2}:\d{2}$")
|
||||
' MsgBox(rgx.IsMatch(dsttz_von))
|
||||
|
||||
If Not rgx.IsMatch(dsttz_von) Then MusterErr = True
|
||||
If Not rgx.IsMatch(dsttz_bis) Then MusterErr = True
|
||||
If Not IsNumeric(dsttz_pause) Then MusterErr = True
|
||||
|
||||
|
||||
tz.dsttz_maId = dsttz_maId
|
||||
tz.dsttz_wotag = dsttz_wotag
|
||||
tz.dsttz_abt = dsttz_abt
|
||||
tz.dsttz_von = dsttz_von
|
||||
|
||||
tz.dsttz_bis = dsttz_bis
|
||||
tz.dsttz_dienstplan = dsttz_dienstplan
|
||||
tz.dsttz_pause = dsttz_pause.Replace(",", ".")
|
||||
tz.dsttz_bemerkung = dsttz_bemerkung
|
||||
|
||||
Return tz
|
||||
End Function
|
||||
Function getTZSchicht(cbo As ComboBox) As String
|
||||
Try
|
||||
Return DirectCast(cbo.SelectedItem, VERAG_PROG_ALLGEMEIN.MyListItem).Value
|
||||
Catch ex As Exception
|
||||
Return ""
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Function checkValues() As Boolean
|
||||
If Not IsNumeric(txtWoStd.Text) Then Return False
|
||||
Return True
|
||||
End Function
|
||||
Sub getArbVhIndex(cbo As ComboBox, s As String)
|
||||
For Each i In cbo.Items
|
||||
If DirectCast(i, VERAG_PROG_ALLGEMEIN.MyListItem).Value = s Then
|
||||
cbo.SelectedItem = i : Exit Sub
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Sub loadMA()
|
||||
MA = SQLDienst.getDstMA(MA_ID)
|
||||
cboMyItemSelect(cboAbt, MA.dstma_abteilung)
|
||||
cboMyItemSelect(cboFunktion, MA.dstma_funktion)
|
||||
cboMyItemSelect(cboArbVerh, MA.dstma_arbvh)
|
||||
|
||||
txtWoStd.Text = MA.dstma_wochenStunden
|
||||
cboStammSchicht.Text = MA.dstma_stammSchicht
|
||||
txtKuerzel.Text = MA.dstma_kuerzel
|
||||
txtReihenfolge.Text = MA.dstma_reihenfolge
|
||||
Button1.BackColor = ColorTranslator.FromHtml(MA.dstma_farbe)
|
||||
|
||||
If MA.dstma_TageProWoche >= 0 Then
|
||||
cboDaysPerWeek.Text = MA.dstma_TageProWoche
|
||||
End If
|
||||
|
||||
cbxMuster.Checked = MA.dstma_muster
|
||||
cbxWEStdRegelAZ.Checked = MA.dstma_WEStdRegelAZ
|
||||
cbxInaktiv.Checked = MA.dstma_inaktiv
|
||||
cbx4WoRhythmus.Checked = MA.dstma_4wo
|
||||
|
||||
txtStdFeiertagTZ.Text = If(MA.dstma_TzFeiertageStd, "")
|
||||
|
||||
|
||||
If cbxMuster.Checked Then 'cboArbVerh.SelectedIndex = 1 Then
|
||||
Dim tz As List(Of cDienstTeilzeit) = SQLDienst.getAllDienstTeilzeit(MA.dstma_id)
|
||||
For Each t In tz
|
||||
Select Case t.dsttz_wotag
|
||||
Case "MO"
|
||||
If t.dsttz_dienstplan = "BLAU1" Then
|
||||
cbxBlauMo.Checked = True
|
||||
getArbVhIndex(cboBlauMo, t.dsttz_abt)
|
||||
txtBlauVonMo.Text = t.dsttz_von
|
||||
txtBlauBisMo.Text = t.dsttz_bis
|
||||
txtBlauPauseMo.Text = t.dsttz_pause
|
||||
txtBlauBemMo.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "ROT1" Then
|
||||
cbxRotMo.Checked = True
|
||||
getArbVhIndex(cboRotMo, t.dsttz_abt)
|
||||
txtRotVonMo.Text = t.dsttz_von
|
||||
txtRotBisMo.Text = t.dsttz_bis
|
||||
txtRotPauseMo.Text = t.dsttz_pause
|
||||
txtRotBemMo.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "BLAU2" Then
|
||||
cbxBlau2Mo.Checked = True
|
||||
getArbVhIndex(cboBlau2Mo, t.dsttz_abt)
|
||||
txtBlau2VonMo.Text = t.dsttz_von
|
||||
txtBlau2BisMo.Text = t.dsttz_bis
|
||||
txtBlau2PauseMo.Text = t.dsttz_pause
|
||||
txtBlau2BemMo.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "ROT2" Then
|
||||
cbxRot2Mo.Checked = True
|
||||
getArbVhIndex(cboRot2Mo, t.dsttz_abt)
|
||||
txtRot2VonMo.Text = t.dsttz_von
|
||||
txtRot2BisMo.Text = t.dsttz_bis
|
||||
txtRot2PauseMo.Text = t.dsttz_pause
|
||||
txtRot2BemMo.Text = t.dsttz_bemerkung
|
||||
End If
|
||||
Case "DI"
|
||||
If t.dsttz_dienstplan = "BLAU1" Then
|
||||
cbxBlauDi.Checked = True
|
||||
getArbVhIndex(cboBlauDi, t.dsttz_abt)
|
||||
txtBlauVonDi.Text = t.dsttz_von
|
||||
txtBlauBisDi.Text = t.dsttz_bis
|
||||
txtBlauPauseDi.Text = t.dsttz_pause
|
||||
txtBlauBemDi.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "ROT1" Then
|
||||
cbxRotDi.Checked = True
|
||||
getArbVhIndex(cboRotDi, t.dsttz_abt)
|
||||
txtRotVonDi.Text = t.dsttz_von
|
||||
txtRotBisDi.Text = t.dsttz_bis
|
||||
txtRotPauseDi.Text = t.dsttz_pause
|
||||
txtRotBemDi.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "BLAU2" Then
|
||||
cbxBlau2Di.Checked = True
|
||||
getArbVhIndex(cboBlau2Di, t.dsttz_abt)
|
||||
txtBlau2VonDi.Text = t.dsttz_von
|
||||
txtBlau2BisDi.Text = t.dsttz_bis
|
||||
txtBlau2PauseDi.Text = t.dsttz_pause
|
||||
txtBlau2BemDi.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "ROT2" Then
|
||||
cbxRot2Di.Checked = True
|
||||
getArbVhIndex(cboRot2Di, t.dsttz_abt)
|
||||
txtRot2VonDi.Text = t.dsttz_von
|
||||
txtRot2BisDi.Text = t.dsttz_bis
|
||||
txtRot2PauseDi.Text = t.dsttz_pause
|
||||
txtRot2BemDi.Text = t.dsttz_bemerkung
|
||||
End If
|
||||
Case "MI"
|
||||
If t.dsttz_dienstplan = "BLAU1" Then
|
||||
cbxBlauMi.Checked = True
|
||||
getArbVhIndex(cboBlauMi, t.dsttz_abt)
|
||||
txtBlauVonMi.Text = t.dsttz_von
|
||||
txtBlauBisMi.Text = t.dsttz_bis
|
||||
txtBlauPauseMi.Text = t.dsttz_pause
|
||||
txtBlauBemMi.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "ROT1" Then
|
||||
cbxRotMi.Checked = True
|
||||
getArbVhIndex(cboRotMi, t.dsttz_abt)
|
||||
txtRotVonMi.Text = t.dsttz_von
|
||||
txtRotBisMi.Text = t.dsttz_bis
|
||||
txtRotPauseMi.Text = t.dsttz_pause
|
||||
txtRotBemMi.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "BLAU2" Then
|
||||
cbxBlau2Mi.Checked = True
|
||||
getArbVhIndex(cboBlau2Mi, t.dsttz_abt)
|
||||
txtBlau2VonMi.Text = t.dsttz_von
|
||||
txtBlau2BisMi.Text = t.dsttz_bis
|
||||
txtBlau2PauseMi.Text = t.dsttz_pause
|
||||
txtBlau2BemMi.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "ROT2" Then
|
||||
cbxRot2Mi.Checked = True
|
||||
getArbVhIndex(cboRot2Mi, t.dsttz_abt)
|
||||
txtRot2VonMi.Text = t.dsttz_von
|
||||
txtRot2BisMi.Text = t.dsttz_bis
|
||||
txtRot2PauseMi.Text = t.dsttz_pause
|
||||
txtRot2BemMi.Text = t.dsttz_bemerkung
|
||||
End If
|
||||
Case "DO"
|
||||
If t.dsttz_dienstplan = "BLAU1" Then
|
||||
cbxBlauDo.Checked = True
|
||||
getArbVhIndex(cboBlauDo, t.dsttz_abt)
|
||||
txtBlauVonDo.Text = t.dsttz_von
|
||||
txtBlauBisDo.Text = t.dsttz_bis
|
||||
txtBlauPauseDo.Text = t.dsttz_pause
|
||||
txtBlauBemDo.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "ROT1" Then
|
||||
cbxRotDo.Checked = True
|
||||
getArbVhIndex(cboRotDo, t.dsttz_abt)
|
||||
txtRotVonDo.Text = t.dsttz_von
|
||||
txtRotBisDo.Text = t.dsttz_bis
|
||||
txtRotPauseDo.Text = t.dsttz_pause
|
||||
txtRotBemDo.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "BLAU2" Then
|
||||
cbxBlau2Do.Checked = True
|
||||
getArbVhIndex(cboBlau2Do, t.dsttz_abt)
|
||||
txtBlau2VonDo.Text = t.dsttz_von
|
||||
txtBlau2BisDo.Text = t.dsttz_bis
|
||||
txtBlau2PauseDo.Text = t.dsttz_pause
|
||||
txtBlau2BemDo.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "ROT2" Then
|
||||
cbxRot2Do.Checked = True
|
||||
getArbVhIndex(cboRot2Do, t.dsttz_abt)
|
||||
txtRot2VonDo.Text = t.dsttz_von
|
||||
txtRot2BisDo.Text = t.dsttz_bis
|
||||
txtRot2PauseDo.Text = t.dsttz_pause
|
||||
txtRot2BemDo.Text = t.dsttz_bemerkung
|
||||
End If
|
||||
Case "FR"
|
||||
If t.dsttz_dienstplan = "BLAU1" Then
|
||||
cbxBlauFr.Checked = True
|
||||
getArbVhIndex(cboBlauFr, t.dsttz_abt)
|
||||
txtBlauVonFr.Text = t.dsttz_von
|
||||
txtBlauBisFr.Text = t.dsttz_bis
|
||||
txtBlauPauseFr.Text = t.dsttz_pause
|
||||
txtBlauBemFr.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "ROT1" Then
|
||||
cbxRotFr.Checked = True
|
||||
getArbVhIndex(cboRotFr, t.dsttz_abt)
|
||||
txtRotVonFr.Text = t.dsttz_von
|
||||
txtRotBisFr.Text = t.dsttz_bis
|
||||
txtRotPauseFr.Text = t.dsttz_pause
|
||||
txtRotBemFr.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "BLAU2" Then
|
||||
cbxBlau2Fr.Checked = True
|
||||
getArbVhIndex(cboBlau2Fr, t.dsttz_abt)
|
||||
txtBlau2VonFr.Text = t.dsttz_von
|
||||
txtBlau2BisFr.Text = t.dsttz_bis
|
||||
txtBlau2PauseFr.Text = t.dsttz_pause
|
||||
txtBlau2BemFr.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "ROT2" Then
|
||||
cbxRot2Fr.Checked = True
|
||||
getArbVhIndex(cboRot2Fr, t.dsttz_abt)
|
||||
txtRot2VonFr.Text = t.dsttz_von
|
||||
txtRot2BisFr.Text = t.dsttz_bis
|
||||
txtRot2PauseFr.Text = t.dsttz_pause
|
||||
txtRot2BemFr.Text = t.dsttz_bemerkung
|
||||
End If
|
||||
Case "SA"
|
||||
If t.dsttz_dienstplan = "BLAU1" Then
|
||||
cbxBlauSa.Checked = True
|
||||
getArbVhIndex(cboBlauSa, t.dsttz_abt)
|
||||
txtBlauVonSa.Text = t.dsttz_von
|
||||
txtBlauBisSa.Text = t.dsttz_bis
|
||||
txtBlauPauseSa.Text = t.dsttz_pause
|
||||
txtBlauBemSa.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "ROT1" Then
|
||||
cbxRotSa.Checked = True
|
||||
getArbVhIndex(cboRotSa, t.dsttz_abt)
|
||||
txtRotVonSa.Text = t.dsttz_von
|
||||
txtRotBisSa.Text = t.dsttz_bis
|
||||
txtRotPauseSa.Text = t.dsttz_pause
|
||||
txtRotBemSa.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "BLAU2" Then
|
||||
cbxBlau2Sa.Checked = True
|
||||
getArbVhIndex(cboBlau2Sa, t.dsttz_abt)
|
||||
txtBlau2VonSa.Text = t.dsttz_von
|
||||
txtBlau2BisSa.Text = t.dsttz_bis
|
||||
txtBlau2PauseSa.Text = t.dsttz_pause
|
||||
txtBlau2BemSa.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "ROT2" Then
|
||||
cbxRot2Sa.Checked = True
|
||||
getArbVhIndex(cboRot2Sa, t.dsttz_abt)
|
||||
txtRot2VonSa.Text = t.dsttz_von
|
||||
txtRot2BisSa.Text = t.dsttz_bis
|
||||
txtRot2PauseSa.Text = t.dsttz_pause
|
||||
txtRot2BemSa.Text = t.dsttz_bemerkung
|
||||
End If
|
||||
Case "SO"
|
||||
If t.dsttz_dienstplan = "BLAU1" Then
|
||||
cbxBlauSo.Checked = True
|
||||
getArbVhIndex(cboBlauSo, t.dsttz_abt)
|
||||
txtBlauVonSo.Text = t.dsttz_von
|
||||
txtBlauBisSo.Text = t.dsttz_bis
|
||||
txtBlauPauseSo.Text = t.dsttz_pause
|
||||
txtBlauBemSo.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "ROT1" Then
|
||||
cbxRotSo.Checked = True
|
||||
getArbVhIndex(cboRotSo, t.dsttz_abt)
|
||||
txtRotVonSo.Text = t.dsttz_von
|
||||
txtRotBisSo.Text = t.dsttz_bis
|
||||
txtRotPauseSo.Text = t.dsttz_pause
|
||||
txtRotBemSo.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "BLAU2" Then
|
||||
cbxBlau2So.Checked = True
|
||||
getArbVhIndex(cboBlau2So, t.dsttz_abt)
|
||||
txtBlau2VonSo.Text = t.dsttz_von
|
||||
txtBlau2BisSo.Text = t.dsttz_bis
|
||||
txtBlau2PauseSo.Text = t.dsttz_pause
|
||||
txtBlau2BemSo.Text = t.dsttz_bemerkung
|
||||
ElseIf t.dsttz_dienstplan = "ROT2" Then
|
||||
cbxRot2So.Checked = True
|
||||
getArbVhIndex(cboRot2So, t.dsttz_abt)
|
||||
txtRot2VonSo.Text = t.dsttz_von
|
||||
txtRot2BisSo.Text = t.dsttz_bis
|
||||
txtRot2PauseSo.Text = t.dsttz_pause
|
||||
txtRot2BemSo.Text = t.dsttz_bemerkung
|
||||
End If
|
||||
End Select
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
Function initMA() As Boolean
|
||||
Try
|
||||
MA.dstma_mitId = CType(cboMA.SelectedItem, VERAG_PROG_ALLGEMEIN.MyListItem).Value
|
||||
MA.dstma_abteilung = CType(cboAbt.SelectedItem, VERAG_PROG_ALLGEMEIN.MyListItem).Value
|
||||
MA.dstma_funktion = CType(cboFunktion.SelectedItem, VERAG_PROG_ALLGEMEIN.MyListItem).Value
|
||||
MA.dstma_arbvh = CType(cboArbVerh.SelectedItem, VERAG_PROG_ALLGEMEIN.MyListItem).Value
|
||||
MA.dstma_wochenStunden = txtWoStd.Text
|
||||
MA.dstma_stammSchicht = cboStammSchicht.Text
|
||||
MA.dstma_kuerzel = txtKuerzel.Text
|
||||
MA.dstma_reihenfolge = txtReihenfolge.Text
|
||||
MA.dstma_farbe = ColorTranslator.ToHtml(Button1.BackColor)
|
||||
MA.dstma_muster = cbxMuster.Checked
|
||||
MA.dstma_WEStdRegelAZ = cbxWEStdRegelAZ.Checked
|
||||
MA.dstma_inaktiv = cbxInaktiv.Checked
|
||||
MA.dstma_4wo = cbx4WoRhythmus.Checked
|
||||
MA.dstma_TzFeiertageStd = Nothing
|
||||
If IsNumeric(txtStdFeiertagTZ.Text) And txtStdFeiertagTZ.Visible Then MA.dstma_TzFeiertageStd = txtStdFeiertagTZ.Text
|
||||
|
||||
If IsNumeric(cboDaysPerWeek.Text) Then
|
||||
MA.dstma_TageProWoche = CInt(cboDaysPerWeek.Text)
|
||||
Else
|
||||
MA.dstma_TageProWoche = -1
|
||||
End If
|
||||
Return True
|
||||
Catch
|
||||
MsgBox("Alles ausgefüllt?")
|
||||
End Try
|
||||
Return False
|
||||
End Function
|
||||
Private Sub cboMA_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboMA.SelectedIndexChanged
|
||||
' Dim oItem As VERAG_PROG_ALLGEMEIN.MyListItem = CType(cboMA.SelectedItem, VERAG_PROG_ALLGEMEIN.MyListItem)
|
||||
End Sub
|
||||
|
||||
Function cboMyItemSelect(cbo As ComboBox, value As String) As Boolean
|
||||
For Each i In cbo.Items
|
||||
If i.GetType.Name.ToString.EndsWith("MyListItem") Then
|
||||
Try
|
||||
If CType(i, VERAG_PROG_ALLGEMEIN.MyListItem).Value = value Then
|
||||
cbo.SelectedItem = i : Return True
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
End Try
|
||||
End If
|
||||
Next
|
||||
Return False
|
||||
End Function
|
||||
|
||||
|
||||
Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
|
||||
If msg.WParam.ToInt32() = CInt(Keys.Enter) Then
|
||||
btnOK.PerformClick()
|
||||
Return True
|
||||
End If
|
||||
Return MyBase.ProcessCmdKey(msg, keyData)
|
||||
|
||||
End Function
|
||||
|
||||
Private Sub cboArbVerh_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboArbVerh.SelectedIndexChanged
|
||||
' grpTeilzeit.Enabled = (cboArbVerh.SelectedIndex = 1)
|
||||
Label27.Visible = (cboArbVerh.SelectedIndex = 1)
|
||||
Button1.Visible = (cboArbVerh.SelectedIndex = 1)
|
||||
|
||||
initTZUEberStd()
|
||||
' cboDaysPerWeek.Visible = (cboArbVerh.SelectedIndex = 1)
|
||||
' lblTage.Visible = (cboArbVerh.SelectedIndex = 1)
|
||||
End Sub
|
||||
|
||||
Sub initTZUEberStd()
|
||||
If Not cbxMuster.Checked And cboArbVerh.SelectedIndex = 1 Then
|
||||
txtStdFeiertagTZ.Visible = True
|
||||
Label57.Visible = True
|
||||
Else
|
||||
txtStdFeiertagTZ.Visible = False
|
||||
Label57.Visible = False
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Private Sub cboStammSchicht_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboStammSchicht.SelectedIndexChanged
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
If ColorDialog1.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
|
||||
Button1.BackColor = ColorDialog1.Color
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
Private Sub cbxMuster_CheckedChanged(sender As Object, e As EventArgs) Handles cbxMuster.CheckedChanged
|
||||
grpTeilzeit.Enabled = sender.checked
|
||||
cbxWEStdRegelAZ.Enabled = sender.checked
|
||||
If sender.checked = False Then cbxWEStdRegelAZ.Checked = False
|
||||
initTZUEberStd()
|
||||
End Sub
|
||||
|
||||
Private Sub cbx4WoRhythmus_CheckedChanged(sender As Object, e As EventArgs) Handles cbx4WoRhythmus.CheckedChanged
|
||||
pnl3.Enabled = sender.checked
|
||||
pnl4.Enabled = sender.checked
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub cboAbt_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboAbt.SelectedIndexChanged
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user