/// <summary> /// 删除管理员 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripMenuItem3_Click(object sender, EventArgs e) { try { if (listView1.SelectedItems.Count > 0) { if (MessageBox.Show("确定要执行删除操作", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { int id = int.Parse(listView1.SelectedItems[0].SubItems[0].Text); Lecturer_Bll lb = new Lecturer_Bll(); int temp = lb.Delete_User(id); if (temp > 0) { MessageBox.Show("删除成功!"); GetLecture(); } else { MessageBox.Show("删除成功!"); } } } else { MessageBox.Show("请选择要删除的对象!"); } } catch { MessageBox.Show("删除出现异常!"); } }
private void listView1_MouseClick(object sender, MouseEventArgs e) { Lecturer_Bll lb = new Lecturer_Bll(); //lb.QueryAdminID(); toolStripMenuItem2.Enabled = true; }
/// <summary> /// 显示会员信息 /// </summary> public void GetLecture()//完成 { listView1.Items.Clear(); Lecturer_Bll lb = new Lecturer_Bll(); lecture_List = lb.All_Lecturer(); foreach (Lecturer l in lecture_List) { ListViewItem lvi = new ListViewItem(l.L_ID.ToString()); lvi.SubItems.Add(l.L_VDATE.ToString()); lvi.SubItems.Add(l.L_NAME.ToString()); listView1.Items.Add(lvi); } }
private void button1_Click(object sender, EventArgs e) { Lecturer_Bll lb = new Lecturer_Bll(); int i = lb.Alter_User(int.Parse(textBox1.Text), textBox2.Text); if (i > 0) { MessageBox.Show("修改成功!"); } else { MessageBox.Show("修改失败!"); } }
private void button1_Click(object sender, EventArgs e) { try { Lecturer l = new Lecturer(); if (textBox2.Text == null) { MessageBox.Show("请输入管理员用户名!"); return; } else if (textBox3.Text == null) { MessageBox.Show("请输入管理员密码!"); return; } else { //l.L_ID = Convert.ToInt32(textBox1.Text.Trim()); l.L_NAME = textBox2.Text.Trim(); l.L_PASS = textBox3.Text.Trim(); l.L_VDATE = DateTime.Now.ToString(); } Lecturer_Bll lb = new Lecturer_Bll(); int i = lb.Add_User(l); if (i > 0) { MessageBox.Show("添加成功!"); Close(); } else { MessageBox.Show("添加失败!"); } } catch { MessageBox.Show("出现异常,检查用户名是否重复!"); Close(); } }