-
Notifications
You must be signed in to change notification settings - Fork 0
/
Users.aspx.cs
76 lines (66 loc) · 3.27 KB
/
Users.aspx.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
namespace WebApplication1
{
public partial class Users : System.Web.UI.Page
{
public string st = "";
public string msg = "";
public string sqlSelect = "SELECT * FROM usersTbl";
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Admin"] == "False") Response.Redirect("CountriesMainPage.aspx");
string fileName = "DatabaseOfCountries2.mdf";
string tableName = "usersTbl";
DataTable table = Helper.ExecuteDataTable(fileName, sqlSelect);
int length = table.Rows.Count;
if (length == 0) msg = "no users";
else
{
st += "<tr class = Users>";
st += "<th class = Users>User Name</th>";
st += "<th class = Users>First Name</th>";
st += "<th class = Users>Last Name</th>";
st += "<th class = Users>Email</th>";
st += "<th class = Users>Year Born</th>";
st += "<th class = Users>Gender</th>";
st += "<th class = Users>Prefix</th>";
st += "<th class = Users>Phone</th>";
st += "<th class = Users>Country</th>";
st += "<th class = Users>City</th>";
st += "<th class = Users>Like Playing Video Games?</th>";
st += "<th class = Users>Like Traveling?</th>";
st += "<th class = Users>Like Study</th>";
st += "<th class = Users>Like To Sleep?</th>";
st += "<th class = Users>Like To Program?</th>";
st += "<th class = Users>Password</th>";
}
for (int i = 0; i < length; i++)
{
st += "<tr class = Users>";
st += "<td class = Users>" + table.Rows[i]["UserName"] + "</td>";
st += "<td class = Users>" + table.Rows[i]["FirstName"] + "</td>";
st += "<td class = Users>" + table.Rows[i]["LastName"] + "</td>";
st += "<td class = Users>" + table.Rows[i]["email"] + "</td>";
st += "<td class = Users>" + table.Rows[i]["YearBorn"] + "</td>";
st += "<td class = Users>" + table.Rows[i]["gender"] + "</td>";
st += "<td class = Users>" + table.Rows[i]["prefix"] + "</td>";
st += "<td class = Users>" + table.Rows[i]["phone"] + "</td>";
st += "<td class = Users>" + table.Rows[i]["country"] + "</td>";
st += "<td class = Users>" + table.Rows[i]["city"] + "</td>";
st += "<td class = Users>" + table.Rows[i]["LikePlayingVideoGames"] + "</td>";
st += "<td class = Users>" + table.Rows[i]["LikeTraveling"] + "</td>";
st += "<td class = Users>" + table.Rows[i]["LikeStudy"] + "</td>";
st += "<td class = Users>" + table.Rows[i]["LikeToSleep"] + "</td>";
st += "<td class = Users>" + table.Rows[i]["LikeToProgaram"] + "</td>";
st += "<td class = Users>" + table.Rows[i]["pw"] + "</td>";
}
msg = "there is: " + length + " people";
}
}
}