-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefault.aspx.cs
More file actions
55 lines (51 loc) · 1.5 KB
/
Default.aspx.cs
File metadata and controls
55 lines (51 loc) · 1.5 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
namespace hackathon_starter_asp_webforms
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["id"] == "1")
{
divLoginSuccess.Visible = true;
}
if (Request.QueryString["id"] == "2")
{
divDeleteSuccess.Visible = true;
}
if (Request.Cookies["login"] != null)
{
btnRegister.Visible = false;
}
else
{
btnRegister.Visible = true;
}
GetTotalNumberOfUsers();
}
private void GetTotalNumberOfUsers()
{
var cs = ConfigurationManager.ConnectionStrings[1].ConnectionString;
var Query = "select COUNT(*) FROM Users";
using (SqlConnection con = new SqlConnection(cs))
{
con.Open();
using (SqlCommand cmd = new SqlCommand(Query, con))
{
lblUsers.Text = cmd.ExecuteScalar().ToString();
}
}
}
protected void btnRegister_Click(object sender, EventArgs e)
{
Response.Redirect("register.aspx");
}
}
}