Files
ADMIN/UID/Dienstplan/usrCntlZeitenAendern.vb
2019-08-08 12:44:50 +02:00

64 lines
2.4 KiB
VB.net

Public Class usrCntlZeitenAendern
Dim FUNC As New cProgramFunctions
Event SAVE()
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Visible = False
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles txtVon.LostFocus, txtBis.LostFocus
If sender.text.contains(",5") Then
sender.text = sender.text.replace(",5", ":30")
End If
If sender.text.contains(",") Then
sender.text = sender.text.replace(",", ":")
End If
If sender.text.contains(":") And sender.text.length = 4 Then
sender.text = "0" & sender.text
End If
If IsNumeric(sender.text) AndAlso CInt(sender.text) < 24 Then
sender.text = CInt(sender.text).ToString("00") & ":00"
End If
If cbxZeitAutInBem.Checked Then
If txtVon.Text = lblVon.Text.Replace("(", "").Replace(")", "") And txtBis.Text = lblBis.Text.Replace("(", "").Replace(")", "") Then
txtBemerkung.Text = ""
Else
If txtVon.Text.Contains(":00") And txtBis.Text.Contains(":00") Then
txtBemerkung.Text = txtVon.Text.Replace(":00", "") & "-" & txtBis.Text.Replace(":00", "") & "h"
Else
txtBemerkung.Text = txtVon.Text & "-" & txtBis.Text
End If
End If
End If
End Sub
Private Sub txtVon_TextChanged(sender As Object, e As EventArgs) Handles txtVon.TextChanged, txtBis.TextChanged
sender.ForeColor = IIf(FUNC.isValidTime(sender.text), Color.Black, Color.Red)
End Sub
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
If txtVon.ForeColor = Color.Red Then Exit Sub
If txtBis.ForeColor = Color.Red Then Exit Sub
If txtPause.ForeColor = Color.Red Then Exit Sub
RaiseEvent SAVE()
End Sub
Private Sub txtPause_KeyDown(sender As Object, e As KeyEventArgs) Handles txtVon.KeyDown, txtBis.KeyDown, txtPause.KeyDown, txtBemerkung.KeyDown
' InvokeLostFocus(sender, New EventArgs)
If e.KeyCode = Keys.Return Then
Button8.PerformClick()
End If
End Sub
Private Sub txtPause_TextChanged(sender As Object, e As EventArgs) Handles txtPause.TextChanged
sender.ForeColor = IIf(IsNumeric(sender.text), Color.Black, Color.Red)
End Sub
End Class