コード例 #1
0
    /// <summary>
    /// 学生作业信息数据绑定
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void RepeaterSAssmtInfo_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        //用到了用户控件中的SAssmtInfoListRow
        UserControl_SAssmtInfoListRow listRow = (UserControl_SAssmtInfoListRow)e.Item.FindControl("SAssmtInfoListRow1");
        //new 一个CompleteAssmtInfo并初始化
        CompleteAssmtInfo thisAssmt = new CompleteAssmtInfo();
        if (DataBinder.Eval(e.Item.DataItem, "submitTime") != DBNull.Value)
        {
            thisAssmt.StrClassName = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "className"));
            thisAssmt.IGroupNO = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "groupNO"));
            thisAssmt.DtSubmitTime = Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "submitTime"));
            thisAssmt.StrFileName = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "fileName"));
            thisAssmt.StrFileURL = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "fileURL"));
            thisAssmt.StrTeacherName = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "teacherName"));
            thisAssmt.StrScore = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "score"));
            if (thisAssmt.StrScore == "0")
                thisAssmt.StrScore = "未评分";

            int assmtID = Convert.ToInt32(HiddenField1.Value);
            int groupID = Convert.ToInt32(HiddenField2.Value);
            listRow.FileSize = CC.getAssmtFileSize(assmtID, groupID);
            HiddenField3.Value = thisAssmt.StrFileURL;

            listRow.Assmt = thisAssmt;

            lbIsSubmit.Text = "本组作业已上传";
            lbtUp.Text = "重新上传作业";
        }
        else
        {
            e.Item.Controls.Clear();
        }
    }
コード例 #2
0
    /// <summary>
    /// 学生作业列表的数据绑定
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void RepeaterSAssmtList_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        //用户控件的使用
        UserControl_SAssmtListRow listRow = (UserControl_SAssmtListRow)e.Item.FindControl("SAssmtListRow1");
        //new一个CompleteAssmtInfo对象
        CompleteAssmtInfo thisAssmt = new CompleteAssmtInfo();
        //判断提交状态
        if (DataBinder.Eval(e.Item.DataItem, "submitTime") != DBNull.Value)
        {
            //初始化
            thisAssmt.StrTitle = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "title"));
            thisAssmt.IAssignmentId = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "ID"));
            thisAssmt.DtAssignDate = Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "assignDate"));
            thisAssmt.DtDeadline = Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "deadline"));
            thisAssmt.StrFileName = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "fileName"));
            thisAssmt.DtSubmitTime = Convert.ToDateTime(DataBinder.Eval(e.Item.DataItem, "submitTime"));
            fileSize = CC.getAssmtFileSize(thisAssmt.IAssignmentId, Convert.ToInt32(HiddenField2.Value));

            listRow.Assmt = thisAssmt;
            listRow.Index = index1++;
            listRow.FileSize = fileSize;
        }
        else
        {
            e.Item.Controls.Clear();
        }
    }