private void btnSure_Click(object sender, EventArgs e) { try { if (txtOriginalPassword.Text.Trim() == string.Empty) { MessageBoxs.Show(Trans.COM, this.ToString(), "原密码不可为空", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!LoginInfoDAX.UserPassword.Equals(CryptoHelp.EncodeToMD5(txtOriginalPassword.Text.Trim()))) { MessageBoxs.Show(Trans.COM, this.ToString(), "原密码错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txtNewPassword.Text.Trim() == string.Empty) { MessageBoxs.Show(Trans.COM, this.ToString(), "新密码不可为空", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txtNewPassword.Text.Trim() != txtSurePassword.Text.Trim()) { MessageBoxs.Show(Trans.COM, this.ToString(), "新密码和确认密码不一致", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DialogResult dr = MessageBoxs.Show(Trans.COM, this.ToString(), "您将要修改密码!\r\n单击【确定】继续,【取消】返回。", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr != DialogResult.OK) { return; } MDLSM_User userQuery = new MDLSM_User(); userQuery.WHERE_User_ID = LoginInfoDAX.UserID; MDLSM_User userResult = new MDLSM_User(); _bll.QueryForObject <MDLSM_User, MDLSM_User>(userQuery, userResult); userResult.WHERE_User_ID = LoginInfoDAX.UserID; userResult.WHERE_User_VersionNo = userResult.User_VersionNo; userResult.User_Password = CryptoHelp.EncodeToMD5(txtNewPassword.Text.Trim()); userResult.User_VersionNo += 1; bool boolTmp = _bll.Save <MDLSM_User>(userResult); if (!boolTmp) { MessageBoxs.Show(Trans.COM, this.ToString(), "保存失败!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { MessageBoxs.Show(Trans.COM, this.ToString(), "保存成功!", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); _supplierMain.DialogResult = DialogResult.Yes; _supplierMain.Close(); _flg.Show(); } } catch (Exception ex) { MessageBoxs.Show(Trans.COM, this.ToString(), ex.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error); LogHelper.WriteErrorLog(Trans.COM, System.Reflection.MethodBase.GetCurrentMethod().ToString() + SysConst.ENTER + ex.StackTrace, ex.Message, null, ex); } }
/// <summary> /// 判断员工工号是否存在 /// </summary> /// <param name="paramUserId"></param> /// <param name="paramEmpNo"></param> /// <returns></returns> public bool JudgeEmpNoIsExist(string paramUserId, string paramEmpNo) { MDLSM_User argsUser = new MDLSM_User(); if (!string.IsNullOrWhiteSpace(paramUserId)) { argsUser.WHERE_User_ID = paramUserId; } if (!string.IsNullOrEmpty(paramEmpNo)) { argsUser.WHERE_User_EMPNO = paramEmpNo; } int resultCount = QueryForObject <int>(SQLID.SM_UserManager_SQL01, argsUser); if (resultCount > 0) { return(true); } return(false); }
/// <summary> /// 生成选中项的值和描述 /// </summary> void GenerateSelectedValueAndText() { SelectedGridList = new List <MDLSM_User>(); foreach (var loopSourceItem in ListGridDS) { if (!loopSourceItem.IsChecked) { continue; } MDLSM_User argsUser = new MDLSM_User { User_ID = loopSourceItem.User_ID, User_Name = loopSourceItem.User_Name, User_EMPNO = loopSourceItem.User_EMPNO, User_PhoneNo = loopSourceItem.User_PhoneNo, User_Sex = loopSourceItem.User_Sex, User_Address = loopSourceItem.User_Address }; SelectedGridList.Add(argsUser); } }