-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpark.aspx.cs
More file actions
178 lines (157 loc) · 5.41 KB
/
park.aspx.cs
File metadata and controls
178 lines (157 loc) · 5.41 KB
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class oponentsector : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Response.Redirect("leaders.html");
if (Session["ttid"] == null)
{
Response.Redirect("index.aspx");
}
else if (Session["ttid"] != null)
{
if (Session["oponent"] != null)
{
int ttid = Convert.ToInt32(Session["ttid"]);
int i = Convert.ToInt16(Session["oponent"]);
if (ValidateSectorId())
{
lbl_sector.InnerText = " " + i.ToString();
grid_private.DataSource = new Parking().GetPrivateParking(i, ttid);
grid_private.DataBind();
grid_public.DataSource = new Parking().GetPublicParking(i);
grid_public.DataBind();
}
}
else
{
Response.Redirect("garage.aspx");
}
}
new User().CheckUsers();
}
//protected void btn_public_Click(object sender, EventArgs e)
//{
// if (ValidateSectorId())
// {
// int i = Convert.ToInt16(Session["oponent"]);
// grid_public.DataSource = new Parking().GetPublicParking(i);
// grid_public.DataBind();
// }
//}
//protected void btn_private_Click(object sender, EventArgs e)
//{
// if (ValidateSectorId())
// {
// int i = Convert.ToInt16(Session["oponent"]);
// grid_private.DataSource = new Parking().GetPrivateParking(i, Convert.ToInt32(Session["ttid"]));
// grid_private.DataBind();
// }
//}
protected string IsVacant(bool isvacant)
{
if (isvacant)
{
return "Yes";
}
else
return "No";
}
protected string IsAllowed(bool isallowed)
{
if (isallowed)
{
return "Parking Zone";
}
else
return "Non-Parking Zone";
}
protected void btn_private_park(object sender, EventArgs e)
{
int id = Convert.ToInt32(((Button)sender).CommandArgument);
if (new Parking().IsAllowed(id, Convert.ToInt32(Session["ttid"])))
{
if (new Parking().IsParkingVacant(id))
{
if (new Cars().IsCarAvailableForParking(Convert.ToInt32(Session["carid"]), Convert.ToInt32(Session["ttid"])))
{
Session["logid"] = new Parking().ParkOnPrivateLane(Convert.ToInt32(Session["ttid"]), id, Convert.ToInt32(Session["carid"]));
grid_private.DataSource = new Parking().GetPrivateParking(Convert.ToInt16(Session["oponent"]), Convert.ToInt32(Session["ttid"]));
grid_private.DataBind();
parked_success.Visible = true;
//btn_earn_more.Visible = true;
}
else
{
parked_success.Visible = true;
parked_success.InnerText = "Your Car is already Parked";
}
}
else
{
Response.Write("<script>alert('Not allowed')</script>");
}
}
else
{
Response.Write("<script>alert('Not allowed')</script>");
}
}
protected void btn_public_park(object sender, EventArgs e)
{
int id = Convert.ToInt32(((Button)sender).CommandArgument);
if (new Parking().IsParkingVacant(id))
{
if (new Cars().IsCarAvailableForParking(Convert.ToInt32(Session["carid"]), Convert.ToInt32(Session["ttid"])))
{
//int id = Convert.ToInt32(((Button)sender).CommandArgument);
Session["logid"] = new Parking().ParkOnPublicLane(id, Convert.ToInt32(Session["ttid"]), Convert.ToInt32(Session["carid"]));
grid_public.DataSource = new Parking().GetPublicParking(Convert.ToInt16(Session["oponent"]));
grid_public.DataBind();
parked_success.Visible = true;
//btn_earn_more.Visible = true;
}
else
{
parked_success.Visible = true;
parked_success.InnerText = "Your Car is already Parked";
}
}
else
{
parked_success.Visible = true;
parked_success.InnerText = "OOps! This parking is already occupied.";
}
}
protected bool ValidateSectorId()
{
int i = Convert.ToInt16(Session["oponent"]);
if (i > 0 && i < 5)
{
return true;
}
else
return false;
}
protected void Unnamed_Click(object sender, EventArgs e)
{
int i = new User().GetRobozzleLevel(Convert.ToInt32(Session["logid"]), Convert.ToInt32(Session["ttid"]));
Session["level"] = i;
Response.Redirect("robozzle/unknown.aspx");
}
protected void Unnamed_Click1(object sender, EventArgs e)
{
Session.Remove("oponent");
Response.Redirect("opponentsector.aspx");
}
//protected void grid_private_PageIndexChanging(object sender, GridViewPageEventArgs e)
//{
// grid_private.PageIndex = e.NewPageIndex;
// grid_private.DataBind();
//}
}