-
Notifications
You must be signed in to change notification settings - Fork 0
/
AdminUserManagement.aspx.cs
73 lines (67 loc) · 2.15 KB
/
AdminUserManagement.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class AdminUserManagement : System.Web.UI.Page
{
clsReg reg = new clsReg();
clsAdmin admin = new clsAdmin();
DataTable dt;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LoadUserData();
}
}
protected void LoadUserData()
{
lblUsrCount.Text = Convert.ToString(reg.getUsrCount());
dt = reg.displayUsers();
grdUsr.DataSource = dt;
grdUsr.DataBind();
}
protected void grdUsr_SelectedIndexChanged(object sender, EventArgs e)
{
txtId.Text = grdUsr.SelectedRow.Cells[1].Text;
}
protected void btnRemove_Click(object sender, EventArgs e)
{
if (txtId.Text.Trim() == "")
{
System.Web.UI.ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please select a user first!!');", true);
return;
}
lblRemove.Visible = true;
admin.Id = txtId.Text;
admin.Status = "Removed";
admin.removeUser();
string message = "User Removed.";
string script = "window.onload = function(){ alert('";
script += message;
script += "')};";
ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true);
LoadUserData();
}
protected void btnApprove_Click(object sender, EventArgs e)
{
if (txtId.Text.Trim() == "")
{
System.Web.UI.ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please select a user first!');", true);
return;
}
lblApprove.Visible = true;
admin.Id = txtId.Text;
admin.Status = "Active";
admin.approveUser();
string message = "User Reinstated.";
string script = "window.onload = function(){ alert('";
script += message;
script += "')};";
ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true);
LoadUserData();
}
}