示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                user = Session["UserInfo"] as UserInfo;
            }
            else
            {
                Response.Redirect("/aspx/Login.aspx");
            }

            courseid = Request.QueryString["CourseID"];
            System.Text.RegularExpressions.Regex rex = new System.Text.RegularExpressions.Regex(@"^\d+$");
            if (courseid == null || !rex.IsMatch(courseid))
            {
                Response.Redirect("/aspx/CourseList.aspx");
            }

            course.CourseID = int.Parse(courseid);
            course.UserID   = user.UserID;
            course.GetCourseInfo();
            Teacher_TA = course.GetCourseTeacher();

            if (!Page.IsPostBack)
            {
                AllDataBind();
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                user = Session["UserInfo"] as UserInfo;
            }
            else
            {
                Response.Redirect("/aspx/Login.aspx");
            }

            courseid = Request.QueryString["CourseID"];
            System.Text.RegularExpressions.Regex rex = new System.Text.RegularExpressions.Regex(@"^\d+$");
            if (courseid == null || !rex.IsMatch(courseid))
            {
                Response.Redirect("/aspx/CourseList.aspx");
            }

            course.CourseID = int.Parse(courseid);
            course.UserID   = user.UserID;
            course.GetCourseInfo();
            Teacher_TA = course.GetCourseTeacher();

            int flag = 0;

            for (int i = 0; i < Teacher_TA.Tables["TeacherName"].Rows.Count; i++)
            {
                if (user.UserID == int.Parse(Teacher_TA.Tables["TeacherName"].Rows[i][0].ToString()))
                {
                    flag = 1;
                    break;
                }
            }
            for (int i = 0; i < Teacher_TA.Tables["AssistantName"].Rows.Count; i++)
            {
                if (user.UserID == int.Parse(Teacher_TA.Tables["AssistantName"].Rows[i][0].ToString()))
                {
                    flag = 1;
                    break;
                }
            }
            if (flag == 0)
            {
                Response.Redirect("/aspx/Login.aspx");
            }

            if (!Page.IsPostBack)
            {
                AllDataBind();
            }
        }
示例#3
0
        protected void CourseList_DataList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                CourseInfo course = new CourseInfo();
                course.CourseID = int.Parse(DataBinder.Eval(e.Item.DataItem, "CourseID").ToString());

                DataList dataList = e.Item.FindControl("Teacher_DataList") as DataList;
                dataList.DataSource = course.GetCourseTeacher().Tables["TeacherName"];
                dataList.DataBind();
                if (dataList.Items.Count == 0)
                {
                    ((HtmlGenericControl)e.Item.FindControl("No_t")).InnerHtml = "暂未注册";
                }
                DataList dataList2 = e.Item.FindControl("TA_DataList") as DataList;
                dataList2.DataSource = course.GetCourseTeacher().Tables["AssistantName"];
                dataList2.DataBind();
                if (dataList2.Items.Count == 0)
                {
                    ((HtmlGenericControl)e.Item.FindControl("No_ta")).InnerHtml = "暂未注册";
                }
            }
        }