-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTakeOrderQRTable.aspx.vb
79 lines (63 loc) · 2.66 KB
/
TakeOrderQRTable.aspx.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
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Data.SqlClient
Imports System.Web
Imports System.Web.UI
Imports System.Web.Security
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Drawing
Imports System.IO
Imports System.Text
Imports System.Security.Cryptography
Imports System.Net.Mail
Imports System.Net
Partial Class TakeOrderQRTable
Inherits System.Web.UI.Page
Public cn As New SqlConnection
Public cmd As New SqlCommand
Public da As SqlDataAdapter
Public dr As SqlDataReader
Public ds As DataSet = New DataSet
Public ConString As String = System.Configuration.ConfigurationManager.ConnectionStrings("dbconn").ConnectionString
Public Sub MyCn()
If cn.State = Data.ConnectionState.Open Then cn.Close()
cn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("dbconn").ConnectionString
End Sub
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Try
cmd.Parameters.Clear()
MyCn()
cn.Open()
cmd.Connection = cn
cmd.CommandText = "SELECT CURRENTTABLESTATUS FROM SHOPLIFYRESTAURANTTABLE WHERE TABLENUM = @TABLENUM"
cmd.Parameters.AddWithValue("@TABLENUM", Request.QueryString("tablenum"))
Dim lrd As SqlDataReader = cmd.ExecuteReader()
Dim currenttablestatus As String
If lrd.HasRows = True Then
While lrd.Read()
currenttablestatus = lrd.Item("CURRENTTABLESTATUS")
End While
Session("tablenum") = Request.QueryString("tablenum")
If currenttablestatus = "OCCUPIED" Then
Response.Redirect("~/OrderStatusCustomer.aspx?tablenum=" + Request.QueryString("tablenum") + "¤ttablestatus=OCCUPIED")
ElseIf currenttablestatus = "AVAILABLE" Then
Response.Redirect("~/TakeOrderCustomer.aspx?tablenum=" + Request.QueryString("tablenum"))
End If
End If
Catch ex As Exception
MyMsgBox("1st Try" + ex.GetBaseException().ToString())
End Try
End Sub
Protected Sub MyMsgBox(ByVal tcMessage As String)
Dim lcScript As String
tcMessage = Replace(tcMessage, vbCrLf, "\n")
tcMessage = Replace(tcMessage, """", "")
lcScript = "<script language=""javascript"">" &
"alert(""" & tcMessage & """);" & vbCrLf &
"</script>"
Page.ClientScript.RegisterStartupScript(GetType(String), "PopUp", lcScript)
End Sub
End Class