dlmh_system/VRS/Management/AdminPassword.aspx.cs

73 lines
2.2 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
namespace VRS.Management
{
public partial class AdminPassword : BasePage
{
DataService.BLL.admin_user bll_user = new DataService.BLL.admin_user();
DataService.BLL.admin_log log = new DataService.BLL.admin_log();
protected override void Page_Load(object sender, EventArgs e)
{
base.Page_Load(sender, e);
if (!IsPostBack)
{
}
}
protected void btnSure_Click(object sender, EventArgs e)
{
var login = DataService.BLL.admin_user.load_login();
var user = bll_user.GetModel(login.user_id);
if (string.IsNullOrEmpty(old_password.Text.Trim()))
{
RadAjaxManager1.Alert("原密码不能为空!");
return;
}
var pass_word = BasePage.GetMD5(old_password.Text.Trim());
var list_exists = bll_user.GetModelList(string.Format(" user_id = '{0}' and password='{1}' ", user.user_id, pass_word));
if (list_exists.Count <= 0)
{
RadAjaxManager1.Alert("原密码错误!");
return;
}
var newpassword = new_password.Text.Trim();
var confirm = confirm_password.Text.Trim();
if (string.IsNullOrEmpty(new_password.Text.Trim()))
{
RadAjaxManager1.Alert("新密码不能为空!");
return;
}
if (newpassword != confirm)
{
RadAjaxManager1.Alert("新密码与确认密码不一致!");
return;
}
user.password = GetMD5(newpassword);
if (bll_user.Update(user))
{
log.write_log("修改密码成功。" + "账号:" + user.login_name + "ID" + user.user_id);
RadAjaxManager1.ResponseScripts.Add("alert('修改成功!');CloseAndRebind();");
}
else
RadAjaxManager1.Alert("修改失败!");
}
}
}