private void btnUpdate_Click(object sender, EventArgs e) { Student st = StudentManageAction.QueryStudentInfo(tbStudentNo.Text); InputStudentForm asf = new InputStudentForm(st); asf.MdiParent = this.MdiParent; asf.Show(); }
private void btnSearch_Click(object sender, EventArgs e) { string sNo = tbStudentNo.Text; string sName = tbStudentName.Text; string faculty = cbFaculty.Text; lvStudentList.Items.Clear(); StudentManageAction.loadAllStudent(lvStudentList, sName, sNo, faculty); }
public CompulsoryCourseForm(Student stu) { InitializeComponent(); this.stu = stu; label1.Text = stu.studentNo; label2.Text = stu.studentName; string deptName = StudentManageAction.getDeptName(stu.studentNo); label3.Text = deptName; stu.loadCompulsoryCourse(lvCCF); }
private void button1_Click(object sender, EventArgs e) { if (tbStudentNo.Text == "") { return; } if (MessageBox.Show("确定要删除吗?", "", MessageBoxButtons.OKCancel) == DialogResult.OK) { int i = StudentManageAction.delStudent(tbStudentNo.Text.Trim()); MessageBox.Show(i + " row(s) affected"); } }
private void button2_Click(object sender, EventArgs e) { Student st = StudentManageAction.QueryStudentInfo(tbStudentNo.Text); if (st == null) { return; } SelectCourseForm scf = new SelectCourseForm(st); scf.MdiParent = this.MdiParent; scf.Show(); }
//学生列表行改变时的事件响应函数 private void lvStudentList_SelectedIndexChanged(object sender, EventArgs e) { if (lvStudentList.SelectedItems.Count == 0) { return; //未选中任何一行 } string sno = lvStudentList.SelectedItems[0].Text; //取选中行中的第一行的第一列文本 tbStudentNo.Text = sno; tbStudentName.Text = lvStudentList.SelectedItems[0].SubItems[1].Text; cbFaculty.Text = lvStudentList.SelectedItems[0].SubItems[4].Text; StudentManageAction.loadSelectedCourse(lvSelectedCourse, sno); //与课本不同,多一个参数 StudentManageAction.loadUnselectedCourse(lvUnselectedCourse, sno); }
private void btnAdd_Click(object sender, EventArgs e) { string deptId = (string)htDeptName[cbDept.Text]; int i = 0; if (tbStudentNo.Text.Trim().Equals("")) { MessageBox.Show("学号不能为空", "提示"); tbStudentNo.Focus(); return; } Student student = new Student(tbStudentNo.Text, tbStudentName.Text, cbSex.Text, tbBirthday.Text, deptId); StudentManageAction sma = new StudentManageAction(); sma.setStudent(student); if (isUpdate == false) { i = sma.addStudent(); if (i > 0) { MessageBox.Show(string.Format("增加了{0}条记录", i)); foreach (Control ctrl in groupBox2.Controls) { if (!(ctrl is Label)) { ctrl.Text = ""; } } } else { MessageBox.Show("添加不成功"); } } else { i = sma.updateStudent(); if (i > 0) { MessageBox.Show(string.Format("更新了{0}条记录", i)); this.Close(); } else { MessageBox.Show("更新不成功"); } } }
public InputStudentForm(Student st) {//st非空为修改窗体;否则为增加窗体 InitializeComponent(); // htDept = StudentManageAction.getDeptList(); StudentManageAction.getDeptList(htDeptId, htDeptName); foreach (DictionaryEntry de in htDeptName) { cbDept.Items.Add(de.Key); } if (st == null) { tbStudentNo.Enabled = true; this.Text = "增加学生"; isUpdate = false; btnAdd.Text = "增加"; } else { this.Text = "修改学生信息"; tbStudentNo.Enabled = false; tbStudentNo.Text = st.studentNo; tbStudentName.Text = st.studentName; // tbBirthday.Text = st.birthday ; cbSex.Text = st.sex; string deptName = (string)htDeptId[st.deptId]; int i = cbDept.Items.IndexOf(deptName); if (i >= 0) { cbDept.SelectedIndex = i; } cbDept.Text = deptName; // cbZhuanye.Text = st.zhuanye; tbBirthday.Text = st.birthday; isUpdate = true; btnAdd.Text = "保存修改"; } }
private void button5_Click(object sender, EventArgs e) { StudentManageAction.loadAllStudent(lvStudentList); }
}//fede public void loadSelectedCompulsoryCourse(ListView lv, Hashtable ht) { StudentManageAction.loadSelectedCompulsoryCourse(lv, ht); }//Dome 16.1.7
}//Dome 16.1.7 public void loadSelectedCompulsoryCourse(ListView lv, string cNo) { StudentManageAction.loadSelectedCompulsoryCourse(lv, cNo); }
public void loadCompulsoryCourse(ListView lv) { StudentManageAction.loadCompulsoryCourse(lv, deptId); }//fede
public void loadMyTimetable(ListView lv) { StudentManageAction.loadMyTimetable(lv, studentNo); }
public void loadSelectedCourseToTimetable(DataGridView dt) { StudentManageAction.loadSelectedCourseToTimetable(dt, studentNo); }
public void loadUnselectCourse(ListView lv) { StudentManageAction.loadUnselectedCourse(lv, studentNo); }
public int deselectCourse(string tcno) { return(StudentManageAction.deselectCourse(studentNo, tcno)); }