架构B/S四 WEB 表示层 EditPassword.aspx.cs 页
来源:互联网 发布:表白扣字软件 编辑:程序博客网 时间:2024/06/06 02:33
2008-04-10 10:55
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CoalTraffic.Common;
using CoalTraffic.DBUtility;
public partial class UserManage_EditPassword : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnAdd_Click(object sender, EventArgs e)
{
string strError = string.Empty;
//原始密码
if (txtYsPassword.Text == "")
{
strError += "原始密码不能为空!//n";
}
else
{
if ((PageValidate.IsLengther(txtPassword.Text, 16)) || (PageValidate.IsShorter(txtPassword.Text, 4)))
{
strError += "用户密码为4-16位的数字或英文字母!//n";
}
}
//新密码
if (txtPassword.Text == "")
{
strError += "用户密码不能为空!//n";
}
else
{
if ((PageValidate.IsLengther(txtPassword.Text, 16)) || (PageValidate.IsShorter(txtPassword.Text, 4)))
{
strError += "用户密码为4-16位的数字或英文字母!//n";
}
}
//确认密码
if (txtRePassword.Text == "")
{
strError += "确认密码不能为空!//n";
}
else
{
if (String.Compare(txtPassword.Text, txtRePassword.Text) != 0)
{
strError += "确认密码必须与密码完全一致!//n";
}
}
CoalTraffic.BLL.T_User userBLL = new CoalTraffic.BLL.T_User();
CoalTraffic.Model.T_User userModel = new CoalTraffic.Model.T_User();
userModel = userBLL.GetModel(System.Web.HttpUtility.UrlDecode(HttpContext.Current.Request.Cookies["UserCode"].Value));
hfUserCode.Value = System.Web.HttpUtility.UrlDecode(HttpContext.Current.Request.Cookies["UserCode"].Value);
hfPasswd.Value = userModel.Passwd;
if (userModel == null)
{
MessageBox.Show(this.Page, "该用户不存在!");
return;
}
else
{
if (strError == string.Empty)
{
if (userModel.Passwd != Crypt.MD5hash(txtYsPassword.Text).ToString())
{
MessageBox.Show(this.Page, "密码错误!");
return;
}
else
{
userModel.UserCode = System.Web.HttpUtility.UrlDecode(HttpContext.Current.Request.Cookies["UserCode"].Value);
userModel.Passwd = Crypt.MD5hash(txtPassword.Text).ToString();
if (userBLL.UpdatePW(userModel))
{
CoalTraffic.BLL.TDY_LogEditDate bllDate = new CoalTraffic.BLL.TDY_LogEditDate();
CoalTraffic.Model.TDY_LogEditDate modelDate = new CoalTraffic.Model.TDY_LogEditDate();
modelDate.EditType = "修改";
modelDate.DataCode = hfUserCode.Value;
modelDate.Operator = System.Web.HttpUtility.UrlDecode(HttpContext.Current.Request.Cookies["UserCode"].Value);
modelDate.WorkDataTable = "用户密码表";
modelDate.WorkTime = System.DateTime.Now;
int iResult = bllDate.Add(modelDate);
MessageBox.ShowAndRedirect(this.Page, "用户密码修改成功!", "ListUserEdit.aspx");
}
else
{
MessageBox.Show(this.Page, "用户密码修改失败!");
}
}
}
else
{
MessageBox.Show(this.Page, strError);
}
}
}
///
/// 清空TextBox
///
///
///
protected void btnCancel_Click(object sender, EventArgs e)
{
txtYsPassword.Text = "";
txtPassword.Text = "";
txtRePassword.Text = "";
}
}
- 架构B/S四 WEB 表示层 EditPassword.aspx 页
- 架构B/S四 WEB 表示层 EditPassword.aspx.cs 页
- 第三步:WEB层 /展示层 UserInfo.aspx.cs 页
- 架构B/S四 IDAL 接口层
- 架构B/S四 Web.Config
- 架构B/S四 DBUtility 数据层基类 放公共类(六) ControlBindHelper.cs MessageBox.cs 类
- 第四步 WEB 展示层(显示层) UserReg.aspx.cs 页 实例
- 架构B/S四 DBUtility 数据层基类 放公共类(四) ControlBindHelper.cs 类
- web四层架构
- 架构B/S四 DBUtility 数据层基类 放公共类(五) ControlBindHelper.cs 类
- 架构B/S四 DBUtility 数据层基类 放公共类(七) PageValidate.cs类
- web应用程序 两层c/s、三层c/s、b/s架构对比及Servlet由来
- 架构B/S四 SQLServerDAL 数据访问层(数据操作层)
- 架构B/S四 BLL 是业务逻辑层 Business Logic Layer
- 架构B/S四 DALFactory 数据访问层 Data Access Layer
- VS web编程中 .aspx .aspx.cs
- 架构B/S四 Model 实体类
- WEB技术之四层架构
- 架构B/S四 DBUtility 数据层基类 放公共类(七) PageValidate.cs类
- 架构B/S四 IDAL 接口层
- 架构B/S四 Model 实体类
- 架构B/S四 SQLServerDAL 数据访问层(数据操作层)
- 架构B/S四 WEB 表示层 EditPassword.aspx 页
- 架构B/S四 WEB 表示层 EditPassword.aspx.cs 页
- 架构B/S四 Web.Config
- C++函数调用原理理解
- 键盘的各个功能
- 第一步:BusinessEntity层 实例 BC_USER用户表
- 第二步:DataLayer层 DataBC_USER SQLHelper作为最底层操作
- 第三步:WEB层 /展示层 UserInfo.aspx 页 1
- the best toner cartridge
- 第三步:WEB层 /展示层 UserInfo.aspx 页(二)