-
Notifications
You must be signed in to change notification settings - Fork 0
/
class.aspx.vb
123 lines (107 loc) · 4.5 KB
/
class.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
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
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.VisualBasic
Imports System.Windows
Imports System.Collections
Partial Class _class
Inherits System.Web.UI.Page
Public Shared avail As Integer = -1
Public Shared sprice As Decimal = 0
Public Shared totalprice As Decimal = 0
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
chose.Visible = False
available.Visible = False
seats.Visible = False
check.Visible = False
Number.Visible = False
price.Visible = False
proceed.Visible = False
Chk.Visible = False
End Sub
Protected Sub GridView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles GridView1.SelectedIndexChanged
Dim tname As String = TryCast(GridView1.SelectedRow.FindControl("Theatre"), Label).Text
Dim seatclass As String = TryCast(GridView1.SelectedRow.FindControl("seatsclass"), Label).Text
sprice = TryCast(GridView1.SelectedRow.FindControl("totalprice"), Label).Text
Session("class") = seatclass
Dim con As New SqlConnection
Dim cmd As New SqlCommand
Dim tcode, mcode, loccode As Integer
Dim time As String
Dim hallid As Integer
tcode = Session("tcode")
mcode = Session("mcode")
loccode = Session("loccode")
time = Session("time")
con.ConnectionString = "Data Source= HEWLETT-PACKARD\SQLEXPRESS;Initial Catalog=BookMyShow;Integrated Security=True"
con.Open()
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "hallsandcapacity"
cmd.Parameters.Add("@tcode", SqlDbType.Int).Value = tcode
cmd.Parameters.Add("@mcode", SqlDbType.Int).Value = mcode
cmd.Parameters.Add("@citycode", SqlDbType.Int).Value = loccode
cmd.Parameters.Add("@time", SqlDbType.VarChar, 20).Value = time
cmd.Parameters.Add("@class", SqlDbType.VarChar, 10).Value = seatclass
cmd.Parameters.Add("@hallid", SqlDbType.Int).Direction = ParameterDirection.Output
cmd.Parameters.Add("@avail", SqlDbType.Int).Direction = ParameterDirection.Output
cmd.ExecuteNonQuery()
hallid = cmd.Parameters("@hallid").Value
avail = cmd.Parameters("@avail").Value
Session("hallid") = hallid
con.Close()
If (tname.Length > 0) Then
chose.Visible = True
available.Visible = True
Chk.Visible = True
seats.Visible = True
available.Text = "Seats Available = " & avail
Number.Visible = True
chose.Text = "You chose : " & seatclass & " Class "
price.Visible = True
End If
End Sub
Protected Sub seats_TextChanged(sender As Object, e As EventArgs) Handles seats.TextChanged
If (seats.Text.Length > 0) Then
Chk.Visible = True
End If
End Sub
Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles proceed.Click
chose.Visible = True
available.Visible = True
seats.Visible = True
Number.Visible = True
price.Visible = True
proceed.Visible = True
Session("totalprice") = totalprice
Response.Redirect("FinalInfo.aspx")
End Sub
Protected Sub Chk_Click(sender As Object, e As EventArgs) Handles Chk.Click
If seats.Text.Length > 0 Then
Dim enter As Integer = CType(seats.Text, String)
If (avail = -1 Or enter > avail) Then
check.Visible = True
chose.Visible = True
seats.Visible = True
available.Visible = True
Chk.Visible = True
Number.Visible = True
check.Text = "Invalid Entry"
Else
chose.Visible = True
available.Visible = True
seats.Visible = True
Number.Visible = True
price.Visible = True
proceed.Visible = True
Dim s As Integer = enter
totalprice = s * sprice
Session("nseats") = s
price.Text = "Total price : " & totalprice
End If
End If
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Response.Redirect("loginpage.aspx")
End Sub
End Class