Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.IO
- Public Class frmFormBooking
- Dim strCustomers() As String = {"John Doe", "Jane Doe"}
- Dim strEvents() As String = {"Hydro pool", "Multi-sensory room", "Art room", "Music Room", "Sensory Garden", "Soft Play Area"}
- Dim strTime() As String = {"8:00", "8:15", "8:30", "8:45", "9:00", "9:15", "9:30", "9:45", "10:15", "10:30", "10:45", "11:00", "11:15", "11:30", "11:45", "12:00", "12:15", "12:30", "12:45", "13:00", "13:15", "13:30", "13:45", "14:00", "14:15", "14:30", "14:45", "15:00", "15:15", "15:30", "15:45", "16:00", "16:15", "16:30", "16:45", "17:00", "17:15", "17:30", "17:45", "18:00"}
- Dim Index As Integer = 1
- Dim Index2 As Integer = 5
- Dim Index3 As Integer = 39
- Dim check As Boolean = False
- Dim strEvent As String
- Dim AdultPrice As Decimal
- Dim ChildPrice As Decimal
- Dim GroupPrice As Decimal
- Dim AdultNo As Integer = 1
- Dim ChildNo As Integer = 1
- Dim TotalNo As Integer = 1
- Const Filename As String = "Customers.txt"
- Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
- drpFormCustomer.Items.Clear()
- For i As Integer = 0 To Index
- drpFormCustomer.Items.Add(strCustomers(i))
- Next
- drpFormEvent.Items.Clear()
- For i As Integer = 0 To Index2
- drpFormEvent.Items.Add(strEvents(i))
- Next
- drpFormStartTime.Items.Clear()
- For i As Integer = 0 To Index3
- drpFormStartTime.Items.Add(strTime(i))
- Next
- 'Adult & Children Ticket Selection:
- nudAdult.Value = AdultNo
- nudChildren.Value = ChildNo
- End Sub
- Private Sub btnLoad_Click(sender As Object, e As EventArgs) Handles btnCustomerLoad.Click
- Read_All()
- End Sub
- Private Sub Read_All()
- Dim intFile As Integer = FreeFile()
- FileOpen(intFile, Filename, OpenMode.Input)
- Do While Not EOF(intFile)
- Dim line As String = LineInput(intFile)
- drpFormCustomer.Items.Add(line)
- Loop
- FileClose(intFile)
- End Sub
- Private Sub btnAddCountry_Click(sender As Object, e As EventArgs) Handles btnAddCustomer.Click
- If txtCustomerName.Text = "" Or txtCustomerSurname.Text = "" Then
- MsgBox("Please enter a name and surname.")
- Else
- Index += 1
- ReDim Preserve strCustomers(Index)
- strCustomers(Index) = txtCustomerName.Text + " " + txtCustomerSurname.Text
- Dim intFile As Integer = FreeFile()
- FileOpen(intFile, Filename, OpenMode.Output)
- PrintLine(intFile, txtCustomerName.Text + " " + txtCustomerSurname.Text)
- FileClose(intFile)
- End If
- End Sub
- Private Sub chkGroup_CheckedChanged(sender As Object, e As EventArgs) Handles chkGroup.CheckedChanged
- If check = False Then
- nudAdult.Visible = False
- nudChildren.Visible = False
- lblBookAdultCost.Visible = False
- lblBookChildCost.Visible = False
- lblBookTotalPriceDesc.Visible = False
- lblBookTotalCost.Visible = False
- check = True
- Else
- nudAdult.Visible = True
- nudChildren.Visible = True
- lblBookAdultCost.Visible = True
- lblBookChildCost.Visible = True
- lblBookTotalPriceDesc.Visible = True
- lblBookTotalCost.Visible = True
- check = False
- End If
- End Sub
- Sub booking_cost()
- strEvent = drpFormEvent.Text
- If strEvent = strEvents(0) Then 'Hydro Pool
- AdultPrice = 20.0
- ChildPrice = 15.0
- GroupPrice = 70.0
- ElseIf strEvent = strEvents(1) Then 'Multi-sensory room
- AdultPrice = 15.0
- ChildPrice = 10.0
- GroupPrice = 50.0
- ElseIf strEvent = strEvents(2) Then 'Art room
- AdultPrice = 10.0
- ChildPrice = 5.0
- GroupPrice = 30.0
- ElseIf strEvent = strEvents(3) Then 'Music Room
- AdultPrice = 10.0
- ChildPrice = 5.0
- GroupPrice = 30.0
- ElseIf strEvent = strEvents(4) Then 'Sensory Garden
- AdultPrice = 15.0
- ChildPrice = 10.0
- GroupPrice = 50.0
- ElseIf strEvent = strEvents(5) Then 'Soft Play Area
- AdultPrice = 20.0
- ChildPrice = 15.0
- GroupPrice = 70.0
- End If
- total_booking_cost()
- End Sub
- Sub total_booking_cost()
- lblBookAdultCost.Text = "£" + (AdultPrice * AdultNo).ToString
- lblBookChildCost.Text = "£" + (ChildPrice * ChildNo).ToString
- lblBookGroupCost.Text = "£" + GroupPrice.ToString
- TotalNo = (AdultPrice * AdultNo) + (ChildPrice * ChildNo)
- lblBookTotalCost.Text = "£" + TotalNo.ToString
- End Sub
- Private Sub drpFormEvent_SelectedIndexChanged(sender As Object, e As EventArgs) Handles drpFormEvent.SelectedIndexChanged
- booking_cost()
- End Sub
- Private Sub nudAdult_ValueChanged(sender As Object, e As EventArgs) Handles nudAdult.ValueChanged
- AdultNo = nudAdult.Value
- total_booking_cost()
- End Sub
- Private Sub nudChildren_ValueChanged(sender As Object, e As EventArgs) Handles nudChildren.ValueChanged
- ChildNo = nudChildren.Value
- total_booking_cost()
- End Sub
- Private Sub btnBookingConfirm_Click(sender As Object, e As EventArgs) Handles btnBookingConfirm.Click
- If drpFormCustomer.Text = "" Or drpFormEvent.Text = "" Or drpFormStartTime.Text = "" Then
- lblMessage.ForeColor = Color.Red
- lblMessage.Text = "Please fill in all areas."
- Else
- lblMessage.ForeColor = Color.Green
- lblMessage.Text = "Booking Complete"
- lblInvoiceNo.Text = 4
- lblCustomerName.Text = drpFormCustomer.Text
- lblEvent.Text = drpFormEvent.Text
- lblDate.Text = dtpDateAndTime.Value.Date
- lblTime.Text = drpFormStartTime.Text
- If chkGroup.Checked = True Then
- lblAdultNo.Text = "2"
- lblChildNo.Text = "2"
- lblAdultCost.Text = "(Group Ticket)"
- lblChildCost.Text = "(Group Ticket)"
- lblOverallCost.Text = lblBookGroupCost.Text
- Else
- lblAdultNo.Text = (nudAdult.Value).ToString
- lblChildNo.Text = (nudChildren.Value).ToString
- lblAdultCost.Text = lblBookAdultCost.Text
- lblChildCost.Text = lblBookChildCost.Text
- vat.Text = "£" + (lblBookTotalCost.Text * 0.2).ToString
- lblOverallCost.Text = "£" + (lblBookTotalCost.Text * 1.2).ToString
- End If
- End If
- End Sub
- Private Sub HelpToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles HelpToolStripMenuItem.Click
- frmHelp.Show()
- frmHelp.WebBrowser1.Navigate("I:\Documents\Year 1\Assignments\Unit 14\Visual Studio\Snoezlen Booking Menu\Snoezlen Booking Menu\Snoezlen Booking Menu\bin\Debug\helpPage.html")
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement