| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Data;
- namespace HySoft.BaseCallCenter.Web
- {
- public partial class firstlogin : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- if (Request.QueryString["ResetPass"] != null)
- {
- string userId = Request.QueryString["ResetPass"];
- initistration(userId);//初始化方法
- }
- }
- }
- /// <summary>
- /// 初始化重新设置密码的信息
- /// </summary>
- /// <param name="resetPassWord"></param>
- public void initistration(string userId)
- {
- string sql = "";
- if (!string.IsNullOrEmpty(userId))
- {
- sql = "select * from t_sys_userAccount where F_UserId ='" + userId + "'";
- }
- DataTable dt = DBUtility.DbHelperSQL.Query(sql).Tables[0];
- if (dt.Rows.Count > 0)
- {
- txtWorkingCode.Text = dt.Rows[0]["F_UserCode"].ToString();
- txtRealName.Text = dt.Rows[0]["F_UserName"].ToString();
- }
- }
- protected void btnSubmit_Click(object sender, EventArgs e)
- {
- string usercode = txtWorkingCode.Text.Trim();
- string username = txtRealName.Text.Trim();
- string password = txtone_password.Text.Trim();
- string password1 = txtone_password1.Text.Trim();
- string sql = string.Format("F_UserCode='{0}' and F_UserName='{1}'", usercode, username);
- List<Model.T_Sys_UserAccount> tsua = new BLL.T_Sys_UserAccount().GetModelList(sql);
- if (tsua.Count <= 0)
- {
- MessageBoxToWindow("重设密码失败:工号和姓名不匹配", "提示!", "error");
- }
- else if (tsua.Count == 1)
- {
- if (password == password1)
- {
- if (tsua[0].F_UserCode == password)
- {
- MessageBoxToWindow("重设密码失败:帐号和密码不允许相同", "提示!", "error");
- }
- else
- {
- tsua[0].F_Password = password;
- bool b = new BLL.T_Sys_UserAccount().Update(tsua[0]);
- if (b) MessageBoxToWindow("重设密码成功:请重新登录", "提示!", "success");
- }
- }
- else
- {
- MessageBoxToWindow("重设密码失败:新密码输入不一致", "提示!", "error");
- }
- }
- else
- {
- MessageBoxToWindow("数据异常:存在相同工号和姓名的人员", "提示!", "catch");
- }
- }
- #region 弹出对话框
- /// <summary>
- /// 弹出对话框
- /// </summary>
- /// <param name="title"></param>
- /// <param name="content"></param>
- /// <param name="type"></param>
- public void MessageBoxToWindow(string title, string content, string type)
- {
- string script = "";
- switch (type)
- {
- case "error"://失败
- type = "error";
- script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
- break;
- case "success"://成功
- type = "info";
- script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "',CloseThis);</script>";
- break;
- case "catch"://异常
- type = "warning";
- script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
- break;
- default:
- type = "question";
- break;
- }
- ClientScript.RegisterClientScriptBlock(this.GetType(), "", script);
- }
- #endregion
- }
- }
|