-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdminDashBoard.aspx.cs
177 lines (169 loc) · 5 KB
/
AdminDashBoard.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
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
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Drawing.Imaging;
using System.Drawing;
public partial class AdminDashBoard : System.Web.UI.Page
{
SqlCommand com;
string str;
SqlCommand cmd;
SqlConnection con;
String CS = ConfigurationManager.ConnectionStrings["MyDatabaseConnectionString"].ConnectionString;
SqlDataReader rdr;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Mail"] != null)
{
lblUserName.Text = Session["NAME"].ToString();
SocietyTotal();
HouseTotal();
UserTotal();
ComplainTotal();
FaclTotal();
MembTotal();
PayTotal();
VoteTotal();
}
else
{
Response.Redirect("LoginPage.aspx");
}
}
private void SocietyTotal()
{
con = new SqlConnection(CS);
con.Open();
cmd = con.CreateCommand();
cmd.CommandText = "Select Count(*) from SocietyTable";
rdr = cmd.ExecuteReader();
if (rdr.Read())
lblSociety.Text = rdr.GetValue(0).ToString();
else
lblSociety.Text = "0";
if ((rdr != null))
rdr.Close();
if (con.State == ConnectionState.Open)
con.Close();
}
private void HouseTotal()
{
con = new SqlConnection(CS);
con.Open();
cmd = con.CreateCommand();
cmd.CommandText = "Select Count(*) from HouseTable";
rdr = cmd.ExecuteReader();
if (rdr.Read())
lblHouse.Text = rdr.GetValue(0).ToString();
else
lblHouse.Text = "0";
if ((rdr != null))
rdr.Close();
if (con.State == ConnectionState.Open)
con.Close();
}
private void ComplainTotal()
{
con = new SqlConnection(CS);
con.Open();
cmd = con.CreateCommand();
cmd.CommandText = "Select Count(*) from ComplainTable";
rdr = cmd.ExecuteReader();
if (rdr.Read())
lblComplain.Text = rdr.GetValue(0).ToString();
else
lblComplain.Text = "0";
if ((rdr != null))
rdr.Close();
if (con.State == ConnectionState.Open)
con.Close();
}
private void UserTotal()
{
con = new SqlConnection(CS);
con.Open();
cmd = con.CreateCommand();
cmd.CommandText = "Select Count(*) from UserTable";
rdr = cmd.ExecuteReader();
if (rdr.Read())
lblUser.Text = rdr.GetValue(0).ToString();
else
lblUser.Text = "0";
if ((rdr != null))
rdr.Close();
if (con.State == ConnectionState.Open)
con.Close();
}
private void FaclTotal()
{
con = new SqlConnection(CS);
con.Open();
cmd = con.CreateCommand();
cmd.CommandText = "Select Count(*) from FacilityBookTable";
rdr = cmd.ExecuteReader();
if (rdr.Read())
lblfacl.Text = rdr.GetValue(0).ToString();
else
lblfacl.Text = "0";
if ((rdr != null))
rdr.Close();
if (con.State == ConnectionState.Open)
con.Close();
}
private void MembTotal()
{
con = new SqlConnection(CS);
con.Open();
cmd = con.CreateCommand();
cmd.CommandText = "Select Count(*) from MemberTable";
rdr = cmd.ExecuteReader();
if (rdr.Read())
lblmemb.Text = rdr.GetValue(0).ToString();
else
lblmemb.Text = "0";
if ((rdr != null))
rdr.Close();
if (con.State == ConnectionState.Open)
con.Close();
}
private void PayTotal()
{
con = new SqlConnection(CS);
con.Open();
cmd = con.CreateCommand();
cmd.CommandText = "Select Count(*) from SocietyPaymentTable";
rdr = cmd.ExecuteReader();
if (rdr.Read())
lblpay.Text = rdr.GetValue(0).ToString();
else
lblpay.Text = "0";
if ((rdr != null))
rdr.Close();
if (con.State == ConnectionState.Open)
con.Close();
}
private void VoteTotal()
{
con = new SqlConnection(CS);
con.Open();
cmd = con.CreateCommand();
cmd.CommandText = "Select Count(*) from VoteTable";
rdr = cmd.ExecuteReader();
if (rdr.Read())
lblpol.Text = rdr.GetValue(0).ToString();
else
lblpol.Text = "0";
if ((rdr != null))
rdr.Close();
if (con.State == ConnectionState.Open)
con.Close();
}
}