Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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();
            }
        }