private void Btn_Add_Click(object sender, EventArgs e) { if (this.comboBox1.SelectedValue.ToString() == "0") { MessageBox.Show("用户未选择!"); return; } if (this.comboBox3.Text.ToString() == "") { MessageBox.Show("职务未选择!"); return; } DAL.DU_UserInfo user = new DAL.DU_UserInfo(); U_Id = int.Parse(this.comboBox1.SelectedValue.ToString()); Dep = int.Parse(this.comboBox2.SelectedValue.ToString()); Pos = this.comboBox3.Text; if (user.JurisdictionUpdate(Dep, Pos, U_Id)) { MessageBox.Show("权限修改成功!"); } else { MessageBox.Show("权限修改失败!"); } this.Close(); }
private void login_Load(object sender, EventArgs e) { if (Pagetype == "update") { DAL.DU_UserInfo du = new DAL.DU_UserInfo(); MU_UserInfo use = du.GetModel(Uid); this.txt_username.Text = use.U_Name; this.textBox_Name.Text = use.U_RelName; if (use.U_Sex) { this.radio_women.Checked = true; } else { this.radion_man.Checked = true; } this.textBox_Tel.Text = use.U_Telephone; this.label2.Visible = false; this.txt_pwd.Visible = false; this.label3.Visible = false; this.txt_pwd2.Visible = false; this.button1.Visible = false; this.txt_username.ReadOnly = true; } else { this.button3.Visible = false; } }
private void button3_Click(object sender, EventArgs e) { string UserName = this.txt_username.Text.Trim(); //姓名 string UName = this.textBox_Name.Text.Trim(); //姓名 bool Sex = false; //性别 if (this.radio_women.Checked) { Sex = true; } string Tel = this.textBox_Tel.Text;//出身日期 if (UserName == "") { MessageBox.Show("用户名输入不能为空,请重新输入", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MU_UserInfo info = new MU_UserInfo(); info.U_Id = Uid; info.U_Name = UserName; info.U_RelName = UName; info.U_Sex = Sex; info.U_Telephone = Tel; DAL.DU_UserInfo du = new DAL.DU_UserInfo(); if (du.Update(info)) { MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MessageBox.Show("修改失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } this.Close(); } }