-
Notifications
You must be signed in to change notification settings - Fork 0
/
SessionHandlingPage.vb
116 lines (99 loc) · 4.34 KB
/
SessionHandlingPage.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
Public Class SessionHandlingPage
Dim sessionsList As List(Of Session)
Public selectedSession As Session
Public nextVisitPanelsList As New List(Of SessionNextVisitPanel)
Public nextVisitsList As New List(Of NextVisit)
Public Sub loadSessionHandlingPage()
loadListView()
lblPetOwner.Text = "N/A"
petsAndProceduresPanel.Controls.Clear()
nextVisitFlowParentPanel.Controls.Clear()
End Sub
Public Sub loadPets()
petsAndProceduresPanel.Controls.Clear()
lblPetOwner.Text = "N/A"
If lstViewSessions.SelectedIndices.Count > 0 Then
selectedSession = sessionsList.Item(lstViewSessions.SelectedIndices.Item(0))
lblPetOwner.Text = selectedSession.petOwner.strName
For Each aPetString In selectedSession.petWithProcedureList
Dim petPanel As New SessionPetPanel(aPetString)
petsAndProceduresPanel.Controls.Add(petPanel)
Next
End If
End Sub
Public Sub loadNextVisits()
nextVisitFlowParentPanel.Controls.Clear()
If lstViewSessions.SelectedIndices.Count > 0 Then
selectedSession = sessionsList.Item(lstViewSessions.SelectedIndices.Item(0))
Dim nVPanelsList As New List(Of SessionNextVisitPanel)
For Each aPetString In selectedSession.petWithProcedureList
Dim petPanel As New SessionNextVisitPanel(aPetString)
nVPanelsList.Add(petPanel)
nextVisitFlowParentPanel.Controls.Add(petPanel)
Next
nextVisitPanelsList = nVPanelsList
reloadAllDateTimePicker(nextVisitPanelsList)
End If
End Sub
Public Sub reloadAllDateTimePicker(nextVisitPanelsList As List(Of SessionNextVisitPanel))
For Each nvPanel In nextVisitPanelsList
SessionNextVisitPanel.checkIfDatePickedIsValid(nvPanel.dtpNextVisitDate, nvPanel.lblErrorMessage)
If nvPanel.rbYes.Checked Then
nvPanel.dtpNextVisitDate.Enabled = True
nvPanel.cbPetProcedure.Enabled = True
ElseIf nvPanel.rbNo.Checked Then
nvPanel.dtpNextVisitDate.Enabled = False
nvPanel.cbPetProcedure.Enabled = False
nvPanel.lblErrorMessage.Visible = False
End If
Next
End Sub
Private Sub loadListView()
With lstViewSessions
.Items.Clear()
.View = View.Details
.GridLines = True
.FullRowSelect = True
.Columns.Clear()
.Columns.Add("ID", 40)
.Columns.Add("Pet Owner", 80)
.Columns.Add("Date of Session", 120)
sessionsList = FileManipulator.ReadSessions()
counter = 0
For Each session In sessionsList
.Items.Add(session.sessionCodeId)
.Items(counter).SubItems.Add(session.petOwner.strName)
.Items(counter).SubItems.Add(session.dateMade.Date)
counter += 1
Next
End With
End Sub
Private Sub lstViewSessions_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstViewSessions.SelectedIndexChanged
loadPets()
loadNextVisits()
End Sub
Private Sub btnBookAndPay_Click(sender As Object, e As EventArgs) Handles btnBookAndPay.Click
Dim inputControls As List(Of Control) = GetAllInputControls(Me)
Dim fieldsAreEmpty As Boolean = ConflictChecker.checkIfControlsTextIsEmpty(inputControls)
If fieldsAreEmpty Then
MsgBox("Please fill in all fields.", vbOKOnly + vbExclamation, "Walk In Form")
Exit Sub
End If
Dim errorMessagesAreVisible As Boolean = ConflictChecker.checkIfErrorMessagesAreActive(nextVisitPanelsList)
If errorMessagesAreVisible Then
MsgBox("Please resolve all invalid inputs.", vbOKOnly + vbExclamation, "Walk In Form")
Exit Sub
End If
Rcd_Page.childForm(Payment_Page)
storeNextVisitsTemporarily()
Payment_Page.loadPaymentPage()
End Sub
Public Sub storeNextVisitsTemporarily()
If lstViewSessions.SelectedIndices.Count > 0 Then
nextVisitsList.Clear()
For Each nvPanel In nextVisitPanelsList
nextVisitsList.Add(nvPanel.getNextVistObject())
Next
End If
End Sub
End Class