You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Accounts/ChangePassWord.aspx.cs

62 lines
1.9 KiB
C#

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using DSWeb.Models;
using DSWeb.EntityDA;
namespace DSWeb.Accounts
{
public partial class ChangePassWord : System.Web.UI.Page
{
private string strUserID;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString();
}
if (h_post.Value.Trim().Equals("1"))
{
SavePasswordChange(strUserID);
}
}
private void SavePasswordChange(string tempUserID)
{
string strOrigPassWord = Request.Form["txt_origpwd"].ToString().Trim();
string strNewPassWord = Request.Form["txt_newpwd"].ToString().Trim();
string strConfirmPassWord = Request.Form["txt_comfirm"].ToString().Trim();
UserEntity userEntity = new UserEntity();
UserDA userDA = new UserDA();
userEntity = userDA.GetUserAllByID(strUserID);
if (userEntity != null)
{
if (userEntity.Gid != null)
{
int iResult = userDA.UpdateUserPassWord(tempUserID, strConfirmPassWord);
if (iResult == 1)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key1", "<script>alert('密码更改成功');</script>");
}
else
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "key2", "<script>alert('密码更改失败');</script>");
}
}
}
}
}
}