protected override bool SaveAdd() { XEncodeAndDecodeBase encodeTool = XEncodeAndDecodeContext.GetEncodeAndDecodeTool(EncodeType.Md5); string password = encodeTool.Encode(this.txtPassword.Text); XUsersBusiness business = this.m_Business as XUsersBusiness; return(business.UpdatePassword(this.UserId, password)); }
private void btnLogin_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; XUsersBusiness usersBusiness = new XUsersBusiness(); //if (usersBusiness.GetServerTime() >= new DateTime(2014, 2, 28)) //{ // XMessageBox.ShowError("出现异常,无法登录!"); // return; //} if (this.ValidateLogin()) { this.m_UserInfo = this.GetLoginUsersInfo(); if (this.m_UserInfo == null) { XMessageBox.ShowError("用户名或者密码错误!"); return; } if (this.m_UserInfo.IsUsed == false) { XMessageBox.ShowError("该用户不可用!"); return; } XCommon.LoginUsersInfo = this.m_UserInfo.Clone() as XUsersInfo; if (this.m_UserInfo != null) { this.DialogResult = System.Windows.Forms.DialogResult.OK; try { this.LoginLog(); } catch (Exception ex) { XErrorLogTool.WriteLog(ex.ToString()); } } this.RememberLoginUser(); } } catch (Exception ex) { XMessageBox.ShowError(ex.Message); XErrorLogTool.WriteLog(ex.ToString()); } finally { this.Cursor = Cursors.Default; } }
/// <summary> /// 获取登录信息 /// </summary> /// <returns></returns> private XVUsersInfo GetLoginUsersInfo() { XVUsersInfo usersInfo = null; XUsersBusiness usersBusiness = new XUsersBusiness(); string where = " and UserName='******' and Password='******'"; XEncodeAndDecodeBase tool = XEncodeAndDecodeContext.GetEncodeAndDecodeTool(EncodeType.Md5); string password = tool.Encode(this.txtPassWord.Text.Trim()); string userId = this.txtUserName.Text.Trim(); where = string.Format(where, userId, password); IList <XModelBase> models = usersBusiness.QueryViewByWhere(where); if (models.Count > 0) { usersInfo = models[0] as XVUsersInfo; return(usersInfo); } return(usersInfo); }
protected override bool ResetOperate(string password) { XUsersBusiness usersBusiness = this.m_Business as XUsersBusiness; return(usersBusiness.UpdatePasswordMulti(this.m_UserIds, password)); }