-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModifiedPassword.aspx.cs
108 lines (99 loc) · 3.46 KB
/
ModifiedPassword.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
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class ModifiedPassword : System.Web.UI.Page
{
private string Query = string.Empty;
public string backgroundImage = Resources.Resource.ImgUrlBackground;
protected void Page_Init(object sender, EventArgs e)
{
if (Session.Count == 0 || Session["UserName"].ToString() == "" || Session["UserID"].ToString() == "" || Session["ClassCode"].ToString() == "")
Response.Redirect("../SessionOut.aspx");
}
protected void Page_Load(object sender, EventArgs e)
{
}
private void CheckPassword()
{
string QueryCheck = string.Empty;
ManageSQL ms = new ManageSQL();
StringBuilder sb = new StringBuilder();
StringBuilder sb1 = new StringBuilder();
Query = "select Password from Account where UserID= '" + Session["UserID"].ToString() + "'";
ms.GetOneData(Query, sb);
if (sb.ToString() == TbOriginCode.Text.Trim())
{
if (TbNewCode.Text.Trim() == TbCheckNewCode.Text.Trim())
{
QueryCheck = "update Account set Password='" + TbNewCode.Text + "'" +
"where UserID='" + Session["UserID"].ToString() + "'";
ms.WriteData(QueryCheck, sb1);
if (Session["ClassCode"].ToString().Equals("0"))
{
Response.Redirect("Index.aspx");
}
else if (Session["ClassCode"].ToString().Equals("1"))
{
if (Session["IsMingDer"].ToString().Equals("False"))
{
Response.Redirect("ProvinceIndex.aspx");
}
if (Session["IsMingDer"].ToString().Equals("True"))
{
Response.Redirect("MingdeIndex.aspx");
}
}
else
{
Response.Redirect("SystemManagerIndex.aspx");
}
}
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('新密码内容不同');", true);
TbOriginCode.Text = null;
TbNewCode.Text = null;
TbCheckNewCode.Text = null;
}
}
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('旧密码错误');", true);
TbOriginCode.Text = null;
TbNewCode.Text = null;
TbCheckNewCode.Text = null;
}
}
protected void BtnModify_Click(object sender, EventArgs e)
{
CheckPassword();
}
protected void BtnCancel_Click(object sender, EventArgs e)
{
if (Session["ClassCode"].ToString().Equals("0"))
{
Response.Redirect("Index.aspx");
}
else if (Session["ClassCode"].ToString().Equals("1"))
{
if (Session["IsMingDer"].ToString().Equals("False"))
{
Response.Redirect("ProvinceIndex.aspx");
}
if (Session["IsMingDer"].ToString().Equals("True"))
{
Response.Redirect("MingdeIndex.aspx");
}
}
else
{
Response.Redirect("SystemManagerIndex.aspx");
}
}
}