private void simpleButton1_Click(object sender, EventArgs e) { Dialog_TokenSet _dialog = new Dialog_TokenSet(); if (_dialog.ShowDialog() == DialogResult.OK) { GDSTokenRecord _newRec = new GDSTokenRecord(); _newRec.ID = Guid.NewGuid().ToString(); _newRec.RemoteIP = _dialog.TokenIP; _newRec.TokenData = MD5Base64.Encode(_dialog.TokenString); _newRec.CommandName = this.CommandName; using (SinoSZClientBase.CommonService.CommonServiceClient _csc = new SinoSZClientBase.CommonService.CommonServiceClient()) { bool _ret = _csc.InsertTokenRecord(_newRec); if (_ret) { this.gridView1.BeginUpdate(); TokenRecords.Add(_newRec); this.gridView1.EndUpdate(); this.gridView1.RefreshData(); } else { MessageBox.Show("添加失败!", "系统提示", MessageBoxButtons.OK); } } } }
private void simpleButton2_Click(object sender, EventArgs e) { if (gridView1.FocusedRowHandle >= 0) { GDSTokenRecord _g = gridView1.GetRow(this.gridView1.FocusedRowHandle) as GDSTokenRecord; Dialog_TokenSet _dialog = new Dialog_TokenSet(_g); if (_dialog.ShowDialog() == DialogResult.OK) { using (SinoSZClientBase.CommonService.CommonServiceClient _csc = new SinoSZClientBase.CommonService.CommonServiceClient()) { GDSTokenRecord _newRec = new GDSTokenRecord(); _newRec.ID = _g.ID; _newRec.RemoteIP = _g.RemoteIP; _newRec.TokenData = MD5Base64.Encode(_dialog.TokenString); _newRec.CommandName = _g.CommandName; bool _ret = _csc.UpdateTokenRecord(_newRec); if (_ret) { this.gridView1.BeginUpdate(); _g.TokenData = _newRec.TokenData; this.gridView1.EndUpdate(); this.gridView1.RefreshData(); } else { MessageBox.Show("删除失败!", "系统提示", MessageBoxButtons.OK); } } } } else { MessageBox.Show("请选择一个要重设令牌的记录!", "系统提示", MessageBoxButtons.OK); } }
/// <summary> /// 重置口令 /// </summary> /// <param name="_uname"></param> /// <param name="_pass"></param> /// <returns></returns> override public int ResetPass(string _uname, string _pass) { string Changepass = string.Format("Update ZHTJ_CSB set CSDATA='{0}' where CSNAME='AdminPass'", MD5Base64.Encode(_pass)); try { SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringProfile, CommandType.Text, Changepass); return(1); } catch (Exception e) { throw new Exception(string.Format("重设口令出错:{0}", e.Message)); } }
/// <summary> /// 修改口令 /// </summary> /// <param name="_name"></param> /// <param name="_oldpass"></param> /// <param name="_newpass"></param> /// <returns></returns> override public int ChangePassword(string _name, string _oldpass, string _newpass) { //1.读取数据库中的用户信息,验证密码 string CheckStr = string.Format("SELECT count(*) FROM zhtj_csb WHERE CSNAME='AdminPass' and CSDATA='{0}' ", MD5Base64.Encode(_oldpass)); decimal _ret = (decimal)SqlHelper.ExecuteScalar(SqlHelper.ConnectionStringProfile, CommandType.Text, CheckStr); if (_ret < 1) { return(-1); } string Changepass = string.Format("Update ZHTJ_CSB set CSDATA='{0}' where CSNAME='AdminPass'", MD5Base64.Encode(_newpass)); try { SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringProfile, CommandType.Text, Changepass); return(1); } catch (Exception e) { throw new Exception(string.Format("修改口令出错:{0}", e.Message)); } }
/// <summary> /// 验证口令 /// </summary> /// <param name="_name"></param> /// <param name="_pass"></param> /// <returns></returns> override public bool Check(string _name, string _pass, string CheckType) { //1.读取数据库中的用户信息,验证密码 string CheckStr = string.Format("SELECT count(*) FROM zhtj_csb WHERE CSNAME='AdminPass' and CSDATA='{0}' ", MD5Base64.Encode(_pass)); int _ret = (int)SqlHelper.ExecuteScalar(SqlHelper.ConnectionStringProfile, CommandType.Text, CheckStr); return(_ret > 0); }
/// <summary> /// 重置口令 /// </summary> /// <param name="_uname"></param> /// <param name="_pass"></param> /// <returns></returns> override public int ResetPass(string _uname, string _pass) { string Changepass = string.Format("Update qx_tjyhb set KL='{1}' where YHM='{0}'", _uname, MD5Base64.Encode(_pass)); try { OracleHelper.ExecuteNonQuery(OracleHelper.ConnectionStringProfile, CommandType.Text, Changepass); return(1); } catch (Exception e) { throw new Exception(string.Format("重设口令出错:{0}", e.Message)); } }
/// <summary> /// 修改口令 /// </summary> /// <param name="_name"></param> /// <param name="_oldpass"></param> /// <param name="_newpass"></param> /// <returns></returns> override public int ChangePassword(string _name, string _oldpass, string _newpass) { //1.读取数据库中的用户信息,验证密码 string CheckStr = string.Format("SELECT count(*) FROM qx_tjyhb WHERE YHM='{0}' and KL='{1}' ", _name, MD5Base64.Encode(_oldpass)); decimal _ret = (decimal)OracleHelper.ExecuteScalar(OracleHelper.ConnectionStringProfile, CommandType.Text, CheckStr); if (_ret < 1) { return(-1); } string Changepass = string.Format("Update qx_tjyhb set KL='{1}' where YHM='{0}'", _name, MD5Base64.Encode(_newpass)); try { OracleHelper.ExecuteNonQuery(OracleHelper.ConnectionStringProfile, CommandType.Text, Changepass); return(1); } catch (Exception e) { throw new Exception(string.Format("修改口令出错:{0}", e.Message)); } }
/// <summary> /// 验证口令 /// </summary> /// <param name="_name"></param> /// <param name="_pass"></param> /// <returns></returns> override public bool Check(string _name, string _pass, string CheckType) { //1.读取数据库中的用户信息,验证密码 string CheckStr = string.Format("SELECT count(*) FROM qx_tjyhb WHERE YHM='{0}' and KL='{1}' ", _name, MD5Base64.Encode(_pass)); decimal _ret = (decimal)OracleHelper.ExecuteScalar(OracleHelper.ConnectionStringProfile, CommandType.Text, CheckStr); return(_ret > 0); }