samuel_1991
Member
- Joined
- Jan 19, 2009
- Messages
- 13
- Programming Experience
- Beginner
Hi everyone, I need to do an assignment where it is about restaurant order taking. Now I have a problem that if I add a table number in new order (Taking Order.vb, known as Taking_Order as class) using its txttbNo (A textbox name), later if I do it again, the whole thing messed up.
For eg: Adding first customer of the day as 12 (Since assuming it seats on table 12)
Later, adding the second customer as 12 will give a prompt that the seat is occupied by another customer.
Now, by adding the second customer as anything other than 12 (Say 77 etc) , later, by adding third customer, the table 77 will not be blocked but still Table 12 will be blocked.
What it should be is both Table 12 and 77 be blocked. (And the 12 / 77 is something variable between 1 to 99 since my local area, at least has typically 99 tables per restaurant.) The prompt "Sorry, the table is currently occupied by the other customer." must be repeated until the respective table number's customer has paid for the meal fully in Payment.vb (Before that, it is also greeted by SelectTable.vb to select a valid Table Number (That follows by customer's order)
Here is my coding for the form
I do have other questions in other forms such as how to save each individual total price to be shown in Payment.vb etc.
You can access to my code though. (By PM, or I need many threads)
For eg: Adding first customer of the day as 12 (Since assuming it seats on table 12)
Later, adding the second customer as 12 will give a prompt that the seat is occupied by another customer.
Now, by adding the second customer as anything other than 12 (Say 77 etc) , later, by adding third customer, the table 77 will not be blocked but still Table 12 will be blocked.
What it should be is both Table 12 and 77 be blocked. (And the 12 / 77 is something variable between 1 to 99 since my local area, at least has typically 99 tables per restaurant.) The prompt "Sorry, the table is currently occupied by the other customer." must be repeated until the respective table number's customer has paid for the meal fully in Payment.vb (Before that, it is also greeted by SelectTable.vb to select a valid Table Number (That follows by customer's order)
Here is my coding for the form
VB.NET:
Public Class Taking_Order
Public Shared Table_Number As New List(Of Integer) 'Create List for Table ID
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim check = 0 'Check for occupied Table Number
Dim proceed = 1 'Check if no errors occured. 0 = Cannot proceed
Dim txttbNo = txttableNo.Text
Dim i As Integer
For Each txttbNo In Table_Number
'Check for occupied Table Number
If Table_Number.Item(i) = txttableNo.Text Then
check = 1
Else
check = 0
End If
Next txttbNo
If check = 1 Then
MessageBox.Show("Sorry, the table is currently occupied by the other customer.")
proceed = 0
End If
If txttableNo.Text = "" And check = 0 Then
MessageBox.Show("Please enter a valid table number before we can process the order.")
proceed = 0
ElseIf txttableNo.Text > 99 And check = 0 Then
MessageBox.Show("Sorry, the table was not found. Currently our restaurant has only 99 tables.")
proceed = 0
End If
If proceed = 1 Then
Table_Number.Add(txttableNo.Text)
Dim Order As New Order
Order.Show()
End If
End Sub
Private Sub txttableNo_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txttableNo.TextChanged
If txttableNo.Text.Length > 0 Then
Try
Integer.Parse(txttableNo.Text)
Catch ex As Exception
MessageBox.Show("Table Number can only be integer.")
End Try
End If
If txttableNo.Text = "0" Then
MessageBox.Show("Table Number can only be integer of more than 0.")
End If
txttableNo.Text = txttableNo.Text
End Sub
End Class
I do have other questions in other forms such as how to save each individual total price to be shown in Payment.vb etc.
You can access to my code though. (By PM, or I need many threads)
Last edited: