Beispiel #1
0
        protected void AddDropCourse_Button_Click(object sender, CommandEventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                CourseInfo course = new CourseInfo();
                course.UserID = user.UserID;

                string[] arg      = e.CommandArgument.ToString().Split(',');
                string   courseid = arg[0];
                string   ischosen = arg[1];
                course.CourseID = int.Parse(courseid);
                if (int.Parse(ischosen) == 0)
                {
                    course.SelectCourse();
                }
                if (int.Parse(ischosen) == 1)
                {
                    course.DropCourse();
                }

                allcourse = course.GetAllCourse(coursenum, coursename, teacher);
                AspNetPager.RecordCount        = allcourse.Tables["AllCourse"].Rows.Count;
                CourseList_DataList.DataSource = FilterTable(allcourse.Tables["AllCourse"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                CourseList_DataList.DataBind();
                //Response.Redirect(Request.Url.AbsoluteUri);
            }
            else
            {
                HttpContext.Current.Response.Write("<script type='text/javascript'>alert('闲置时间过长,请重新登录');location.href='" + Request.Url.AbsoluteUri + "'</script>");
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserInfo"] != null)
            {
                user          = Session["UserInfo"] as UserInfo;
                course.UserID = user.UserID;
            }

            coursename = Request.QueryString["CNA"];
            if (coursename == "")
            {
                coursename = null;
            }
            coursenum = Request.QueryString["CNU"];
            if (coursenum == "")
            {
                coursenum = null;
            }
            teacher = Request.QueryString["T"];
            if (teacher == "")
            {
                teacher = null;
            }

            if (!Page.IsPostBack)
            {
                allcourse = course.GetAllCourse(coursenum, coursename, teacher);
                AspNetPager.RecordCount        = allcourse.Tables["AllCourse"].Rows.Count;
                CourseList_DataList.DataSource = FilterTable(allcourse.Tables["AllCourse"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
                CourseList_DataList.DataBind();
            }
        }
Beispiel #3
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,所以用这种法子给它改
            }
            CourseList_DataList.DataSource = FilterTable(allcourse.Tables["AllCourse"], AspNetPager.StartRecordIndex - 1, AspNetPager.EndRecordIndex - 1);
            CourseList_DataList.DataBind();
        }