//切换下一个学生 private void btnNext_Click(object sender, RoutedEventArgs e) { try { //获取学生的基本信息 this.index = index + 1; string studentInfo = ts.getStudentInfoByHomId(homIds[index]); TeacherHomeworkCheck thc = new TeacherHomeworkCheck(homIds, index, lbNotTitle.Content.ToString(), studentInfo, this.pngfile, ifCorrect); thc.pngfile = this.pngfile; thc.className = this.className; thc.classSpecId = this.classSpecId; thc.description = this.description; thc.tbTeacherSpecId.Text = this.tbTeacherSpecId.Text.ToString(); thc.tbTeacherName.Text = this.tbTeacherName.Text.ToString(); //加载教师工号和姓名 thc.Show(); this.Visibility = System.Windows.Visibility.Hidden; } catch { this.index = index - 1;//index多加了1,要减去 System.Windows.MessageBox.Show("您已浏览到最后一个学生作业,无法选择下一个!"); } }
//对应于批改作业/检查作业按钮的点击事件 private void btnHomeworkCorrect1_Click(object sender, RoutedEventArgs e)//检查作业按钮 { Button sonBtn = (Button)sender; Canvas stuCanvas = (Canvas)sonBtn.Parent; StudentCheck stuControl = (StudentCheck)stuCanvas.Parent; //获得学生姓名 string studentName = stuControl.lbStudentInfo2.Content.ToString(); //获得学生学号 string studentId = stuControl.lbStudentInfo1.Content.ToString(); //还需要写根据学号得作业提交描述 string postil = ts.getPostilByForm(tbClassInfo.Text, lbNotTitle.Content.ToString(), studentId); //MessageBox.Show(postil); int index = stuControl.index; string notTitle = lbNotTitle.Content.ToString(); string studentInfo = stuControl.lbStudentInfo1.Content.ToString() + " " + stuControl.lbStudentInfo2.Content.ToString(); bool ifCorrect; //表示是否进行了作业批改 if (stuControl.btnHomeworkCorrect1.Content.ToString() == "检查作业") //说明作业已被批改,需要查询出之前的批改记录 { ifCorrect = true; //需要传入的是已批改的homIds列表 TeacherHomeworkCheck newTeacherHomeworkCheck = new TeacherHomeworkCheck(homIdCorrecteds, index, notTitle, studentInfo, this.pngfile, ifCorrect); newTeacherHomeworkCheck.pngfile = this.pngfile; newTeacherHomeworkCheck.className = tbClassInfo1.Text; newTeacherHomeworkCheck.classSpecId = tbClassInfo.Text; newTeacherHomeworkCheck.description = textBlockDescription.Text; //有问题 newTeacherHomeworkCheck.tbTeacherSpecId.Text = tbTeacherInfo.Text; newTeacherHomeworkCheck.tbTeacherName.Text = tbTeacherInfo1.Text; //加载教师工号和姓名 newTeacherHomeworkCheck.Show(); } else { ifCorrect = false; //需要传入的是待批改的homIds列表 TeacherHomeworkCheck newTeacherHomeworkCheck = new TeacherHomeworkCheck(homIdNeedCorrects, index, notTitle, studentInfo, this.pngfile, ifCorrect); newTeacherHomeworkCheck.pngfile = this.pngfile; newTeacherHomeworkCheck.className = tbClassInfo1.Text; newTeacherHomeworkCheck.classSpecId = tbClassInfo.Text; newTeacherHomeworkCheck.description = textBlockDescription.Text; //有问题 newTeacherHomeworkCheck.tbTeacherSpecId.Text = tbTeacherInfo.Text; newTeacherHomeworkCheck.tbTeacherName.Text = tbTeacherInfo1.Text; //加载教师工号和姓名 newTeacherHomeworkCheck.Show(); } this.Visibility = System.Windows.Visibility.Hidden; }