Beispiel #1
0
    private void gridviewBind()
    {
        StuCourseManage cm = new StuCourseManage();

        GridView1.DataSource = cm.SelectClassByStu(Session["studentId"].ToString());
        GridView1.DataBind();
    }
Beispiel #2
0
    private void gridviewBind()
    {
        StuHomeworkManage  sm = new StuHomeworkManage();
        StuCourseManage    cm = new StuCourseManage();
        DataTable          dt = cm.SelectClassByStu(Session["studentId"].ToString());
        DataColumn         dc = new DataColumn();
        HomeworkListManage hm = new HomeworkListManage();

        dc.ColumnName = "noup";
        dc.DataType   = typeof(int);
        dt.Columns.Add(dc);
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            int         k;
            int         tmp = Convert.ToInt32(dt.Rows[i]["classId"]);
            DataTable   dd  = hm.SelectTime(Convert.ToInt32(dt.Rows[i]["classId"]));
            stuHomework n   = new stuHomework();
            n.StudentId = Session["studentId"].ToString();
            n.ClassId   = Convert.ToInt32(dt.Rows[i]["classId"]);
            if (dd.Rows.Count != 0 && dd != null)
            {
                int t = Convert.ToInt32(dd.Rows[0][0]);
                if (sm.SelectCountByStu(n).Rows.Count == 0)
                {
                    k = 0;
                }
                else
                {
                    k = Convert.ToInt32(sm.SelectCountByStu(n).Rows[0][0]);
                }
                int y = t - k;
                dt.Rows[i]["noup"] = y;
            }
        }
        GridView1.DataSource = dt;
        GridView1.DataBind();
    }