-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMasterPage3.master.vb
155 lines (119 loc) · 5.44 KB
/
MasterPage3.master.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
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 MasterPage3
Inherits System.Web.UI.MasterPage
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
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
MyCn()
If Request.QueryString("tablenum") = "" Then
Label1.Text = "No Table"
Else
Label1.Text = Request.QueryString("tablenum")
End If
End Sub
Public Sub MyCn()
If cn.State = Data.ConnectionState.Open Then cn.Close()
cn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("dbconn").ConnectionString
End Sub
Protected Sub hypLogout_Click(sender As Object, e As EventArgs) Handles hypLogout.Click
Session.Contents.Clear()
Session.Abandon()
Me.Response.Redirect("Default.aspx")
End Sub
Protected Sub accSetting_Click(sender As Object, e As EventArgs) Handles accSetting.Click
Me.Response.Redirect("AccountSetting.aspx")
End Sub
Protected Sub mymessage_Click(sender As Object, e As EventArgs) Handles mymessage.Click
Me.Response.Redirect("Home.aspx")
End Sub
Private Sub btnorderstatus_Click(sender As Object, e As ImageClickEventArgs) Handles btnorderstatus.Click
Response.Redirect("~/OrderStatusCustomer.aspx?tablenum=" + Session("tablenum").ToString() + "¤ttablestatus=OCCUPIED")
End Sub
Private Sub btnmakeorder_Click(sender As Object, e As ImageClickEventArgs) Handles btnmakeorder.Click
Response.Redirect("~/TakeOrderCustomer.aspx?tablenum=" + Session("tablenum").ToString())
End Sub
Private Sub btnorderbill_Click(sender As Object, e As ImageClickEventArgs) Handles btnorderbill.Click
Response.Redirect("~/OrderBill.aspx?tablenum=" + Session("tablenum").ToString() + "¤ttablestatus=OCCUPIED")
End Sub
Private Sub btnhome_Click(sender As Object, e As ImageClickEventArgs) Handles btnhome.Click
Response.Redirect("~/CustomerHome.aspx?tablenum=" + Session("tablenum").ToString())
End Sub
Private Sub DropDownList1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DropDownList1.SelectedIndexChanged
If DropDownList1.Text = "Administrator" Then
Session("ssUserLevel") = "Administrator"
Response.Redirect("Home.aspx")
ElseIf DropDownList1.Text = "Cashier" Then
Session("ssUserLevel") = "Cashier"
Response.Redirect("Home.aspx")
ElseIf DropDownList1.Text = "Waiter" Then
Session("ssUserLevel") = "Waiter"
Response.Redirect("Home.aspx")
ElseIf DropDownList1.Text = "Chef" Then
Session("ssUserLevel") = "Chef"
Response.Redirect("Home.aspx")
ElseIf DropDownList1.Text = "Manager" Then
Session("ssUserLevel") = "Manager"
Response.Redirect("Home.aspx")
ElseIf DropDownList1.Text = "General Manager" Then
Session("ssUserLevel") = "General Manager"
Response.Redirect("Home.aspx")
ElseIf DropDownList1.Text = "Customer" Then
Session("ssUserLevel") = "Customer"
Response.Redirect("TakeOrderTable.aspx")
End If
End Sub
Private Sub DropDownList1_PreRender(sender As Object, e As EventArgs) Handles DropDownList1.PreRender
DropDownList1.Items.FindByText(Session("ssUserLevel").ToString()).Selected = True
End Sub
Private Sub DropDownList2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DropDownList2.SelectedIndexChanged
Try
cmd.Parameters.Clear()
MyCn()
cn.Open()
cmd.Connection = cn
cmd.CommandText = "SELECT BRANCHNAME FROM SHOPLIFYBRANCH"
Dim lrd As SqlDataReader = cmd.ExecuteReader()
If lrd.HasRows = True Then
While lrd.Read()
If DropDownList2.Text = lrd.Item("BRANCHNAME") Then
Session("ssUserBranch") = lrd.Item("BRANCHNAME")
End If
End While
End If
cn.Close()
Catch ex As Exception
MyMsgBox("First Try" + ex.GetBaseException().ToString())
End Try
End Sub
'Private Sub DropDownList2_PreRender(sender As Object, e As EventArgs) Handles DropDownList2.PreRender
' DropDownList2.Items.FindByText(Session("ssUserBranch").ToString()).Selected = True
'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