-
Notifications
You must be signed in to change notification settings - Fork 1
/
resetpass.aspx.cs
54 lines (52 loc) · 1.71 KB
/
resetpass.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
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Diagnostics;
public partial class resetpass : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Interaction.redirIfNotLoggedIn();
if (!(Interaction.LoggedInUser is Admin)) Interaction.redirUnauthorize();
}
protected void resetBtn_Click(object sender, EventArgs e)
{
Interaction.redirIfNotLoggedIn();
if (!(Interaction.LoggedInUser is Admin)) Interaction.redirUnauthorize();
if (!Page.IsValid) return;
if (GridView1.SelectedIndex < 0)
{
Interaction.setFailureMessage(Literal1, "please select a user first");
return;
}
try
{
Admin u = (Admin)Interaction.LoggedInUser;
Debug.WriteLine(GridView1.SelectedRow.Cells[1].Text);
u.resetPass(Convert.ToInt32(GridView1.SelectedRow.Cells[1].Text), passTxt.Text);
Interaction.setSuccessMessage(Literal1,"password reset");
GridView1.DataBind();
}
catch (Exception ex)
{
Interaction.setFailureMessage(Literal1, ex.Message);
}
//u.resetPass(6, passTxt.Text);
}
protected void searchBtn_Click(object sender, EventArgs e)
{
GridView1.DataSourceID = "SqlDataSource1";
GridView1.DataBind();
if (GridView1.Rows.Count <= 0)
{
Interaction.setFailureMessage(Literal1, "no result found");
Panel1.Visible = false;
}
else
{
Panel1.Visible = true;
}
}
}