Advertisement
crying234324

Untitled

Feb 18th, 2024
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 26.99 KB | None | 0 0
  1. Imports System.IO
  2.  
  3. Public Class staff
  4.     Private Sub refreshdata()
  5.  
  6.         Dim filePath As String = "staff.txt"
  7.         Dim oneuser As String
  8.         Dim stafffields() As String
  9.  
  10.         ' Check if the file exists
  11.         If File.Exists(filePath) Then
  12.             DGV_staff.Rows.Clear()
  13.             Dim sr As New StreamReader(stafffile)
  14.  
  15.             While sr.Peek() >= 0
  16.  
  17.                 oneuser = sr.ReadLine
  18.                 stafffields = oneuser.Split(",")
  19.  
  20.                 DGV_staff.Rows.Add(decryption(stafffields(0)), decryption(LCase(stafffields(1))), decryption(stafffields(2)), decryption(stafffields(3)), decryption(stafffields(4)), decryption(stafffields(5)), decryption(stafffields(6)), decryption(stafffields(7)), decryption(stafffields(8)))
  21.  
  22.             End While
  23.             sr.Close()
  24.  
  25.         Else
  26.             MessageBox.Show("File not found.")
  27.         End If
  28.  
  29.         first()
  30.  
  31.     End Sub
  32.     Private Sub saveStaff()
  33.  
  34.         Dim name As String = UCase(txt_name.Text)
  35.         Dim surname As String = txt_surname.Text
  36.         Dim address As String = txt_address.Text
  37.         Dim Email As String = txt_email.Text
  38.         Dim staffnum As Integer
  39.         Dim telNum As String
  40.         Dim DOB As String
  41.         Dim safetosave As Boolean = False
  42.         Dim salary As String = txt_salary.Text
  43.         Dim parttime As String
  44.         If UCase(txt_parttime.Text) = "Y" Or UCase(txt_parttime.Text) = "N" Then
  45.  
  46.             parttime = txt_parttime.Text
  47.             safetosave = True
  48.  
  49.         Else
  50.  
  51.             safetosave = False
  52.             MsgBox("input a part time status as either Y or N")
  53.  
  54.         End If
  55.         If txt_StaffID.Text <> "StaffID" Then
  56.  
  57.             staffnum = CInt(txt_StaffID.Text)
  58.             safetosave = True
  59.  
  60.         Else
  61.  
  62.             MsgBox("no staff ID input")
  63.             safetosave = False
  64.  
  65.         End If
  66.         If txt_telNum.Text.Length = 11 And txt_telNum.Text.Contains("07") = True Then
  67.  
  68.             telNum = txt_telNum.Text
  69.             safetosave = True
  70.  
  71.         Else
  72.  
  73.             MsgBox("invalid phone number")
  74.             safetosave = False
  75.  
  76.         End If
  77.         If txt_DOB.Text.Contains("/") = True And txt_DOB.Text.Length = 10 Then
  78.  
  79.             DOB = txt_DOB.Text
  80.             safetosave = True
  81.  
  82.         Else
  83.  
  84.             safetosave = False
  85.             MsgBox("invalid date of birth, make sure it is in the format dd/mm/yyyy")
  86.  
  87.         End If
  88.  
  89.         Dim oneuser As String
  90.         Dim stafffields() As String
  91.         Dim swap As Boolean = False
  92.  
  93.         Dim sr As New StreamReader(stafffile)
  94.         While sr.Peek() >= 0
  95.             oneuser = sr.ReadLine
  96.             stafffields = oneuser.Split(",")
  97.             If CInt(decryption(stafffields(0))) = staffnum Then
  98.  
  99.                 swap = True
  100.  
  101.             End If
  102.  
  103.         End While
  104.         sr.Close()
  105.  
  106.         If safetosave = True And swap = False Then
  107.  
  108.             Dim stafffile As String = "staff.txt"
  109.  
  110.             Dim sw As New StreamWriter(stafffile, True) ' The True parameter appends to the file if it exists
  111.  
  112.             ' Write the new credentials in CSV format
  113.             sw.WriteLine(encryption(staffnum) & "," & encryption(surname) & "," & encryption(name) & "," & encryption(telNum) & "," & encryption(DOB) & "," & encryption(address) & "," & encryption(Email) & "," & encryption(salary) & "," & encryption(Parttime))
  114.  
  115.             ' Close the StreamWriter
  116.             sw.Close()
  117.  
  118.             ' Display a message or perform any other action as needed
  119.             MsgBox("New details successfully and saved to the staff file.")
  120.             refreshdata()
  121.  
  122.         ElseIf safetosave = True And swap = True Then
  123.  
  124.             Dim lines() As String = File.ReadAllLines(stafffile)
  125.  
  126.  
  127.             For i As Integer = 0 To lines.Length - 1
  128.                 Dim editstafffields() As String = lines(i).Split(",")
  129.  
  130.  
  131.                 If editstafffields.Length > 0 AndAlso decryption(editstafffields(0)) = staffnum Then
  132.                     ' Edit the information for the matched staff
  133.                     editstafffields(1) = encryption(surname)
  134.                     editstafffields(2) = encryption(name)
  135.                     editstafffields(3) = encryption(telNum)
  136.                     editstafffields(4) = encryption(DOB)
  137.                     editstafffields(5) = encryption(address)
  138.                     editstafffields(6) = encryption(Email)
  139.                     editstafffields(7) = encryption(salary)
  140.                     editstafffields(8) = encryption(parttime)
  141.  
  142.                     ' Join the fields back together with commas
  143.                     lines(i) = String.Join(",", editstafffields)
  144.                     MsgBox("staff edit saved")
  145.                 End If
  146.             Next
  147.  
  148.             ' Write the modified lines back to the file
  149.             File.WriteAllLines(stafffile, lines)
  150.             refreshdata()
  151.  
  152.         End If
  153.  
  154.     End Sub
  155.     Private Sub add()
  156.         Dim staffnum As Integer = 0
  157.         Dim oneuser As String
  158.         Dim stafffields() As String
  159.  
  160.  
  161.         Dim sr As New StreamReader(stafffile)
  162.         While sr.Peek() >= 0
  163.             oneuser = sr.ReadLine
  164.             stafffields = oneuser.Split(",")
  165.             If CInt(decryption(stafffields(0))) >= staffnum Then
  166.                 ' Increment the staff number if the current line has a valid staff id number
  167.                 staffnum = 1 + CInt(decryption(stafffields(0)))
  168.  
  169.             End If
  170.  
  171.         End While
  172.         txt_StaffID.Text = staffnum
  173.         txt_DOB.Text = ("DOB")
  174.         txt_surname.Text = ("Surname")
  175.         txt_name.Text = ("Name")
  176.         txt_telNum.Text = ("Tel num")
  177.         txt_address.Text = ("Address")
  178.         txt_email.Text = ("Email")
  179.         txt_salary.Text = ("Salary")
  180.         txt_parttime.Text = ("Part time?")
  181.  
  182.         sr.Close()
  183.  
  184.         Console.WriteLine()
  185.  
  186.     End Sub
  187.     Private Sub edit()
  188.  
  189.         ' Check if there is a selected row
  190.         If DGV_staff.SelectedRows.Count > 0 Then
  191.             ' Get the value of the first cell (column) in the selected row
  192.             Dim selectedstaffID As Object = DGV_staff.SelectedRows(0).Cells(0).Value
  193.             Dim selectedsurname As Object = DGV_staff.SelectedRows(0).Cells(1).Value
  194.             Dim selectedname As Object = DGV_staff.SelectedRows(0).Cells(2).Value
  195.             Dim selectedtelnum As Object = DGV_staff.SelectedRows(0).Cells(3).Value
  196.             Dim selectedDOB As Object = DGV_staff.SelectedRows(0).Cells(4).Value
  197.             Dim selectedaddress As Object = DGV_staff.SelectedRows(0).Cells(5).Value
  198.             Dim selectedemail As Object = DGV_staff.SelectedRows(0).Cells(6).Value
  199.             Dim selectedsalary As Object = DGV_staff.SelectedRows(0).Cells(7).Value
  200.             Dim selectedParttime As Object = DGV_staff.SelectedRows(0).Cells(8).Value
  201.  
  202.             ' Set the text of the TextBox
  203.             txt_StaffID.Text = If(selectedstaffID IsNot Nothing, selectedstaffID.ToString(), String.Empty)
  204.             txt_surname.Text = If(selectedsurname IsNot Nothing, selectedsurname.ToString(), String.Empty)
  205.             txt_name.Text = If(selectedname IsNot Nothing, selectedname.ToString(), String.Empty)
  206.             txt_telNum.Text = If(selectedtelnum IsNot Nothing, selectedtelnum.ToString(), String.Empty)
  207.             txt_DOB.Text = If(selectedDOB IsNot Nothing, selectedDOB.ToString(), String.Empty)
  208.             txt_address.Text = If(selectedaddress IsNot Nothing, selectedaddress.ToString(), String.Empty)
  209.             txt_email.Text = If(selectedemail IsNot Nothing, selectedemail.ToString(), String.Empty)
  210.             txt_salary.Text = If(selectedsalary IsNot Nothing, selectedsalary.ToString(), String.Empty)
  211.             txt_parttime.Text = If(selectedParttime IsNot Nothing, selectedParttime.ToString(), String.Empty)
  212.  
  213.         End If
  214.         refreshdata()
  215.     End Sub
  216.     Private Sub search()
  217.         Dim emailtosearch As String = UCase(txt_email.Text)
  218.         Dim telnumtosearch As String = UCase(txt_telNum.Text)
  219.         Dim array() As String = File.ReadAllLines(stafffile)
  220.  
  221.  
  222.         If emailtosearch = "Email" Or emailtosearch = "" Or telnumtosearch = "tel num" Or telnumtosearch = "" Then
  223.  
  224.             MsgBox("input an email or telephone number to search")
  225.         Else
  226.  
  227.             Dim foundrow As Integer
  228.             Dim row As Integer
  229.             Dim found As Boolean = False
  230.  
  231.             For Each line As String In array
  232.  
  233.                 Dim stafffields() As String = line.Split(",")
  234.  
  235.  
  236.                 If decryption(stafffields(6)) = emailtosearch Then
  237.  
  238.                     foundrow = row
  239.                     found = True
  240.  
  241.                 End If
  242.                 If decryption(stafffields(3)) = telnumtosearch Then
  243.  
  244.                     foundrow = row
  245.                     found = True
  246.  
  247.                 End If
  248.                 row = row + 1
  249.  
  250.             Next
  251.             If found = True Then
  252.  
  253.                 DGV_staff.ClearSelection()
  254.                 DGV_staff.Rows(foundrow).Selected = True
  255.  
  256.             End If
  257.  
  258.  
  259.         End If
  260.     End Sub
  261.     Private Sub delete()
  262.  
  263.         MsgBox("are you sure you want to delete this staff member", MsgBoxStyle.YesNo)
  264.         If MsgBoxResult.Yes Then
  265.  
  266.             Dim lines() As String = File.ReadAllLines(stafffile)
  267.  
  268.             ' Create a list to store modified lines
  269.             Dim modifiedLines As New List(Of String)
  270.  
  271.             ' Iterate through the lines and exclude the line to delete
  272.             For Each line As String In lines
  273.                 Dim stafffields() As String = line.Split(",")
  274.  
  275.  
  276.                 If stafffields.Length > 0 AndAlso decryption(stafffields(0)) <> DGV_staff.SelectedRows(0).Cells(0).Value Then
  277.                     ' Add the line to the modifiedLines list
  278.                     modifiedLines.Add(line)
  279.  
  280.                 End If
  281.             Next
  282.  
  283.             ' Write the modified lines back to the file
  284.             File.WriteAllLines(stafffile, modifiedLines.ToArray())
  285.             refreshdata()
  286.         End If
  287.  
  288.     End Sub
  289.     Private Sub first()
  290.  
  291.         DGV_staff.ClearSelection()
  292.  
  293.         ' Check if there are any rows in the DataGridView
  294.         If DGV_staff.Rows.Count > 0 Then
  295.  
  296.             ' highlight the entire row
  297.             DGV_staff.Rows(0).Selected = True
  298.  
  299.         End If
  300.  
  301.     End Sub
  302.     Private Sub last()
  303.  
  304.  
  305.         DGV_staff.ClearSelection()
  306.         ' Check if there are any rows in the DataGridView
  307.         If DGV_staff.Rows.Count > 0 Then
  308.  
  309.             Dim lastIndex As Integer = DGV_staff.Rows.Count - 1
  310.             'highlight the entire row
  311.             DGV_staff.Rows(lastIndex).Selected = True
  312.  
  313.         End If
  314.  
  315.     End Sub
  316.     Private Sub back()
  317.  
  318.         If DGV_staff.SelectedRows.Count > 0 And DGV_staff.SelectedRows(0).Index <> 0 Then
  319.             ' Get the index of the first selected row
  320.             Dim nexindex As Integer = DGV_staff.SelectedRows(0).Index - 1
  321.             DGV_staff.ClearSelection()
  322.             DGV_staff.Rows(nexindex).Selected = True
  323.         ElseIf DGV_staff.SelectedRows(0).Index = 0 Then
  324.  
  325.             MsgBox("already reached the top of the list")
  326.  
  327.         Else
  328.  
  329.             MsgBox("No row selected.")
  330.  
  331.         End If
  332.  
  333.     End Sub
  334.     Private Sub forward()
  335.  
  336.         Dim lastIndex As Integer = DGV_staff.Rows.Count - 1
  337.         If DGV_staff.SelectedRows.Count > 0 And DGV_staff.SelectedRows(0).Index <> lastIndex Then
  338.             ' Get the index of the first selected row
  339.             Dim nexindex As Integer = DGV_staff.SelectedRows(0).Index + 1
  340.             DGV_staff.ClearSelection()
  341.             DGV_staff.Rows(nexindex).Selected = True
  342.         ElseIf DGV_staff.SelectedRows(0).Index = lastIndex Then
  343.  
  344.             MsgBox("already reached the bottom of the list")
  345.  
  346.         Else
  347.  
  348.             MsgBox("No row selected.")
  349.  
  350.         End If
  351.  
  352.     End Sub
  353.     Private Sub txt_DOB_TextChanged(sender As Object, e As EventArgs) Handles txt_DOB.TextChanged
  354.         Dim myString As String = txt_DOB.Text
  355.  
  356.         Dim wordToFind As String = "DOB"
  357.         Dim cursorPosition As Integer = txt_DOB.SelectionStart
  358.         If txt_DOB.Text <> "DOB" Then
  359.  
  360.  
  361.             Dim containsWord As Boolean = myString.Contains(wordToFind)
  362.  
  363.  
  364.             If containsWord = True Then
  365.  
  366.                 myString = myString.Replace(wordToFind, "")
  367.                 txt_DOB.Text = myString
  368.                 txt_DOB.SelectionStart = cursorPosition + (txt_DOB.Text.Length - cursorPosition)
  369.  
  370.             End If
  371.  
  372.         End If
  373.     End Sub
  374.  
  375.     Private Sub txt_address_TextChanged(sender As Object, e As EventArgs) Handles txt_address.TextChanged
  376.         Dim myString As String = txt_address.Text
  377.  
  378.         Dim wordToFind As String = "Address"
  379.         Dim cursorPosition As Integer = txt_address.SelectionStart
  380.         If txt_address.Text <> "Address" Then
  381.  
  382.  
  383.             Dim containsWord As Boolean = myString.Contains(wordToFind)
  384.  
  385.  
  386.             If containsWord = True Then
  387.  
  388.                 myString = myString.Replace(wordToFind, "")
  389.                 txt_address.Text = myString
  390.                 txt_address.SelectionStart = cursorPosition + (txt_address.Text.Length - cursorPosition)
  391.  
  392.             End If
  393.  
  394.         End If
  395.     End Sub
  396.  
  397.     Private Sub txt_surname_TextChanged(sender As Object, e As EventArgs) Handles txt_surname.TextChanged
  398.         Dim myString As String = txt_surname.Text
  399.  
  400.         Dim wordToFind As String = "Surname"
  401.         Dim cursorPosition As Integer = txt_surname.SelectionStart
  402.         If txt_surname.Text <> "Surname" Then
  403.  
  404.  
  405.             Dim containsWord As Boolean = myString.Contains(wordToFind)
  406.  
  407.  
  408.             If containsWord = True Then
  409.  
  410.                 myString = myString.Replace(wordToFind, "")
  411.                 txt_surname.Text = myString
  412.                 txt_surname.SelectionStart = cursorPosition + (txt_surname.Text.Length - cursorPosition)
  413.  
  414.             End If
  415.  
  416.         End If
  417.     End Sub
  418.  
  419.     Private Sub txt_email_TextChanged(sender As Object, e As EventArgs) Handles txt_email.TextChanged
  420.         Dim myString As String = txt_email.Text
  421.  
  422.         Dim wordToFind As String = "Email"
  423.         Dim cursorPosition As Integer = txt_email.SelectionStart
  424.         If txt_email.Text <> "Email" Then
  425.  
  426.  
  427.             Dim containsWord As Boolean = myString.Contains(wordToFind)
  428.  
  429.  
  430.             If containsWord = True Then
  431.  
  432.                 myString = myString.Replace(wordToFind, "")
  433.                 txt_email.Text = myString
  434.                 txt_email.SelectionStart = cursorPosition + (txt_email.Text.Length - cursorPosition)
  435.  
  436.             End If
  437.  
  438.         End If
  439.     End Sub
  440.  
  441.     Private Sub txt_name_TextChanged(sender As Object, e As EventArgs) Handles txt_name.TextChanged
  442.         Dim myString As String = txt_name.Text
  443.  
  444.         Dim wordToFind As String = "Name"
  445.         Dim cursorPosition As Integer = txt_name.SelectionStart
  446.         If txt_name.Text <> "Name" Then
  447.  
  448.  
  449.             Dim containsWord As Boolean = myString.Contains(wordToFind)
  450.  
  451.  
  452.             If containsWord = True Then
  453.  
  454.                 myString = myString.Replace(wordToFind, "")
  455.                 txt_name.Text = myString
  456.                 txt_name.SelectionStart = cursorPosition + (txt_name.Text.Length - cursorPosition)
  457.  
  458.             End If
  459.  
  460.         End If
  461.     End Sub
  462.  
  463.     Private Sub txt_telNum_TextChanged(sender As Object, e As EventArgs) Handles txt_telNum.TextChanged
  464.         Dim myString As String = txt_telNum.Text
  465.  
  466.         Dim wordToFind As String = "Tel num"
  467.         Dim cursorPosition As Integer = txt_telNum.SelectionStart
  468.         If txt_telNum.Text <> "Tel num" Then
  469.  
  470.  
  471.             Dim containsWord As Boolean = myString.Contains(wordToFind)
  472.  
  473.  
  474.             If containsWord = True Then
  475.  
  476.                 myString = myString.Replace(wordToFind, "")
  477.                 txt_telNum.Text = myString
  478.                 txt_telNum.SelectionStart = cursorPosition + (txt_telNum.Text.Length - cursorPosition)
  479.  
  480.             End If
  481.  
  482.         End If
  483.     End Sub
  484.  
  485.     Private Sub txt_salary_TextChanged(sender As Object, e As EventArgs) Handles txt_salary.TextChanged
  486.         Dim myString As String = txt_salary.Text
  487.  
  488.         Dim wordToFind As String = "Salary"
  489.         Dim cursorPosition As Integer = txt_salary.SelectionStart
  490.         If txt_salary.Text <> "Salary" Then
  491.  
  492.  
  493.             Dim containsWord As Boolean = myString.Contains(wordToFind)
  494.  
  495.  
  496.             If containsWord = True Then
  497.  
  498.                 myString = myString.Replace(wordToFind, "")
  499.                 txt_salary.Text = myString
  500.                 txt_salary.SelectionStart = cursorPosition + (txt_salary.Text.Length - cursorPosition)
  501.  
  502.             End If
  503.  
  504.         End If
  505.     End Sub
  506.     Private Sub txt_parttime_TextChanged(sender As Object, e As EventArgs) Handles txt_parttime.TextChanged
  507.         Dim myString As String = txt_parttime.Text
  508.  
  509.         Dim wordToFind As String = "Part time?"
  510.         Dim cursorPosition As Integer = txt_parttime.SelectionStart
  511.         If txt_parttime.Text <> "Part time?" Then
  512.  
  513.  
  514.             Dim containsWord As Boolean = myString.Contains(wordToFind)
  515.  
  516.  
  517.             If containsWord = True Then
  518.  
  519.                 myString = myString.Replace(wordToFind, "")
  520.                 txt_parttime.Text = myString
  521.                 txt_parttime.SelectionStart = cursorPosition + (txt_parttime.Text.Length - cursorPosition)
  522.  
  523.             End If
  524.  
  525.         End If
  526.     End Sub
  527.     Private Sub txt_DOB_MouseLeave(sender As Object, e As EventArgs) Handles txt_DOB.MouseLeave
  528.         If txt_DOB.Text = "" Then
  529.  
  530.             txt_DOB.Text = "DOB"
  531.  
  532.         End If
  533.     End Sub
  534.  
  535.     Private Sub txt_DOB_MouseEnter(sender As Object, e As EventArgs) Handles txt_DOB.MouseEnter
  536.         If txt_DOB.Text = "DOB" Then
  537.  
  538.             txt_DOB.Text = ""
  539.  
  540.         End If
  541.     End Sub
  542.  
  543.     Private Sub pbx_DOB_MouseEnter(sender As Object, e As EventArgs) Handles pbx_DOB.MouseEnter
  544.         If txt_DOB.Text = "DOB" Then
  545.  
  546.             txt_DOB.Text = ""
  547.  
  548.         End If
  549.     End Sub
  550.  
  551.     Private Sub pbx_DOB_MouseLeave(sender As Object, e As EventArgs) Handles pbx_DOB.MouseLeave
  552.         If txt_DOB.Text = "" Then
  553.  
  554.             txt_DOB.Text = "DOB"
  555.  
  556.         End If
  557.     End Sub
  558.  
  559.     Private Sub txt_surname_MouseEnter(sender As Object, e As EventArgs) Handles txt_surname.MouseEnter
  560.         If txt_surname.Text = "Surname" Then
  561.  
  562.             txt_surname.Text = ""
  563.  
  564.         End If
  565.     End Sub
  566.  
  567.     Private Sub txt_surname_MouseLeave(sender As Object, e As EventArgs) Handles txt_surname.MouseLeave
  568.         If txt_surname.Text = "" Then
  569.  
  570.             txt_surname.Text = "Surname"
  571.  
  572.         End If
  573.     End Sub
  574.  
  575.     Private Sub PBX_surname_MouseEnter(sender As Object, e As EventArgs) Handles PBX_surname.MouseEnter
  576.         If txt_surname.Text = "Surname" Then
  577.  
  578.             txt_surname.Text = ""
  579.  
  580.         End If
  581.     End Sub
  582.  
  583.     Private Sub PBX_surname_MouseLeave(sender As Object, e As EventArgs) Handles PBX_surname.MouseLeave
  584.         If txt_surname.Text = "" Then
  585.  
  586.             txt_surname.Text = "Surname"
  587.  
  588.         End If
  589.     End Sub
  590.  
  591.     Private Sub txt_address_MouseEnter(sender As Object, e As EventArgs) Handles txt_address.MouseEnter
  592.         If txt_address.Text = "Address" Then
  593.  
  594.             txt_address.Text = ""
  595.  
  596.         End If
  597.     End Sub
  598.  
  599.     Private Sub txt_address_MouseLeave(sender As Object, e As EventArgs) Handles txt_address.MouseLeave
  600.         If txt_address.Text = "" Then
  601.  
  602.             txt_address.Text = "Address"
  603.  
  604.         End If
  605.     End Sub
  606.  
  607.     Private Sub PBX_address_MouseEnter(sender As Object, e As EventArgs) Handles PBX_address.MouseEnter
  608.         If txt_address.Text = "Address" Then
  609.  
  610.             txt_address.Text = ""
  611.  
  612.         End If
  613.     End Sub
  614.  
  615.     Private Sub PBX_address_MouseLeave(sender As Object, e As EventArgs) Handles PBX_address.MouseLeave
  616.         If txt_address.Text = "" Then
  617.  
  618.             txt_address.Text = "Address"
  619.  
  620.         End If
  621.     End Sub
  622.  
  623.     Private Sub txt_email_MouseEnter(sender As Object, e As EventArgs) Handles txt_email.MouseEnter
  624.         If txt_email.Text = "Email" Then
  625.  
  626.             txt_email.Text = ""
  627.  
  628.         End If
  629.     End Sub
  630.     Private Sub PBX_Email_MouseEnter(sender As Object, e As EventArgs) Handles PBX_Email.MouseEnter
  631.         If txt_email.Text = "Email" Then
  632.  
  633.             txt_email.Text = ""
  634.  
  635.         End If
  636.     End Sub
  637.  
  638.     Private Sub PBX_Email_MouseLeave(sender As Object, e As EventArgs) Handles PBX_Email.MouseLeave
  639.         If txt_email.Text = "" Then
  640.  
  641.             txt_email.Text = "Email"
  642.  
  643.         End If
  644.     End Sub
  645.  
  646.     Private Sub txt_email_MouseLeave(sender As Object, e As EventArgs) Handles txt_email.MouseLeave
  647.         If txt_email.Text = "" Then
  648.  
  649.             txt_email.Text = "Email"
  650.  
  651.         End If
  652.     End Sub
  653.  
  654.     Private Sub txt_telNum_MouseEnter(sender As Object, e As EventArgs) Handles txt_telNum.MouseEnter
  655.         If txt_telNum.Text = "Tel num" Then
  656.  
  657.             txt_telNum.Text = ""
  658.  
  659.         End If
  660.     End Sub
  661.  
  662.     Private Sub txt_telNum_MouseLeave(sender As Object, e As EventArgs) Handles txt_telNum.MouseLeave
  663.         If txt_telNum.Text = "" Then
  664.  
  665.             txt_telNum.Text = "Tel num"
  666.  
  667.         End If
  668.     End Sub
  669.  
  670.     Private Sub PBX_telNum_MouseEnter(sender As Object, e As EventArgs) Handles PBX_telNum.MouseEnter
  671.         If txt_telNum.Text = "Tel num" Then
  672.  
  673.             txt_telNum.Text = ""
  674.  
  675.         End If
  676.     End Sub
  677.  
  678.     Private Sub PBX_telNum_MouseLeave(sender As Object, e As EventArgs) Handles PBX_telNum.MouseLeave
  679.         If txt_telNum.Text = "" Then
  680.  
  681.             txt_telNum.Text = "Tel num"
  682.  
  683.         End If
  684.     End Sub
  685.  
  686.     Private Sub txt_name_MouseEnter(sender As Object, e As EventArgs) Handles txt_name.MouseEnter
  687.         If txt_name.Text = "Name" Then
  688.  
  689.             txt_name.Text = ""
  690.  
  691.         End If
  692.     End Sub
  693.  
  694.     Private Sub txt_name_MouseLeave(sender As Object, e As EventArgs) Handles txt_name.MouseLeave
  695.         If txt_name.Text = "" Then
  696.  
  697.             txt_name.Text = "Name"
  698.  
  699.         End If
  700.     End Sub
  701.  
  702.     Private Sub PBX_Name_MouseEnter(sender As Object, e As EventArgs) Handles PBX_Name.MouseEnter
  703.         If txt_name.Text = "Name" Then
  704.  
  705.             txt_name.Text = ""
  706.  
  707.         End If
  708.     End Sub
  709.  
  710.     Private Sub PBX_Name_MouseLeave(sender As Object, e As EventArgs) Handles PBX_Name.MouseLeave
  711.         If txt_name.Text = "" Then
  712.  
  713.             txt_name.Text = "Name"
  714.  
  715.         End If
  716.     End Sub
  717.  
  718.     Private Sub txt_salary_MouseEnter(sender As Object, e As EventArgs) Handles txt_salary.MouseEnter
  719.         If txt_salary.Text = "Salary" Then
  720.  
  721.             txt_salary.Text = ""
  722.  
  723.         End If
  724.     End Sub
  725.  
  726.     Private Sub txt_salary_MouseLeave(sender As Object, e As EventArgs) Handles txt_salary.MouseLeave
  727.         If txt_salary.Text = "" Then
  728.  
  729.             txt_salary.Text = "Salary"
  730.  
  731.         End If
  732.     End Sub
  733.  
  734.     Private Sub pbx_salary_MouseEnter(sender As Object, e As EventArgs) Handles pbx_salary.MouseEnter
  735.         If txt_salary.Text = "Salary" Then
  736.  
  737.             txt_salary.Text = ""
  738.  
  739.         End If
  740.     End Sub
  741.  
  742.     Private Sub pbx_salary_MouseLeave(sender As Object, e As EventArgs) Handles pbx_salary.MouseLeave
  743.         If txt_salary.Text = "" Then
  744.  
  745.             txt_salary.Text = "Salary"
  746.  
  747.         End If
  748.     End Sub
  749.  
  750.     Private Sub pbx_parttime_MouseEnter(sender As Object, e As EventArgs) Handles pbx_parttime.MouseEnter
  751.         If txt_parttime.Text = "Part time?" Then
  752.  
  753.             txt_parttime.Text = ""
  754.  
  755.         End If
  756.     End Sub
  757.  
  758.     Private Sub pbx_parttime_MouseLeave(sender As Object, e As EventArgs) Handles pbx_parttime.MouseLeave
  759.         If txt_parttime.Text = "" Then
  760.  
  761.             txt_parttime.Text = "Part time?"
  762.  
  763.         End If
  764.     End Sub
  765.  
  766.     Private Sub txt_parttime_MouseEnter(sender As Object, e As EventArgs) Handles txt_parttime.MouseEnter
  767.         If txt_parttime.Text = "Part time?" Then
  768.  
  769.             txt_parttime.Text = ""
  770.  
  771.         End If
  772.     End Sub
  773.  
  774.     Private Sub txt_parttime_MouseLeave(sender As Object, e As EventArgs) Handles txt_parttime.MouseLeave
  775.         If txt_parttime.Text = "" Then
  776.  
  777.             txt_parttime.Text = "Part time?"
  778.  
  779.         End If
  780.     End Sub
  781.  
  782.     Private Sub staff_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  783.         If access = 2 Then
  784.  
  785.             txt_salary.ReadOnly = True
  786.             txt_parttime.ReadOnly = True
  787.  
  788.         End If
  789.         If access > 2 Then
  790.  
  791.             txt_salary.ReadOnly = False
  792.             txt_parttime.ReadOnly = False
  793.  
  794.         End If
  795.         getstafffilelocations()
  796.         refreshdata()
  797.     End Sub
  798.  
  799.     Private Sub lbl_start_Click(sender As Object, e As EventArgs) Handles lbl_start.Click
  800.         first()
  801.     End Sub
  802.  
  803.     Private Sub pbx_start_Click(sender As Object, e As EventArgs) Handles pbx_start.Click
  804.         first()
  805.     End Sub
  806.  
  807.     Private Sub lbl_forwardData_Click(sender As Object, e As EventArgs) Handles lbl_forwardData.Click
  808.         forward()
  809.     End Sub
  810.  
  811.     Private Sub pbx_forwardData_Click(sender As Object, e As EventArgs) Handles pbx_forwardData.Click
  812.         forward()
  813.     End Sub
  814.  
  815.     Private Sub lbl_backData_Click(sender As Object, e As EventArgs) Handles lbl_backData.Click
  816.         back()
  817.     End Sub
  818.  
  819.     Private Sub pbx_backdata_Click(sender As Object, e As EventArgs) Handles pbx_backdata.Click
  820.         back()
  821.     End Sub
  822.  
  823.     Private Sub lbl_end_Click(sender As Object, e As EventArgs) Handles lbl_end.Click
  824.         last()
  825.     End Sub
  826.  
  827.     Private Sub pbx_end_Click(sender As Object, e As EventArgs) Handles pbx_end.Click
  828.         last()
  829.     End Sub
  830.  
  831.     Private Sub PBX_back_Click(sender As Object, e As EventArgs) Handles PBX_back.Click
  832.         'opens next form, closes current form
  833.         Dim nextform As New MainMenu()
  834.         nextform.Show()
  835.         Me.Hide()
  836.     End Sub
  837.  
  838.     Private Sub lbl_back_Click(sender As Object, e As EventArgs) Handles lbl_back.Click
  839.         'opens next form, closes current form
  840.         Dim nextform As New MainMenu()
  841.         nextform.Show()
  842.         Me.Hide()
  843.     End Sub
  844.  
  845.     Private Sub pbx_addUser_Click(sender As Object, e As EventArgs) Handles pbx_addUser.Click
  846.         add()
  847.     End Sub
  848.  
  849.     Private Sub lbl_add_Click(sender As Object, e As EventArgs) Handles lbl_add.Click
  850.         add()
  851.     End Sub
  852.  
  853.     Private Sub lbl_delete_Click(sender As Object, e As EventArgs) Handles lbl_delete.Click
  854.         delete()
  855.     End Sub
  856.  
  857.     Private Sub PBX_deleteUser_Click(sender As Object, e As EventArgs) Handles PBX_deleteUser.Click
  858.         delete()
  859.     End Sub
  860.  
  861.     Private Sub pbx_editUser_Click(sender As Object, e As EventArgs) Handles pbx_editUser.Click
  862.         edit()
  863.     End Sub
  864.  
  865.     Private Sub lbl_edit_Click(sender As Object, e As EventArgs) Handles lbl_edit.Click
  866.         edit()
  867.     End Sub
  868.  
  869.     Private Sub lbl_search_Click(sender As Object, e As EventArgs) Handles lbl_search.Click
  870.         search()
  871.     End Sub
  872.  
  873.     Private Sub pbx_searchUser_Click(sender As Object, e As EventArgs) Handles pbx_searchUser.Click
  874.         search()
  875.     End Sub
  876.  
  877.     Private Sub lbl_save_Click(sender As Object, e As EventArgs) Handles lbl_save.Click
  878.         saveStaff()
  879.     End Sub
  880.  
  881.     Private Sub pbx_saveUser_Click(sender As Object, e As EventArgs) Handles pbx_saveUser.Click
  882.         saveStaff()
  883.     End Sub
  884. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement