-
Notifications
You must be signed in to change notification settings - Fork 1
/
edituser.aspx.cs
54 lines (52 loc) · 1.7 KB
/
edituser.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 edituser : System.Web.UI.Page
{
//User toEdit;
protected void Page_Load(object sender, EventArgs e)
{
Interaction.redirIfNotLoggedIn();
if (!(Interaction.LoggedInUser is Agent)) Interaction.redirUnauthorize();
Literal2.Text = "";
if (!Page.IsPostBack) Session["toEdit"] = null;
//if (Interaction.LoggedInUser is Admin) Response.Redirect("edituseradmin.aspx");
User toEdit = (User)Session["toEdit"];
//if (toEdit == null) Panel1.Visible = false;
}
protected void searchUserBtn_Click(object sender, EventArgs e)
{
if (!Page.IsValid) return;
if (!(Interaction.LoggedInUser is Agent))
{
Interaction.redirUnauthorize();
}
Agent a = (Agent)Interaction.LoggedInUser;
try
{
User toEdit = a.getUser(firstNameTxt.Text, lastNameTxt.Text, userNameTxt.Text);
if (toEdit == null)
{
Interaction.setFailureMessage(Literal2, "information mismatch:");
return;
}
else if (toEdit.UserNumber == a.UserNumber)
{
toEdit = a;
}
Session["toEdit"] = toEdit;
Response.Redirect("edituser2.aspx");
//Panel1.Visible = true;
}
catch (Exception ex)
{
Interaction.setFailureMessage(Literal2, ex.Message);
}
}
protected void updateBtn_Click(object sender, EventArgs e)
{
}
}