private void btn_delUser_Click(object sender, System.EventArgs e) { OleDbConnection connection = null; try { if (this.dataGridView1.SelectedRows.Count > 0 && this.dataGridView1.Rows.Count > 0) { string userStr = this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString(); if (DialogResult.Cancel != MessageBox.Show("删除后将无法找回,您确定要删除用户(" + userStr + ")吗?", "提示", MessageBoxButtons.OKCancel)) { string contStr = "删除用户<" + userStr + ">账户信息"; userStr = KLineTestProcessor.EncrypDisposeFunc(userStr); try { connection = new OleDbConnection(); connection.ConnectionString = this.gLineTestProcessor.dbPathStr; connection.Open(); new OleDbCommand("delete from TUser where UEID = '" + userStr + "'", connection).ExecuteNonQuery(); connection.Close(); connection = null; } catch (System.Exception arg_ED_0) { if (connection != null) { connection.Close(); connection = null; } KLineTestProcessor.ExceptionRecordFunc(arg_ED_0.StackTrace); goto IL_119; } this.saveOperationRecord(contStr); MessageBox.Show("用户删除成功!", "提示", MessageBoxButtons.OK); this.RefreshDataGridView(); IL_119 :; } } else { MessageBox.Show("没有选择任何记录!", "提示", MessageBoxButtons.OK); } } catch (System.Exception arg_12E_0) { KLineTestProcessor.ExceptionRecordFunc(arg_12E_0.StackTrace); } }
private void btn_submit_Click(object sender, System.EventArgs e) { try { string userStr = this.textBox_user.Text.Trim(); string secrStr = this.textBox_psw.Text.Trim(); string nameStr = this.textBox_name.Text.Trim(); if (string.IsNullOrEmpty(userStr)) { MessageBox.Show("账号为空!", "提示", MessageBoxButtons.OK); } else if (-1 != userStr.ToUpper().LastIndexOf("ADMIN")) { MessageBox.Show("账号中不能含有admin、Admin等字符串!", "提示", MessageBoxButtons.OK); } else if (string.IsNullOrEmpty(secrStr)) { MessageBox.Show("密码为空!", "提示", MessageBoxButtons.OK); } else if (6 <= secrStr.Length && 16 >= secrStr.Length) { if (string.IsNullOrEmpty(nameStr)) { MessageBox.Show("姓名为空!", "提示", MessageBoxButtons.OK); } else { string contStr = "添加新用户<" + userStr + ">"; string uStr = KLineTestProcessor.EncrypDisposeFunc(userStr); string sStr = KLineTestProcessor.EncrypDisposeFunc(secrStr); if (this.AddUserDealwithFun(uStr, sStr, nameStr)) { this.saveOperationRecord(contStr); MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK); base.Close(); } } } else { MessageBox.Show("密码为6~16个字符(英文字母或数字)", "提示", MessageBoxButtons.OK); } } catch (System.Exception arg_136_0) { KLineTestProcessor.ExceptionRecordFunc(arg_136_0.StackTrace); } }
private void btn_submit_Click(object sender, System.EventArgs e) { try { string secrStr = this.textBox_psw.Text.ToString().Trim(); if (string.IsNullOrEmpty(secrStr)) { MessageBox.Show("密码为空!", "提示", MessageBoxButtons.OK); } else if (6 <= secrStr.Length && 16 >= secrStr.Length) { string nameStr = this.textBox_name.Text.ToString().Trim(); if (string.IsNullOrEmpty(nameStr)) { MessageBox.Show("姓名为空!", "提示", MessageBoxButtons.OK); } else { string contStr = "更新用户<" + this.userStr + ">账户信息"; string uStr = KLineTestProcessor.EncrypDisposeFunc(this.userStr); string sStr = KLineTestProcessor.EncrypDisposeFunc(secrStr); if (this.UpdateUserDealwithFun(uStr, sStr, nameStr)) { this.saveOperationRecord(contStr); MessageBox.Show("更新成功!", "提示", MessageBoxButtons.OK); base.Close(); } } } else { MessageBox.Show("密码为6~16个字符(英文字母或数字)", "提示", MessageBoxButtons.OK); } } catch (System.Exception arg_F6_0) { KLineTestProcessor.ExceptionRecordFunc(arg_F6_0.StackTrace); } }
public void LoginDisposeFunc() { OleDbConnection connection = null; OleDbDataReader dataReader = null; try { string userStr = this.textBox_UserName.Text.ToString(); string secrStr = this.textBox_Password.Text.ToString(); if (!string.IsNullOrEmpty(userStr) && !string.IsNullOrEmpty(secrStr)) { this.bIsAdminFlag = false; try { connection = new OleDbConnection(); connection.ConnectionString = this.gLineTestProcessor.dbPathStr; connection.Open(); string arg_A4_0 = "select * from TUser where UEnabled = 1"; if (-1 != userStr.ToUpper().LastIndexOf("ADMIN")) { arg_A4_0 = "select * from TAdmin where UEnabled = 1"; this.bIsAdminFlag = true; } dataReader = new OleDbCommand(arg_A4_0, connection).ExecuteReader(); while (dataReader.Read()) { string uidStr = dataReader["UEID"].ToString(); this.loginName = dataReader["UNAME"].ToString(); string upsStr = dataReader["UPWD"].ToString(); string uStr = KLineTestProcessor.EncrypDisposeFunc(userStr); string sStr = KLineTestProcessor.EncrypDisposeFunc(secrStr); if (uStr == uidStr && sStr == upsStr) { this.bLoginSuccFlag = true; this.loginUser = userStr; this.loginSecr = secrStr; break; } } dataReader.Close(); connection.Close(); dataReader = null; connection = null; } catch (System.Exception arg_15E_0) { if (dataReader != null) { dataReader.Close(); dataReader = null; } if (connection != null) { connection.Close(); connection = null; } KLineTestProcessor.ExceptionRecordFunc(arg_15E_0.StackTrace); goto IL_19C; } if (!this.bLoginSuccFlag) { MessageBox.Show("用户名或密码错误!", "提示", MessageBoxButtons.OK); } else { string contStr = "登录系统"; this.saveOperationRecord(contStr); base.Close(); } IL_19C :; } else { MessageBox.Show("用户名或密码错误!", "提示", MessageBoxButtons.OK); } } catch (System.Exception arg_1B1_0) { KLineTestProcessor.ExceptionRecordFunc(arg_1B1_0.StackTrace); } }
private void FormUpdateUser_Load(object sender, System.EventArgs e) { OleDbConnection connection = null; OleDbDataReader dataReader = null; try { this.textBox_user.Text = this.userStr; try { connection = new OleDbConnection(); connection.ConnectionString = this.gLineTestProcessor.dbPathStr; connection.Open(); dataReader = new OleDbCommand("select * from TUser where UEnabled=1 and UEID='" + KLineTestProcessor.EncrypDisposeFunc(this.userStr) + "'", connection).ExecuteReader(); if (dataReader.Read()) { this.textBox_name.Text = dataReader["UNAME"].ToString(); string tempStr = dataReader["UPWD"].ToString(); this.textBox_psw.Text = KLineTestProcessor.DecodeDisposeFunc(tempStr); } dataReader.Close(); dataReader = null; connection.Close(); connection = null; } catch (System.Exception arg_BA_0) { KLineTestProcessor.ExceptionRecordFunc(arg_BA_0.StackTrace); if (dataReader != null) { dataReader.Close(); dataReader = null; } if (connection != null) { connection.Close(); connection = null; } } } catch (System.Exception arg_E0_0) { KLineTestProcessor.ExceptionRecordFunc(arg_E0_0.StackTrace); } }
private void btn_submit_Click(object sender, System.EventArgs e) { try { this.dbloginUserStr = this.label_user.Text.ToString().Trim(); string oldSecret = this.textBox_oldpsw.Text.ToString().Trim(); string newSecret = this.textBox_newpsw.Text.ToString().Trim(); string renewSecret = this.textBox_renewpsw.Text.ToString().Trim(); if (string.IsNullOrEmpty(oldSecret)) { MessageBox.Show("请输入旧密码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else if (string.IsNullOrEmpty(newSecret)) { MessageBox.Show("请输入新密码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else if (string.IsNullOrEmpty(renewSecret)) { MessageBox.Show("请再次输入新密码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (oldSecret == newSecret) { MessageBox.Show("新密码和旧密码相同!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (6 <= oldSecret.Length && 16 >= oldSecret.Length && !(this.loginSecr != oldSecret)) { if (6 <= newSecret.Length && 16 >= newSecret.Length) { if (newSecret != renewSecret) { MessageBox.Show("两次输入的新密码不一致!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { string contStr = "修改用户<" + this.loginUser + ">登录密码"; oldSecret = KLineTestProcessor.EncrypDisposeFunc(oldSecret); newSecret = KLineTestProcessor.EncrypDisposeFunc(newSecret); this.dbloginUserStr = KLineTestProcessor.EncrypDisposeFunc(this.dbloginUserStr); if (this.UpdatePSWDealwithFunc(oldSecret, newSecret)) { this.updateSuccFlag = true; this.saveOperationRecord(contStr); MessageBox.Show("密码修改成功!", "提示", MessageBoxButtons.OK); base.Close(); } else { MessageBox.Show("密码修改失败!", "提示", MessageBoxButtons.OK); } } } else { MessageBox.Show("请输入6~16位新密码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("旧密码错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (System.Exception ex) { MessageBox.Show("密码修改失败!" + ex.Message); } }