Example #1
0
        //进入答疑界面时加载目前已经有的疑问和解答
        private void loadQuestionAndAnswer(string noteId, AnswerQuestion newAnswerQuestion)
        {
            //进入答疑界面时加载目前已经有的疑问和解答
            DataTable table1 = td.getComment(noteId);

            //List<StudentAskQuestion> list = new List<StudentAskQuestion>();  //生成StudentAskQuestion动态数组
            //MessageBox.Show(table1.Rows.Count.ToString());    //
            StudentAskQuestion[] newStudentAskQuestion = new StudentAskQuestion[100];
            for (int i = 0; i < table1.Rows.Count; i++)
            {
                newStudentAskQuestion[i] = new StudentAskQuestion();
                newStudentAskQuestion[i].lbStuName.Content          = "本课堂学生";
                newStudentAskQuestion[i].textBoxQuestion.Text       = table1.Rows[i][2].ToString(); //有问题
                newStudentAskQuestion[i].textBoxQuestion.IsReadOnly = true;
                newStudentAskQuestion[i].tbResponse.Text            = table1.Rows[i][3].ToString();
                newStudentAskQuestion[i].btnComment.Click          += new RoutedEventHandler(btnSubmitQuestion_Click);
                newStudentAskQuestion[i].btnInsert.Click           += new RoutedEventHandler(btnbtnInsert_Click);
                newStudentAskQuestion[i].lbResponseName.Content     = tbTeacherInfo1.Text + "老师"; //给老师姓名赋值
                newAnswerQuestion.listViewQuestionAndAnswer.Items.Add(newStudentAskQuestion[i]);
                //newAnswerQuestion.btnSubmitQuestion.Click += new RoutedEventHandler(btnSubmitQuestion_Click); //定义答疑按钮的事件
                if (newStudentAskQuestion[i].tbResponse.Text != "")
                {
                    newStudentAskQuestion[i].teacherResponse.Visibility = Visibility.Visible;
                    newStudentAskQuestion[i].tbResponse.IsReadOnly      = true;
                    newStudentAskQuestion[i].btnComment.Visibility      = Visibility.Hidden;
                    newStudentAskQuestion[i].btnInsert.Visibility       = Visibility.Hidden;
                }
                else
                {
                    newStudentAskQuestion[i].teacherResponse.Visibility = Visibility.Hidden;
                }
            }
        }
        private void btnAnswerQuestion_Click(object sender, RoutedEventArgs e)
        {
            // 打开子窗体
            AnswerQuestion newAnswerQuestion = new AnswerQuestion();

            newAnswerQuestion.Show();
            // 隐藏自己(父窗体)
            this.Visibility = System.Windows.Visibility.Hidden;
        }
Example #3
0
        //查看答疑的按钮,点击进入答疑区
        private void btnAnswerQuestion_Click(object sender, RoutedEventArgs e)
        {
            AnswerQuestion newAnswerQuestion = new AnswerQuestion(lbNotTitle.Content.ToString(), tbTeacherInfo1.Text, notId); //这里有问题

            loadQuestionAndAnswer(notId, newAnswerQuestion);                                                                  //加载疑问和回答
            newAnswerQuestion.btnSubmitQuestion.Visibility = Visibility.Hidden;
            newAnswerQuestion.Show();

            // this.Visibility = System.Windows.Visibility.Hidden;
        }
        //加载目前已有疑问和答疑
        private void loadQuestionAndAnswer(string noteId, AnswerQuestion newAnswerQuestion)
        {
            //进入答疑界面时加载目前已经有的疑问和解答
            TeacherDao.TDao td     = new TeacherDao.TDao();
            DataTable       table1 = td.getComment(noteId);

            //List<StudentAskQuestion> list = new List<StudentAskQuestion>();  //生成StudentAskQuestion动态数组
            //MessageBox.Show(table1.Rows.Count.ToString());    //
            StudentAskQuestion[] newStudentAskQuestion = new StudentAskQuestion[100];
            for (int i = 0; i < table1.Rows.Count; i++)
            {
                newStudentAskQuestion[i] = new StudentAskQuestion();
                newStudentAskQuestion[i].lbStuName.Content          = "本课堂学生";
                newStudentAskQuestion[i].textBoxQuestion.Text       = table1.Rows[i][2].ToString(); //有问题
                newStudentAskQuestion[i].textBoxQuestion.IsReadOnly = true;
                newStudentAskQuestion[i].tbResponse.Text            = table1.Rows[i][3].ToString();
                newStudentAskQuestion[i].btnComment.Click          += new RoutedEventHandler(btnComment_Click);
                newStudentAskQuestion[i].btnInsert.Click           += new RoutedEventHandler(btnbtnInsert_Click);
                newStudentAskQuestion[i].lbResponseName.Content     = teacherName + "老师"; //给老师姓名赋值
                newAnswerQuestion.listViewQuestionAndAnswer.Items.Add(newStudentAskQuestion[i]);
                //newAnswerQuestion.btnSubmitQuestion.Click += new RoutedEventHandler(btnSubmitQuestion_Click); //定义答疑按钮的事件
                if (newStudentAskQuestion[i].tbResponse.Text != "")
                {
                    newStudentAskQuestion[i].teacherResponse.Visibility = Visibility.Visible;
                    newStudentAskQuestion[i].tbResponse.IsReadOnly      = true;
                    newStudentAskQuestion[i].btnComment.Visibility      = Visibility.Hidden;
                    newStudentAskQuestion[i].btnInsert.Visibility       = Visibility.Hidden;
                }
                else//说明老师没有回复
                {
                    if (this.name != this.teacherName)
                    {
                        //如果是学生身份,隐藏老师回答框和评论框
                        newStudentAskQuestion[i].textBoxQuestion.IsReadOnly = false;//允许重新编辑
                        newStudentAskQuestion[i].teacherResponse.Visibility = Visibility.Hidden;
                        newStudentAskQuestion[i].btnComment.Visibility      = Visibility.Hidden;
                        newStudentAskQuestion[i].btnInsert.Visibility       = Visibility.Visible;
                    }
                    else//如果是老师身份,则仅隐藏老师回答框
                    {
                        newStudentAskQuestion[i].teacherResponse.Visibility = Visibility.Hidden;
                        newStudentAskQuestion[i].btnComment.Visibility      = Visibility.Visible;
                        newStudentAskQuestion[i].btnInsert.Visibility       = Visibility.Visible;
                        //newStudentAskQuestion[i].btnInsert.Visibility = Visibility.Hidden;//哪怕没有教师的回答,在发送成功后也需要隐藏评论和发送按钮,没有教师的回答可以继续进行加载,不需要隐藏
                    }
                }
            }
        }