private void bt_ok_Click(object sender, EventArgs e) { string sign = cb_qx.SelectedItem.ToString(); string id = tb_Id.Text; string name = tb_name.Text; string passwd = tb_passwd.Text; if (sign.Equals("学生")) { bool result = DAO_Student.UpdataStudentPasswd(name, passwd); if (result) { MessageBox.Show("修改成功"); } else { MessageBox.Show("修改失败,请重试"); } } else { string teaSex = ""; string teaDuties = ""; string teaTelephone = ""; bool result = DAO_Teacher.UpdataTeaInfo(id, name, teaSex, teaDuties, teaTelephone, passwd); if (result) { MessageBox.Show("修改成功"); } else { MessageBox.Show("修改失败,请重试"); } } }
private void setData() { string teaName = ""; string teaId = ""; string teaPasswd = ""; string teaQX = ""; DataSet dataSet = DAO_Teacher.getTeacherData(teaName.Trim(), teaId.Trim(), teaQX, teaPasswd.Trim()); dgv_teaInfo.DataSource = dataSet.Tables["teacher"]; }
//设置查询按钮点击事件 private void bt_select_Click(object sender, EventArgs e) { string teaId = tb_teaId.Text; string teaName = tb_teaName.Text; string teaPasswd = ""; string teaQX = ""; DataSet dataSet = DAO_Teacher.getTeacherData(teaName.Trim(), teaId.Trim(), teaQX, teaPasswd.Trim()); dgv_teaInfo.DataSource = dataSet.Tables["teacher"]; }
//设置选择老师下拉框数据 private void setTeaData() { string teaName = ""; string teaPasswd = ""; string teaId = ""; string teaQX = ""; DataSet ds = DAO_Teacher.getTeacherData(teaName, teaId, teaQX, teaPasswd); DataTable dtGroup = ds.Tables["teacher"]; cb_classTeacher.DataSource = dtGroup; cb_classTeacher.DisplayMember = "teaName"; cb_classTeacher.ValueMember = "teaName"; }
//设置删除按钮点击事件 private void bt_delete_Click(object sender, EventArgs e) { string teaId = dgv_teaInfo.SelectedRows[0].Cells[0].Value.ToString(); bool result = DAO_Teacher.DeleteTeacher(teaId); if (result) { MessageBox.Show("删除成功"); } else { MessageBox.Show("删除失败,请重试"); } setData(); }
private void button1_Click(object sender, EventArgs e) { string id = tb_Id.Text; string passwd = tb_passwd.Text; string qx = cb_qx.SelectedItem.ToString(); if (qx.Equals("学生")) { student stu = new student(); stu.StuId = id; stu.Passwd = passwd; DataSet dataSet = DAO_Student.SelectStuDataForLogin(stu); int count = dataSet.Tables["student"].Rows.Count; if (count > 0) { StuForm stuForm = new StuForm(); stuForm.Show(); this.Hide(); } } else if (qx.Equals("教师")) { string teaName = ""; DataSet dataSet = DAO_Teacher.getTeacherDataForLogin(id, qx, passwd); int count = dataSet.Tables["teacher"].Rows.Count; if (count > 0) { AdminForm adminForm = new AdminForm(false); adminForm.Show(); this.Hide(); } } else if (qx.Equals("管理员")) { string teaName = ""; DataSet dataSet = DAO_Teacher.getTeacherDataForLogin(id, qx, passwd); int count = dataSet.Tables["teacher"].Rows.Count; if (count > 0) { AdminForm adminForm = new AdminForm(true); adminForm.Show(); this.Hide(); } } }
private void add_button_Click(object sender, EventArgs e) { string teaId = tb_teaId.Text; string teaPasswd = tb_passwd.Text; string teaName = tb_teaName.Text; string teaSex = tb_TeaSex.Text; string teaDuties = cb_TeaDuties.Text; string teaTelephone = tb_TeaTelephone.Text; bool result = DAO_Teacher.AddTeacher(teaId, teaName, teaPasswd, teaSex, teaDuties, teaTelephone); if (result) { MessageBox.Show("添加成功"); } else { MessageBox.Show("添加失败,请重试"); } }
private void add_button_Click(object sender, EventArgs e) { string teaId = tb_stuId.Text; string teaName = tb_teaName.Text; string teaSex = cb_TeaSex.Text; string teaTelephone = tb_TeaTelephone.Text; string teaDuties = cb_TeaDuties.Text; string passwd = ""; bool result = DAO_Teacher.UpdataTeaInfo(teaId.Trim(), teaName.Trim(), teaSex.Trim(), teaDuties.Trim(), teaTelephone.Trim(), passwd); if (result) { MessageBox.Show("修改成功"); } else { MessageBox.Show("修改失败,请重试"); } }