private void button1_Click(object sender, EventArgs e) { if (textBox3.Text.Trim() != textBox4.Text.Trim()) { MessageBox.Show("两次密码输入不一致!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (textBox2.Text.Trim() != User.Constants.UserPassword) { MessageBox.Show("旧密码错误!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { User.UserInfoData data = new User.UserInfoData(); data.UserName = this.textBox1.Text; data.UserPwd = this.textBox3.Text; data.UserRight = User.Constants.UserRight; if (User.UserInfoOperation.updateUserInfo(data)) { MessageBox.Show("修改成功!", "Succeed", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Dispose(); } else { MessageBox.Show("修改失败!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } catch (Exception ex) { ex.ToString(); MessageBox.Show("修改失败!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button1_Click(object sender, EventArgs e) { if (comboBox1.Text.Trim() == "" || comboBox2.Text.Trim() == "") { MessageBox.Show("修改内容不能为空", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { User.UserInfoData data = new User.UserInfoData(); data.UserName = this.comboBox1.Text.Trim(); data.UserRight = this.comboBox2.Text.Trim(); data.UserPwd = User.Constants.UserPassword; if (User.UserInfoOperation.updateUserInfo(data)) { MessageBox.Show("修改成功!", "Succeed", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Dispose(); } else { MessageBox.Show("修改失败!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } catch (Exception ex) { ex.ToString(); MessageBox.Show("修改失败!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public User_Password_Edit() { InitializeComponent(); User.UserInfoData data = new User.UserInfoData(); data.UserName = User.Constants.UserName; DataSet ds = new DataSet(); ds = User.UserInfoOperation.getUserInfoAll(data); }
private void button3_Click(object sender, EventArgs e) { int index = this.dataGridView1.CurrentRow.Index; if (index < 0) { MessageBox.Show("请选择要删除的记录!", "提示"); return; } else { if (MessageBox.Show("确定要删除吗?", "删除后无法撤回", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { string tno = ds.Tables[0].Rows[index]["教师号"].ToString(); try { if (Teacher.TeacherInfoOperation.deleteTeacherInfo(tno)) { MessageBox.Show("删除成功!", "提示"); //binddatagrid string Username = comboBox1.Text.Trim(); string UserRight = comboBox2.Text; User.UserInfoData data = new User.UserInfoData(); data.UserName = Username; data.UserRight = UserRight; try { ds = User.UserInfoOperation.getUserInfo(data); this.dataGridView1.DataSource = ds.Tables[0]; } catch (Exception ex) { ex.ToString(); } } else { MessageBox.Show("删除失败", "错误"); } } catch (Exception ex) { ex.ToString(); MessageBox.Show("删除失败", "错误"); } } } }
private void button1_Click(object sender, EventArgs e) { string Username = comboBox1.Text.Trim(); string UserRight = comboBox2.Text; User.UserInfoData data = new User.UserInfoData(); data.UserName = Username; data.UserRight = UserRight; try { ds = User.UserInfoOperation.getUserInfo(data); this.dataGridView1.DataSource = ds.Tables[0]; } catch (Exception ex) { ex.ToString(); } }
private void UserQuery_Load(object sender, EventArgs e) { User.UserInfoData data = new User.UserInfoData(); ds = User.UserInfoOperation.getUserInfo(data); this.dataGridView1.DataSource = ds.Tables[0]; }