Repository navigation
Expand file tree
/
Copy pathCars.aspx.cs
More file actions
73 lines (60 loc) · 2.06 KB
/
Copy pathCars.aspx.cs
File metadata and controls
73 lines (60 loc) · 2.06 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class ViewCars : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Response.Redirect("leaders.html");
if (Session["ttid"] != null)
{
if (!Page.IsPostBack)
{
if (new Cars().GetCarsCountOwnedByUser(Convert.ToInt32(Session["ttid"])) == 0)
{
Response.Redirect("nocar.aspx");
}
else
{
var i = new Cars().GetCarsOwnedByUser(Convert.ToInt32(Session["ttid"]));
d.DataSource = i;
d.DataBind();
a.DataSource = i;
a.DataBind();
}
}
}
else
Response.Redirect("index.aspx");
}
protected bool GetCarStatus(int carid, int ttid)
{
bool value = new Cars().IsCarAvailableForParking(carid, ttid);
Session["value"] = value;
return value;
}
protected void btn_choose_Click(object sender, EventArgs e)
{
int id = Convert.ToInt32(((LinkButton)sender).CommandArgument);
Session["carid"] = id;
Response.Redirect("opponentsector.aspx");
}
protected void btn_sell_Click(object sender, EventArgs e)
{
int id = Convert.ToInt32(((LinkButton)sender).CommandArgument);
Session["caridforselling"] = id;
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "none", "<script>$('#sell_car').modal('show');</script>", false);
//
}
protected void Unnamed_Click(object sender, EventArgs e)
{
int id = Convert.ToInt32(Session["caridforselling"]);
new Cars().Sell(id, Convert.ToInt32(Session["ttid"]));
//var i = new Cars().GetCarsOwnedByUser(Convert.ToInt32(Session["ttid"]));
Session.Remove("caridforselling");
Response.Redirect("Cars.aspx");
}
}