Advertisement
willeds

Untitled

Feb 18th, 2024 (edited)
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 22.50 KB | None | 0 0
  1. Imports System.IO
  2.  
  3. Imports File = System.IO.File
  4.  
  5. Public Class myAppointment
  6.     Private Sub myStaff_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  7.         fillGrid(dgv_appointment, fileLoc_Appointment)
  8.         ' fills the grid when the user loadths form
  9.  
  10.         ' StartPosition = FormStartPosition.CenterScreen
  11.         ' centering of screen occurs in design code
  12.  
  13.  
  14.         ' sets the colours for the textbox using the values from my design
  15.         txt_appID.BackColor = gray
  16.         txt_staffID.BackColor = gray
  17.         txt_cusID.BackColor = gray
  18.         txt_cusName.BackColor = gray
  19.         txt_staffIDApp.BackColor = gray
  20.         txt_staffNameApp.BackColor = gray
  21.         DTP_Appointment.BackColor = gray
  22.         DTP_booking.BackColor = gray
  23.         txt_tOA.BackColor = gray
  24.         txt_treatmentID.BackColor = gray
  25.         txt_service1.BackColor = gray
  26.         txt_service2.BackColor = gray
  27.         txt_service3.BackColor = gray
  28.         txt_serviceName1.BackColor = gray
  29.         txt_serviceName2.BackColor = gray
  30.         txt_serviceName3.BackColor = gray
  31.     End Sub
  32.  
  33.     Private Sub fillText(ByVal rowIndex As Integer)
  34.         txt_appID.Text = dgv_appointment.Rows(rowIndex).Cells(0).Value
  35.         txt_staffID.Text = dgv_appointment.Rows(rowIndex).Cells(1).Value
  36.         txt_cusID.Text = dgv_appointment.Rows(rowIndex).Cells(2).Value
  37.         ' taking the value from current row
  38.  
  39.         txt_cusName.Text = Decryption(FindField(fileLoc_Customer, txt_cusID.Text, 1)) + " " + Decryption(FindField(fileLoc_Customer, txt_cusID.Text, 2))
  40.         ' combines the forename and surname from the customer file for the customer ID
  41.  
  42.         txt_staffIDApp.Text = dgv_appointment.Rows(rowIndex).Cells(3).Value
  43.         ' taking the value from current row
  44.  
  45.         txt_staffNameApp.Text = Decryption(FindField(fileLoc_Staff, txt_staffIDApp.Text, 1)) + " " + Decryption(FindField(fileLoc_Staff, txt_staffIDApp.Text, 2))
  46.         ' combines the forename and surname from the Staff file from the staff ID
  47.  
  48.         ' error handling for the MinValue if a date wasn't assigned, avoids crashes
  49.         If Not dgv_appointment.Rows(rowIndex).Cells(4).Value = Date.MinValue Then
  50.             DTP_booking.Value = dgv_appointment.Rows(rowIndex).Cells(4).Value
  51.             DTP_Appointment.Value = dgv_appointment.Rows(rowIndex).Cells(5).Value
  52.             ' taking the value from current row
  53.         End If
  54.         txt_tOA.Text = dgv_appointment.Rows(rowIndex).Cells(6).Value
  55.         txt_treatmentID.Text = dgv_appointment.Rows(rowIndex).Cells(7).Value
  56.         ' taking the value from current row
  57.  
  58.  
  59.         txt_treatmentName.Text = FindField(fileLoc_Appointment, txt_treatmentID.Text, 2)
  60.         ' finds the name of the treatment from the file by taking the ID and searching, avoids memorising the names of the treatments
  61.  
  62.         Dim ServiceUse As Integer = FindField(fileLoc_Appointment, txt_appID.Text, 8)
  63.         ' Finds the service use from the appointment record, does it this way as it doesn't appear on the table
  64.         txt_service1.Text = FindField(FileLoc_ServiceUse, ServiceUse, 2)
  65.         txt_service2.Text = FindField(FileLoc_ServiceUse, ServiceUse, 3)
  66.         txt_service3.Text = FindField(FileLoc_ServiceUse, ServiceUse, 4)
  67.         ' Searches the service use file with the found ID to find the appropriate service IDs
  68.  
  69.         txt_serviceName1.Text = FindField(FileLoc_Service, txt_service1.Text, 2)
  70.         txt_serviceName2.Text = FindField(FileLoc_Service, txt_service2.Text, 2)
  71.         txt_serviceName3.Text = FindField(FileLoc_Service, txt_service3.Text, 2)
  72.         ' Takes the name from the service file by using the ID found in the above code
  73.     End Sub
  74.  
  75.  
  76.  
  77.  
  78.     Private Sub clearText()
  79.         txt_appID.Text = ""
  80.         txt_staffID.Text = ""
  81.         txt_cusID.Text = ""
  82.         txt_cusName.Text = ""
  83.         txt_staffIDApp.Text = ""
  84.         txt_staffNameApp.Text = ""
  85.         DTP_booking.Text = ""
  86.         DTP_Appointment.Text = ""
  87.         txt_tOA.Text = ""
  88.         txt_treatmentID.Text = ""
  89.         txt_service1.Text = ""
  90.         txt_service2.Text = ""
  91.         txt_service3.Text = ""
  92.         txt_serviceName1.Text = ""
  93.         txt_serviceName2.Text = ""
  94.         txt_serviceName3.Text = ""
  95.         ' Subroutine to clear all the text boxes on screen, can be called anywhere in the form
  96.     End Sub
  97.  
  98.  
  99.  
  100.     'Navigation
  101.     Private dgvNavigator As New DataGridViewNavigator()
  102.     ' Allows the form to have access to the subroutines in the class
  103.     Private Sub btn_first_Click(sender As Object, e As EventArgs) Handles btn_first.Click
  104.         dgvNavigator.SelectFirst(dgv_appointment)
  105.         fillText(dgvNavigator.CurrentIndex)     ' Fills boxes with information from currently viewed record
  106.     End Sub
  107.  
  108.     Private Sub btn_previous_Click(sender As Object, e As EventArgs) Handles btn_previous.Click
  109.         dgvNavigator.SelectPrevious(dgv_appointment)
  110.         fillText(dgvNavigator.CurrentIndex)     ' Fills boxes with information from currently viewed record
  111.     End Sub
  112.  
  113.     Private Sub btn_next_Click(sender As Object, e As EventArgs) Handles btn_next.Click
  114.         dgvNavigator.SelectNext(dgv_appointment)
  115.         fillText(dgvNavigator.CurrentIndex)     ' Fills boxes with information from currently viewed record
  116.     End Sub
  117.  
  118.     Private Sub btn_last_Click(sender As Object, e As EventArgs) Handles btn_last.Click
  119.         dgvNavigator.SelectLast(dgv_appointment)
  120.         fillText(dgvNavigator.CurrentIndex)     ' Fills boxes with information from currently viewed record
  121.     End Sub
  122.     '----------------------------------------------------------------------------------------------'
  123.     Private Sub btn_add_Click(sender As Object, e As EventArgs) Handles btn_add.Click
  124.         clearText()
  125.         Dim newID As Integer = AddRecord(fileLoc_Appointment)
  126.         txt_appID.Text = newID
  127.         txt_staffID.Text = userID
  128.     End Sub
  129.  
  130.     Private Sub btn_save_Click(sender As Object, e As EventArgs) Handles btn_save.Click
  131.         ' Compiles the data to create a string that is passed onto the SaveRecord subroutine in the module
  132.  
  133.         If Check() = False Then
  134.             ' Runs check
  135.             Return
  136.         End If
  137.  
  138.  
  139.         Dim appointmentID As String = txt_appID.Text
  140.  
  141.         ' Services are optional additions to appointments, below creates the ServiceUse which is the way the program keeps referential integrity
  142.         Dim service1ID As String = txt_service1.Text
  143.         Dim service2ID As String = txt_service2.Text
  144.         Dim service3ID As String = txt_service3.Text
  145.  
  146.         Dim serviceUserID As Integer = ServiceUseCreate(appointmentID, service1ID, service2ID, service3ID)
  147.  
  148.  
  149.  
  150.         If UniqueCheck(appointmentID, fileLoc_Appointment) Then
  151.             ' If the appointmentID is unique to the file, it will go ahead with adding the new appointment
  152.  
  153.             Dim newAppointment As String = txt_appID.Text & "," & txt_staffID.Text & "," & txt_cusID.Text & "," & txt_staffIDApp.Text & "," & DTP_booking.Value.Date & "," & DTP_Appointment.Value.Date & "," & txt_tOA.Text & "," & txt_treatmentID.Text & "," & serviceUserID
  154.             ' Compiles the data into a String
  155.             MsgBox(newAppointment)
  156.             ' Displays the new record to the user in a MsgBox
  157.             SaveRecord(fileLoc_Appointment, newAppointment)
  158.             ' Passes on new Record to SaveRecord subroutine in the module
  159.             fillGrid(dgv_appointment, fileLoc_Appointment)
  160.             ' Refreshes dataGrid to show new record
  161.         Else
  162.             MsgBox("ID is not unique.")
  163.         End If
  164.  
  165.     End Sub
  166.  
  167.     Private Function ServiceUseCreate(ByVal AppointmentID As String, Optional Service1 As String = "-1", Optional Service2 As String = "-1", Optional Service3 As String = "-1")
  168.         Dim newID As String = AddRecord(FileLoc_ServiceUse)
  169.         '-1 representing a null answer.
  170.  
  171.         Dim serviceValid As Boolean = True
  172.  
  173.         serviceValid = ServiceCheck(serviceValid, Service1, Service2, Service3)
  174.         If serviceValid = True Then
  175.             ' Service valid checks to see if a non null input was made into a service ID. if an attempt of adding a service was made, and it doesn't exist, it wont create the ServiceUse
  176.             Dim newServiceUse As String = newID & "," & AppointmentID & "," & Service1 & "," & Service2 & "," & Service3
  177.             SaveRecord(FileLoc_ServiceUse, newServiceUse)
  178.             Return newID
  179.         End If
  180.         Return True
  181.     End Function
  182.  
  183.     Private Function ServiceCheck(ByRef ServiceValid As Boolean, Optional Service1 As String = "-1", Optional Service2 As String = "-1", Optional Service3 As String = "-1")
  184.  
  185.         ' Checks the validity of any Services
  186.  
  187.         If Not (Service1 = "-1" Or Service1 = "") Then
  188.             If BinSearch(Service1, FileLoc_Service, 0) = False Then
  189.                 serviceValid = False
  190.  
  191.             End If
  192.         End If
  193.  
  194.  
  195.         If Not (Service2 = "-1" Or Service2 = "") Then
  196.             If BinSearch(Service2, FileLoc_Service, 0) = False Then
  197.                 serviceValid = False
  198.             End If
  199.         End If
  200.  
  201.         If Not (Service3 = "-1" Or Service3 = "") Then
  202.             If BinSearch(Service3, FileLoc_Service, 0) = False Then
  203.                 serviceValid = False
  204.             End If
  205.         End If
  206.  
  207.         Return ServiceValid
  208.  
  209.     End Function
  210.  
  211.     Private Function Check()
  212.  
  213.         ' Check is a function that changes on the form and checks each field in the forms given record
  214.         ' If it can make it to the end of the function without returning a false, it is treated as valid data
  215.         If txt_appID.Text = "" Then
  216.             ' Runs a presence check on the Appointment ID
  217.             MsgBox("please enter an appointment ID")
  218.             Return False
  219.         End If
  220.  
  221.         If Not IntCheck(txt_appID.Text) Then
  222.             ' Int checks the appointment ID
  223.             Return False
  224.         End If
  225.  
  226.         Dim staffId As Integer = txt_staffID.Text
  227.         If BinSearch(staffId, fileLoc_Staff, 0) = False Then
  228.             ' Checks that the staff ID exists in the text file
  229.             MsgBox("invalid Staff ID")
  230.             Return False
  231.         End If
  232.  
  233.         Dim staffIdApp As Integer = txt_staffIDApp.Text
  234.         If BinSearch(staffIdApp, fileLoc_Staff, 0) = False Then
  235.             ' Validates the existence of the staff ID appointed
  236.             MsgBox("invalid Appointed Staff ID")
  237.             Return False
  238.         End If
  239.  
  240.         ' Below looks to see if there exists a timetable on the date that the appointment is scheduled to be on
  241.  
  242.         Dim index As Integer = 0
  243.         ' An integer that will be incremented to go through the timetable ID's
  244.  
  245.         Dim timetableTrue As Boolean = False
  246.         ' Initially set as false, iterative algorithm below will have to prove that there does exist a Timetable to flip this
  247.  
  248.  
  249.         For Each line As String In fileLoc_timetable
  250.  
  251.  
  252.  
  253.  
  254.  
  255.             Dim indString As String = CStr(index)
  256.             Dim timetableDate As Date = FindFieldButDate(fileLoc_timetable, indString, 1)
  257.             ' Uses the FindFieldButDate function to return the date of the given timetable
  258.             If timetableDate = DTP_Appointment.Value.Date Then
  259.                 ' Compares the timetableDate to the date of the appointment, if they match, the boolean value is set to true
  260.                 timetableTrue = True
  261.                 Exit For
  262.             Else
  263.  
  264.                 index = index + 1
  265.                 ' Increments by 1
  266.             End If
  267.  
  268.  
  269.         Next
  270.  
  271.         If timetableTrue = False Then
  272.             Return False
  273.         End If
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.         Dim shift1 As Integer = FindField(fileLoc_timetable, index, 2)
  281.         Dim shift2 As Integer = FindField(fileLoc_timetable, index, 3)
  282.         Dim shift3 As Integer = FindField(fileLoc_timetable, index, 4)
  283.         Dim shift4 As Integer = FindField(fileLoc_timetable, index, 5)
  284.         Dim shift5 As Integer = FindField(fileLoc_timetable, index, 6)
  285.  
  286.  
  287.         Dim StaffShift As Integer = 0
  288.  
  289.         ' When it is established that there is a timetable on the date, the code below checks each of 5 shifts on the timetable to see if the staff is assigned to one of them
  290.         ' If the staff member is, the integer staff shift will hold the shift ID that contains the start and finish time of the shift
  291.         If txt_staffIDApp.Text = FindField(fileLoc_Shift, shift1, 2) Then
  292.             StaffShift = shift1
  293.         End If
  294.  
  295.         If txt_staffIDApp.Text = FindField(fileLoc_Shift, shift2, 2) Then
  296.             StaffShift = shift2
  297.         End If
  298.  
  299.         If txt_staffIDApp.Text = FindField(fileLoc_Shift, shift3, 2) Then
  300.             StaffShift = shift3
  301.         End If
  302.  
  303.         If txt_staffIDApp.Text = FindField(fileLoc_Shift, shift4, 2) Then
  304.             StaffShift = shift4
  305.         End If
  306.  
  307.         If txt_staffIDApp.Text = FindField(fileLoc_Shift, shift5, 2) Then
  308.             StaffShift = shift5
  309.         End If
  310.  
  311.         If StaffShift = 0 Then
  312.             ' this will happen if the staff ID is not associated with any of the shifts
  313.             Return False
  314.         End If
  315.  
  316.         'if this point is reached, there is a timetable that is on the day of the appointment, and the staff id appointed is on a shift during that time,
  317.         'below is checking that the time of the appointment is within the bounds of the shift
  318.  
  319.         Dim part() As String = txt_tOA.Text.Split(":")
  320.         IntCheck(part(0))
  321.         IntCheck(part(1))
  322.         Dim hour As Integer = CInt(part(0))
  323.         Dim minute As Integer = CInt(part(1))
  324.         If hour < 0 Or hour > 24 Then
  325.             ' Format Checking of the time
  326.             MsgBox("invalid Hour")
  327.             Return False
  328.         End If
  329.  
  330.         If minute < 0 Or minute > 60 Then
  331.             ' Format Checking of the time
  332.             MsgBox("invalid minute")
  333.             Return False
  334.         End If
  335.  
  336.  
  337.         Dim shiftStart As String = FindField(fileLoc_Shift, StaffShift, 3)
  338.         Dim shiftEnd As String = FindField(fileLoc_Shift, StaffShift, 4)
  339.  
  340.  
  341.         Dim partStart() As String = shiftStart.Split(":")
  342.         ' Splits the time into two spots in an array, 0 being the hour and 1 being the minutes
  343.         Dim partEnd() As String = shiftEnd.Split(":")
  344.  
  345.  
  346.         If Not (part(0) > partStart(0) AndAlso part(0) < partEnd(0)) Then
  347.             ' Not logic applied on top of a check if the time is within the bounds of the shift
  348.             MsgBox("Time of appointment is outside the shift bounds")
  349.             Return False
  350.         End If
  351.  
  352.         If part(0) < partStart(0) OrElse (part(0) = partStart(0) AndAlso part(1) < partStart(1)) Then
  353.             ' Checks to see if the appointment hour is before the start of the shift, or if it the same hour, but the minute is before the shift
  354.             Return False
  355.         End If
  356.  
  357.  
  358.         Dim CusId As Integer = txt_cusID.Text
  359.         If BinSearch(CusId, fileLoc_Customer, 0) = False Then
  360.             ' Validates the existence of the customer id
  361.             MsgBox("invalid Customer ID")
  362.             Return False
  363.         End If
  364.  
  365.         Dim treatmentID As Integer = txt_treatmentID.Text
  366.         If BinSearch(treatmentID, fileLoc_treatment, 0) = False Then
  367.             MsgBox("invalid Treatment ID")
  368.             Return False
  369.         End If
  370.  
  371.         Dim booking As String = DTP_booking.Value.Date
  372.         Dim Appointment As String = DTP_Appointment.Value.Date
  373.  
  374.         Dim BookingParts As String() = booking.Split("/")
  375.         Dim AppointmentParts As String() = Appointment.Split("/")
  376.         'part 0 is day, 1 is month, 2 is year
  377.  
  378.         If CInt(BookingParts(2)) > CInt(AppointmentParts(2)) Then
  379.             MsgBox("Year of booking is later than year of appointment")
  380.             Return False
  381.         End If
  382.  
  383.         If CInt(BookingParts(2)) < CInt(AppointmentParts(2)) Then
  384.             ' If the year of the appointment is after the year of the booking, the month and day are irrelevant, hence making checking them unnecessary
  385.             GoTo postdate
  386.         End If
  387.  
  388.         If CInt(BookingParts(1)) > CInt(AppointmentParts(1)) Then
  389.             MsgBox("Month of booking is later than month of appointment")
  390.             Return False
  391.         End If
  392.  
  393.         If CInt(BookingParts(1)) < CInt(AppointmentParts(1)) Then
  394.             ' If the month of the appointment is after the month of booking, then checking the day is irrelevant
  395.             GoTo postdate
  396.         End If
  397.  
  398.         If CInt(BookingParts(0)) > CInt(AppointmentParts(0)) Then
  399.             MsgBox("Day of booking is later than day of appointment")
  400.             Return False
  401.         End If
  402.  
  403.         If txt_tOA.Text.Length > 5 Then
  404.             MsgBox("Invalid time of appointment")
  405.             Return False
  406.         End If
  407. postdate:   ' Is reached if the year is greater or the month is greater
  408.         ' The Idea is that if the year or month is greater, the date is irrelevent.
  409.  
  410.  
  411.  
  412.         Return True
  413.  
  414.  
  415.  
  416.  
  417.     End Function
  418.  
  419.  
  420.  
  421.  
  422.     Private Sub btn_edit_Click(sender As Object, e As EventArgs) Handles btn_edit.Click
  423.  
  424.         If Check() = False Then
  425.             ' Checks the new information
  426.             Return
  427.         End If
  428.  
  429.  
  430.  
  431.         Dim ID As Integer = txt_appID.Text
  432.         Dim ServiceUse As Integer = FindField(fileLoc_Appointment, txt_appID.Text, 8)
  433.         Dim newValues As String = txt_appID.Text & "," & txt_staffID.Text & "," & txt_cusID.Text & "," & txt_staffIDApp.Text & "," & DTP_booking.Value.Date & "," & DTP_Appointment.Value.Date & "," & txt_tOA.Text & "," & txt_treatmentID.Text & "," & ServiceUse
  434.         ' Compiles the TextBox inputs as a string called newValues, that is passed onto the EditRecord along with the primary key ID that is used to find the record that is being edited
  435.         EditRecord(ID, newValues, fileLoc_Appointment)
  436.         fillGrid(dgv_appointment, fileLoc_Appointment)
  437.         ' Grid is refreshed to show new changed
  438.  
  439.  
  440.         Dim service1 As String = txt_service1.Text
  441.         Dim service2 As String = txt_service2.Text
  442.         Dim service3 As String = txt_service3.Text
  443.  
  444.         Dim IDString As String = CStr(ID)
  445.         ' Converts the ID of the appoint to a string to be treated as a string in the editing of a record
  446.         Dim serviceValid As Boolean = True
  447.         serviceValid = ServiceCheck(serviceValid, service1, service2, service3)
  448.         ' Checks the validity of any services added to the appointment
  449.  
  450.         If serviceValid = True Then
  451.             ' Edits the ServiceUse to reflect and additions and removals of services to the file
  452.             Dim newServiceUse As String = ServiceUse & "," & IDString & "," & service1 & "," & service2 & "," & service3
  453.             EditRecord(ServiceUse, newServiceUse, FileLoc_ServiceUse)
  454.         End If
  455.  
  456.     End Sub
  457.     Private Sub btn_delete_Click(sender As Object, e As EventArgs) Handles btn_delete.Click
  458.         If txt_appID.Text = "" Then
  459.             ' Avoids a crash if a blank ID is input
  460.             Return
  461.         End If
  462.         Dim appID As Integer = txt_appID.Text
  463.         ' Gives an integer value for the record that the user is trying to delete
  464.  
  465.         DeleteRecord(dgv_appointment, fileLoc_Appointment, appID)
  466.  
  467.         fillGrid(dgv_appointment, fileLoc_Appointment)
  468.         ' Refreshes grid
  469.     End Sub
  470.  
  471.     Private Sub btn_menu_Click(sender As Object, e As EventArgs) Handles btn_menu.Click
  472.         ' Takes user back to main menu
  473.         Me.Visible = False
  474.         myMenu.Visible = True
  475.     End Sub
  476.  
  477.     '' Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  478.  
  479.     ''  Dim Customername As String = InputBox("please enter the customer name to search for appointments under that name")
  480.     'gets the name that is being searched
  481.  
  482.     ''  Dim customerIDs As List(Of String) = LikeSearch(Customername, fileLoc_Customer, 1)
  483.     'Searches for the name, if it matches (LIKE Logic) then it will store it in the string
  484.  
  485.     ''Dim AppointmentIDs As List(Of String) = LikeSearch2(customerIDs, fileLoc_Appointment, 2)
  486.     ''   Console.WriteLine(AppointmentIDs)
  487.     ''   Console.WriteLine(customerIDs)
  488.     ''  ShowOnGrid(AppointmentIDs, dgv_appointment)
  489.  
  490.  
  491.     '' End Sub
  492.  
  493.  
  494.     ''Public Function LikeSearch(Field As Object, fileloc As String, part As Int16)
  495.  
  496.  
  497.     ''   Dim sr As New StreamReader(fileloc)
  498.     'sets up a variable to read the wanted file
  499.     '' Dim lines As String() = File.ReadAllLines(fileloc)
  500.     'stores all the lines in the file
  501.     '' Dim searchedIDs As New List(Of String)
  502.     'creates a new list the stores all the IDs
  503.  
  504.     ''For Each line As String In lines
  505.     '' Dim parts As String() = line.Split(","c)
  506.     'splits each record by the commas
  507.     ''If Field Like parts(part) Then
  508.     ''          searchedIDs.Add(parts(0))
  509.     'adds the ID to the list
  510.     ' '      End If
  511.  
  512.  
  513.     '  '   Next
  514.  
  515.     ''    sr.Close()
  516.  
  517.     ''    Return searchedIDs
  518.  
  519.     '' End Function
  520.  
  521.  
  522.     '
  523.     '' Public Sub ShowOnGrid(Ids As Object, dgv As DataGridView)
  524.  
  525.     ' ' For Each row As DataGridViewRow In dgv.Rows
  526.     ''If Not row.IsNewRow Then
  527.  
  528.     ''Dim ID As String = row.Cells(0).Value.ToString()
  529.     'splits each record by the commas
  530.     ''If Ids.contains(ID) Then
  531.     ''            row.Visible = True
  532.     'adds the ID to the list
  533.     ''Else
  534.     ' '               row.Visible = False
  535.  
  536.     ' 'End If
  537.  
  538.     ''End If
  539.     ' 'Next
  540.  
  541.     ''End Sub
  542.  
  543.  
  544.  
  545.     Private Sub Button6_Click(sender As Object, e As EventArgs)
  546.         'Brings up the help tab
  547.         myHelp.Visible = True
  548.     End Sub
  549.  
  550.     Private Sub txt_cusID_TextChanged(sender As Object, e As EventArgs) Handles txt_cusID.TextChanged
  551.         ' When an ID is put in the appointed customer, the name is automatically placed
  552.         txt_cusName.Text = Decryption(FindField(fileLoc_Customer, txt_cusID.Text, 1)) + " " + Decryption(FindField(fileLoc_Customer, txt_cusID.Text, 2))
  553.     End Sub
  554.  
  555.     Private Sub txt_staffIDApp_TextChanged(sender As Object, e As EventArgs) Handles txt_staffIDApp.TextChanged
  556.         ' When an ID is put in the appointed staff, the name is automatically placed
  557.         txt_staffNameApp.Text = Decryption(FindField(fileLoc_Staff, txt_staffIDApp.Text, 1)) + " " + Decryption(FindField(fileLoc_Staff, txt_staffIDApp.Text, 2))
  558.     End Sub
  559.  
  560.     Private Sub Button2_Click(sender As Object, e As EventArgs) Handles btn_AppIDAsc.Click
  561.         ' Sorts appointments by ID ascending
  562.         AscSort(fileLoc_Appointment, 0)
  563.         fillGrid(dgv_appointment, fileLoc_Appointment)
  564.     End Sub
  565.  
  566.     Private Sub btn_appIDDesc_Click(sender As Object, e As EventArgs) Handles btn_appIDDesc.Click
  567.         ' Sorts appointments by ID Descending
  568.         DescSort(fileLoc_Appointment, 0)
  569.         fillGrid(dgv_appointment, fileLoc_Appointment)
  570.     End Sub
  571. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement