Esempio n. 1
0
        private void AllDataBind()
        {
            course.CourseID = int.Parse(courseid);
            course.UserID   = user.UserID;
            course.GetCourseInfo();
            Teacher_TA = course.GetCourseTeacher();
            mycomment  = course.GetMyCourseComment();

            Modify_Intro.Text     = course.Introduction;
            T_DataList.DataSource = course.GetCourseTeacher().Tables["TeacherName"];
            T_DataList.DataBind();
            A_DataList.DataSource = course.GetCourseTeacher().Tables["AssistantName"];
            A_DataList.DataBind();
            if (user.isStudent == 1 && course.IsCourseTeacher() == 0)
            {
                if (mycomment.Tables["CourseComment"].Rows.Count != 0)
                {
                    ModifyMyComment_TextBox.Text = mycomment.Tables["CourseComment"].Rows[0]["Content"].ToString();

                    Byte[] tags = new Byte[20];
                    Byte   a = 1, b = 0;
                    for (int i = 1; i <= 6; i++)
                    {
                        if (((Byte[])mycomment.Tables["CourseComment"].Rows[0]["Tags"])[i - 1] == a)
                        {
                            ((CheckBox)FindControl("MyCommentTagModify" + i.ToString() + "_CheckBox")).Checked = true;
                        }
                        else
                        {
                            ((CheckBox)FindControl("MyCommentTagModify" + i.ToString() + "_CheckBox")).Checked = false;
                        }
                    }
                }
            }

            MessageInfo mc = new MessageInfo();

            if (mycomment.Tables["CourseComment"].Rows.Count != 0)
            {
                mc.MessageID = int.Parse(mycomment.Tables["CourseComment"].Rows[0]["CommentID"].ToString());
                DataSet mycommentreply = mc.GetCommentReply();
                MyCommentReplyComment_DataList.DataSource = mycommentreply;
                MyCommentReplyComment_DataList.DataBind();
                MyReplyNum_div.InnerHtml = mycommentreply.Tables["Reply"].Rows.Count.ToString();
            }

            allcomment = course.GetCourseComment();
            AspNetPager.RecordCount        = allcomment.Tables["CourseComment"].Rows.Count;
            AllComment_DataList.DataSource = FilterTable(allcomment.Tables["CourseComment"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
            AllComment_DataList.DataBind();
        }
Esempio n. 2
0
        protected void AspNetPager_PageChanged(object src, EventArgs e)
        {
            int index;// = AspNetPager.CurrentPageIndex;

            if (Request.QueryString["Page"] == null)
            {
                index = 1;
            }
            else
            {
                index = Convert.ToInt32(Request.QueryString["Page"]);
                AspNetPager.CurrentPageIndex = index;//一直都是1,所以用这种法子给它改
            }
            AllComment_DataList.DataSource = FilterTable(allcomment.Tables["CourseComment"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
            AllComment_DataList.DataBind();
        }