// gridView1 绑定
    public void gridviewBind()
    {
        StuHomeworkManage sm = new StuHomeworkManage();
        stuHomework       n  = new stuHomework();

        n.ClassId = Convert.ToInt32(Label6.Text);
        n.Times   = DropDownList1.SelectedIndex + 1;
        DataTable  dt = sm.SelectAllByTimes(n);
        DataColumn dc = new DataColumn();

        dc.ColumnName = "add";
        dc.DataType   = typeof(bool);
        dt.Columns.Add(dc);
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            if (dt.Rows[i]["times"].ToString() != "")
            {
                dt.Rows[i]["add"] = true;
            }
            else
            {
                dt.Rows[i]["add"] = false;
            }
        }
        GridView1.DataSource = dt;
        GridView1.DataBind();
    }
    private void gridviewBind()
    {
        StuHomeworkManage cm = new StuHomeworkManage();
        stuHomework       n  = new stuHomework();

        n.ClassId   = Convert.ToInt32(Request.QueryString["classId"]);
        n.StudentId = Session["studentId"].ToString();
        DataTable  dt = cm.SelectAllByStu(n);
        DataColumn dc = new DataColumn();

        dc.ColumnName = "add";
        dc.DataType   = typeof(bool);
        dt.Columns.Add(dc);
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            n.Times = Convert.ToInt32(dt.Rows[i]["times"]);
            if (cm.Isexistence(n).Rows.Count != 0)
            {
                dt.Rows[i]["add"] = true;
            }
            else
            {
                dt.Rows[i]["add"] = false;
            }
        }
        GridView1.DataSource = dt;
        GridView1.DataBind();
        //GridView1.DataSource = cm.SelectAllByStu(n);
        //GridView1.DataBind();
    }
Ejemplo n.º 3
0
    private void gridviewBind()
    {
        StuHomeworkManage sm = new StuHomeworkManage();
        stuHomework       n  = new stuHomework();

        n.ClassId = Convert.ToInt32(Request.QueryString["classId"]);
        n.Times   = Convert.ToInt32(Request.QueryString["times"]);
        DataTable  dt = sm.noreviewsbyclasstimes(n);
        DataColumn dc = new DataColumn();

        dc.ColumnName = "reviews";
        dc.DataType   = typeof(bool);
        dt.Columns.Add(dc);
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            if (dt.Rows[i]["results"].ToString() != "")
            {
                dt.Rows[i]["reviews"] = true;
            }
            else
            {
                dt.Rows[i]["reviews"] = false;
            }
        }
        GridView1.DataSource = dt;
        GridView1.DataBind();
    }
Ejemplo n.º 4
0
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "count")
     {
         StuHomeworkManage sm  = new StuHomeworkManage();
         GridViewRow       row = (e.CommandSource as Control).NamingContainer as GridViewRow;
         Label5.Text  = GridView1.DataKeys[row.RowIndex].Values[0].ToString();
         Label10.Text = GridView1.DataKeys[row.RowIndex].Values[1].ToString();
         string      studentId = GridView1.DataKeys[row.RowIndex].Values[0].ToString();
         stuHomework n         = new stuHomework();
         n.StudentId = studentId;
         n.ClassId   = Convert.ToInt32(Label6.Text);
         DataTable  dt = sm.SelectAllByStu(n);
         DataColumn dc = new DataColumn();
         dc.ColumnName = "add";
         dc.DataType   = typeof(bool);
         dt.Columns.Add(dc);
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             if (dt.Rows[i]["uptimes"].ToString() != "")
             {
                 dt.Rows[i]["add"] = true;
             }
             else
             {
                 dt.Rows[i]["add"] = false;
             }
         }
         GridView2.DataSource = dt;
         GridView2.DataBind();
     }
 }
Ejemplo n.º 5
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        StuCourseManage   sm = new StuCourseManage();
        StuHomeworkManage mm = new StuHomeworkManage();
        DataTable         dt = sm.SelectClassByClassId(Convert.ToInt32(Request.QueryString["classId"]));
        stuHomework       n  = new stuHomework();

        n.StudentId = Session["studentId"].ToString();
        n.ClassId   = Convert.ToInt32(Request.QueryString["classId"]);
        n.Times     = Convert.ToInt32(Label1.Text);
        n.Creater   = Session["studentId"].ToString();
        string path = Server.MapPath("~/upload/" + dt.Rows[0]["teacherId"].ToString() + "/" + dt.Rows[0]["name"].ToString() + Request.QueryString["classId"] + "/第" + Label1.Text + "次作业/");

        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }
        if (mm.Isexistence(n).Rows.Count > 0)
        {
            FileInfo fi1 = new FileInfo(Server.MapPath(mm.Isexistence(n).Rows[0]["content"].ToString()));
            fi1.Delete();
            mm.Delete(n);
        }
        FileUpload1.SaveAs(path + FileUpload1.FileName);
        n.Content = "~/upload/" + dt.Rows[0]["teacherId"].ToString() + "/" + dt.Rows[0]["name"].ToString() + Request.QueryString["classId"] + "/第" + Label1.Text + "次作业/" + FileUpload1.FileName;
        mm.Insert(n);
        ScriptManager.RegisterStartupScript(this, this.GetType(), "updateScript", "alert(\"上交成功\");", true);
    }
Ejemplo n.º 6
0
 /// <summary>
 /// 学生查看已交全部作业
 /// </summary>
 /// <param name="n">学生作业实体类</param>
 /// <returns></returns>
 public DataTable SelectAll(stuHomework n)
 {
     SqlParameter[] paras = new SqlParameter[]
     {
         new SqlParameter("@studentId", n.StudentId),
     };
     return(sqlhelper.ExecuteQuery("SELECT studentId, classId, times, results FROM stuHomework where studentId=@studentId", CommandType.Text));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 统计单一班级单一次数的全部作业成绩
 /// </summary>
 /// <param name="n">学生作业实体类</param>
 /// <returns></returns>
 public DataTable SelectAllByTimes(stuHomework n)
 {
     SqlParameter[] paras = new SqlParameter[]
     {
         new SqlParameter("@classId", n.ClassId),
         new SqlParameter("@times", n.Times),
     };
     return(sqlhelper.ExecuteQuery("SELECT  a.classId, a.studentId, times,students.name,students.subject,results FROM (SELECT studentId,classId FROM stuCourse WHERE (classId = @classId)) a inner join students on a.studentId=students.studentId left JOIN stuHomework on a.classId=stuHomework.classId AND a.studentId=stuHomework.studentId AND times=@times order by times", paras, CommandType.Text));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 统计单一班级单一学生的全部作业成绩
 /// </summary>
 /// <param name="n">学生作业实体类</param>
 /// <returns></returns>
 public DataTable SelectAllByStu(stuHomework n)
 {
     SqlParameter[] paras = new SqlParameter[]
     {
         new SqlParameter("@classId", n.ClassId),
         new SqlParameter("@studentId", n.StudentId),
     };
     return(sqlhelper.ExecuteQuery("	SELECT a.classId,a.times, a.name, a.[content], a.remarks, a.publishTime, a.closeTime,a.referenceAnswer ,stuHomework.times as uptimes,results,comment FROM (SELECT classId,times, name, [content], remarks,CONVERT(varchar(100), publishTime, 23) as publishTime,CONVERT(varchar(100), closeTime, 23) as closeTime,referenceAnswer FROM homeworkList WHERE (classId = @classId)) a left JOIN stuHomework on a.classId=stuHomework.classId AND a.times=stuHomework.times AND studentId=@studentId order by results", paras, CommandType.Text));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 老师查看某班某次作业待批作业列表
 /// </summary>
 /// <param name="n">学生作业实体表</param>
 /// <returns></returns>
 public DataTable noreviewsbyclasstimes(stuHomework n)
 {
     SqlParameter[] paras = new SqlParameter[]
     {
         new SqlParameter("@classId", n.ClassId),
         new SqlParameter("@times", n.Times),
     };
     return(sqlhelper.ExecuteQuery("SELECT stuHomework.studentId, stuHomework.classId, stuHomework.times, students.name, stuHomework.results, stuHomework.[content],stuHomework.comment FROM stuHomework INNER JOIN students ON stuHomework.studentId = students.studentId WHERE (stuHomework.classId = @classId) AND (stuHomework.times = @times) order by results", paras, CommandType.Text));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 学生查看某一班级未交作业次数
 /// </summary>
 /// <param name="n">学生作业实体类</param>
 /// <returns></returns>
 public DataTable SelectCountByStu(stuHomework n)
 {
     SqlParameter[] paras = new SqlParameter[]
     {
         new SqlParameter("@classId", n.ClassId),
         new SqlParameter("@studentId", n.StudentId),
     };
     return(sqlhelper.ExecuteQuery("SELECT count(*) from stuHomework  WHERE (classId = @classId)  AND  studentId=@studentId group by studentId", paras, CommandType.Text));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// 查看单一班级单一次数已交作业列表
 /// </summary>
 /// <param name="n">学生作业实体类</param>
 /// <returns></returns>
 public DataTable SelectByClass(stuHomework n)
 {
     SqlParameter[] paras = new SqlParameter[]
     {
         new SqlParameter("@classId", n.ClassId),
         new SqlParameter("@times", n.Times),
     };
     return(sqlhelper.ExecuteQuery("SELECT stuHomework.studentId, [content], remarks, results,comment, students.name, students.subject FROM stuHomework  JOIN students on stuHomework.studentId=students.studentId AND classId=@classId AND times=@times ", paras, CommandType.Text));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// 查看某一班级某一学生某一次作业是否已交
 /// </summary>
 /// <param name="n">学生作业实体类</param>
 /// <returns></returns>
 public DataTable Isexistence(stuHomework n)
 {
     SqlParameter[] paras = new SqlParameter[]
     {
         new SqlParameter("@classId", n.ClassId),
         new SqlParameter("@studentId", n.StudentId),
         new SqlParameter("@times", n.Times),
     };
     return(sqlhelper.ExecuteQuery("SELECT * from stuHomework  WHERE (classId = @classId)  AND  studentId=@studentId AND times=@times", paras, CommandType.Text));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 教师更新学生作业
 /// </summary>
 /// <param name="n">学生作业实体类</param>
 public void UpdateByTea(stuHomework n)
 {
     SqlParameter[] paras = new SqlParameter[]
     {
         new SqlParameter("@classId", n.ClassId),
         new SqlParameter("@comment", n.Comment),
         new SqlParameter("@modifier", n.Modifier),
         new SqlParameter("@results", n.Results),
         new SqlParameter("@studentId", n.StudentId),
         new SqlParameter("@times", n.Times),
     };
     sqlhelper.ExecuteQuery("UPDATE stuHomework SET comment = @comment,modifier=@modifier,results = @results,lastmodify = getdate() where classId=@classId AND times=@times AND studentId=@studentId", paras, CommandType.Text);
 }
Ejemplo n.º 14
0
    // gridView单击按钮老师更新学生作业(批阅作业)事件
    protected void Button1_Click(object sender, EventArgs e)
    {
        reviews.Visible = false;
        Panel1.Visible  = false;
        StuHomeworkManage sm = new StuHomeworkManage();
        stuHomework       n  = new stuHomework();

        n.ClassId   = Convert.ToInt32(Label6.Text);
        n.Times     = Convert.ToInt32(Label2.Text);
        n.StudentId = Label5.Text;
        n.Results   = Convert.ToInt32(TextBox1.Text.Trim());
        n.Comment   = TextBox2.Text;
        n.Modifier  = Session["teacherId"].ToString();
        sm.UpdateByTea(n);
        gridviewBind();
    }
Ejemplo n.º 15
0
        /// <summary>
        /// 删除学生作业
        /// </summary>
        /// <param name="n">学生作业实体类</param>
        /// <returns></returns>
        public bool Delete(stuHomework n)
        {
            bool flag = false;

            SqlParameter[] paras = new SqlParameter[]
            {
                new SqlParameter("@classId", n.ClassId),
                new SqlParameter("@times", n.Times),
                new SqlParameter("@studentId", n.StudentId),
            };
            int res = sqlhelper.ExecuteNonQuery("DELETE FROM stuHomework where classId=@classId AND times=@times AND studentId=@studentId", paras, CommandType.Text);

            if (res > 0)
            {
                flag = true;
            }
            return(flag);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 学生提交作业
        /// </summary>
        /// <param name="n">学生作业实体类</param>
        /// <returns></returns>
        public bool Insert(stuHomework n)
        {
            bool flag = false;

            SqlParameter[] paras = new SqlParameter[]
            {
                new SqlParameter("@classId", n.ClassId),
                new SqlParameter("@content", n.Content),
                new SqlParameter("@creater", n.Creater),
                new SqlParameter("@modifier", n.Creater),
                new SqlParameter("@studentId", n.StudentId),
                new SqlParameter("@times", n.Times),
            };
            int res = sqlhelper.ExecuteNonQuery("INSERT INTO stuHomework (classId, [content], creater, modifier, studentId, times) VALUES (@classId,@content,@creater,@creater,@studentId,@times)", paras, CommandType.Text);

            if (res > 0)
            {
                flag = true;
            }
            return(flag);
        }
Ejemplo n.º 17
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();
    }
 /// <summary>
 /// 学生更新作业
 /// </summary>
 /// <param name="n">学生作业实体类</param>
 /// <returns></returns>
 public void UpdateByStu(stuHomework n)
 {
     ndao.UpdateByStu(n);
 }
 /// <summary>
 /// 删除学生作业
 /// </summary>
 /// <param name="n">学生作业实体类</param>
 /// <returns></returns>
 public bool Delete(stuHomework n)
 {
     return(ndao.Delete(n));
 }
 /// <summary>
 /// 老师查看某班某次作业待批作业列表
 /// </summary>
 /// <param name="n">班级实体表</param>
 /// <returns></returns>
 public DataTable noreviewsbyclasstimes(stuHomework n)
 {
     return(ndao.noreviewsbyclasstimes(n));
 }
 /// <summary>
 /// 学生查看某一班级未交作业次数
 /// </summary>
 /// <param name="n">学生作业实体类</param>
 /// <returns></returns>
 public DataTable SelectCountByStu(stuHomework n)
 {
     return(ndao.SelectCountByStu(n));
 }
 /// <summary>
 /// 查看某一班级某一学生某一次作业是否已交
 /// </summary>
 /// <param name="n">学生作业实体类</param>
 /// <returns></returns>
 public DataTable Isexistence(stuHomework n)
 {
     return(ndao.Isexistence(n));
 }
 /// <summary>
 /// 学生提交作业
 /// </summary>
 /// <param name="n">学生作业实体类</param>
 /// <returns></returns>
 public bool Insert(stuHomework n)
 {
     return(ndao.Insert(n));
 }
 /// <summary>
 /// 学生查看已交全部作业
 /// </summary>
 /// <param name="n">学生作业实体类</param>
 /// <returns></returns>
 public DataTable SelectAll(stuHomework n)
 {
     return(ndao.SelectAll(n));
 }
 /// <summary>
 /// 教师更新作业
 /// </summary>
 /// <param name="n">学生作业实体类</param>
 /// <returns></returns>
 public void UpdateByTea(stuHomework n)
 {
     ndao.UpdateByTea(n);
 }
 /// <summary>
 /// 查看单一班级单一次数已交作业列表
 /// </summary>
 /// <param name="n">学生作业实体类</param>
 /// <returns></returns>
 public DataTable SelectByClass(stuHomework n)
 {
     return(ndao.SelectByClass(n));
 }