using CCWin; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using WCS_Client.UC; using System.Text.RegularExpressions; namespace WCS_Client.From { public partial class FormEditPwd : CCSkinMain { DataRow _dr; public FormEditPwd(DataRow dr) { InitializeComponent(); _dr = dr; } private void skinButton2_Click(object sender, EventArgs e) { this.Close(); } private void skinButton1_Click(object sender, EventArgs e) { string user_no = _dr["USER_NO"].ToString(); string user_pwd = txtUser_NewPwd.Text.Trim(); string user_newpwd = txtUser_TwoNewPwd.Text.Trim(); if (string.IsNullOrWhiteSpace(user_newpwd)) { MessageUtil.ShowError(string.Format("密码不能为空!")); return; } if (string.IsNullOrWhiteSpace(user_newpwd)) { MessageUtil.ShowError(string.Format("确认密码不能为空!")); return; } if (user_pwd.Trim().Length < 8) { MessageUtil.ShowError(string.Format("密码太短,不足8个字符!")); return; } if (user_pwd.Trim().Length > 16) { MessageUtil.ShowError(string.Format("密码过长,大于16个字符!")); return; } if (!Regex.IsMatch(user_pwd, "[A-Z]")) { MessageUtil.ShowError(string.Format("密码必须包含大写字母!")); return; } if(!Regex.IsMatch(user_pwd, "[a-z]")) { MessageUtil.ShowError(string.Format("密码必须包含小写字母!")); return; } if (!Regex.IsMatch(user_pwd, "[0-9]")) { MessageUtil.ShowError(string.Format("密码必须包含数字!")); return; } if (user_pwd != user_newpwd) { MessageUtil.ShowError("两次用户密码不一致。"); } else { string result = BaseWorkflow.AdminModifyPwd(user_no, user_pwd); if (string.IsNullOrWhiteSpace(result)) MessageUtil.ShowTips(string.Format("用户{0}修改密码成功。", user_no)); else MessageUtil.ShowError(result); this.Close(); } } } }