Esempio n. 1
0
        public static string UpdateC(string Id)
        {
            try
            {
                Model_F_User loginUser = HttpContext.Current.Session["FLoginUser"] as Model_F_User;

                Id = Id.Filter();
                Model_HomeWork model = new Model_HomeWork();
                BLL_HomeWork   bll   = new BLL_HomeWork();
                model = bll.GetModel(Id);
                model.HomeWork_Status     = 0;
                model.HomeWork_FinishTime = null;

                if (loginUser.UserId != model.HomeWork_AssignTeacher)//当前登录用户和布置改作业的老师不一致
                {
                    return("");
                }
                else
                {
                    if (bll.Update(model))
                    {
                        return("1");
                    }
                    else
                    {
                        return("");
                    }
                }
            }
            catch (Exception)
            {
                return("");
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HomeWork_Id         = Request["HomeWork_Id"].Filter();
            Student_HomeWork_Id = Request["Student_HomeWork_Id"].Filter();
            StudentId           = Request["StudentId"].Filter();
            if (!IsPostBack)
            {
                try
                {
                    Model_HomeWork model = new Model_HomeWork();
                    model = new BLL_HomeWork().GetModel(HomeWork_Id);
                    if (model != null)
                    {
                        ResourceToResourceFolder_Id = model.ResourceToResourceFolder_Id;
                    }
                    #region 读取连接link
                    if (string.IsNullOrEmpty(Student_HomeWork_Id))//web端批改
                    {
                        link += string.Format("<li><a href='../student/OHomeWorkViewTTNew.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}'>批改详情</a></li><li><li><a href='../Evaluation/StudentAnalysisReportsNew.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}'>答题分析</a></li><li  class='active'><a href='../Evaluation/StudentErrorAnalysis.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}'>错题分析</a></li><li><a href='../Evaluation/StudentRemedyScheme.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}'>补救方案</a></li>", ResourceToResourceFolder_Id, HomeWork_Id, StudentId);
                    }
                    else//客户端批改
                    {
                        link += string.Format(@"<li><a href='../student/ohomeworkview_clientNew.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}&Student_HomeWork_Id={3}'>批改详情</a></li><li><a href='../Evaluation/StudentAnalysisReportsNew.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}&Student_HomeWork_Id={3}'>答题分析</a></li><li  class='active'><a href='../Evaluation/StudentErrorAnalysis.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}&Student_HomeWork_Id={3}'>错题分析</a></li><li><a href='../Evaluation/StudentRemedyScheme.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}&Student_HomeWork_Id={3}'>补救方案</a></li>"
                                              , ResourceToResourceFolder_Id
                                              , HomeWork_Id
                                              , StudentId
                                              , Student_HomeWork_Id);
                    }
                    #endregion
                    #region 读取作业基本信息
                    DataTable dtw = new DataTable();
                    dtw = Rc.Common.DBUtility.DbHelperSQL.Query(string.Format(@"select hw.*
,vw.GradeName,vw.GradeId,vw.ClassId,vw.ClassName
,u.UserName,u.TrueName
,HWScore=(select SUM(TestQuestions_Score) from TestQuestions_Score where TestQuestions_Score!=-1 and ResourceToResourceFolder_Id=hw.ResourceToResourceFolder_Id)
,StudentScore=(select SUM(Student_Score) from Student_HomeWorkAnswer where Student_Id='{0}' and HomeWork_Id=hw.HomeWork_Id )
,shwCorrect.Student_HomeWork_CorrectStatus
from HomeWork hw 
inner join Student_HomeWork shw on shw.Student_Id='{0}' and shw.HomeWork_Id=hw.HomeWork_Id 
inner join Student_HomeWork_Correct shwCorrect on shwCorrect.Student_HomeWork_Id=shw.Student_HomeWork_Id 
inner join F_User u on u.UserId=shw.Student_Id
left join VW_ClassGradeSchool vw on vw.ClassId=hw.UserGroup_Id and vw.GradeId!=''
where hw.HomeWork_Id='{1}'"
                                                                              , StudentId, HomeWork_Id)).Tables[0];
                    this.Title               = dtw.Rows[0]["HomeWork_Name"].ToString();
                    this.ltlHwName.Text      = dtw.Rows[0]["HomeWork_Name"].ToString();
                    this.ltlClassName.Text   = dtw.Rows[0]["ClassName"].ToString();
                    this.ltlGradeName.Text   = dtw.Rows[0]["GradeName"].ToString();
                    this.ltlSundentName.Text = string.IsNullOrEmpty(dtw.Rows[0]["TrueName"].ToString()) ? dtw.Rows[0]["UserName"].ToString() : dtw.Rows[0]["TrueName"].ToString();
                    this.ltlHwSorce.Text     = dtw.Rows[0]["HWScore"].ToString().clearLastZero();
                    this.ltlStuScorce.Text   = dtw.Rows[0]["StudentScore"].ToString().clearLastZero();
                    #endregion
                }
                catch (Exception)
                {
                    Response.Write("页面加载失败...");
                    Response.End();
                }
            }
        }
Esempio n. 3
0
        public static string UpdateHomeWork(string HomeWorkID, string CorrectMode)
        {
            try
            {
                HomeWorkID  = HomeWorkID.Filter();
                CorrectMode = CorrectMode.Filter();
                Model_HomeWork model = new Model_HomeWork();

                BLL_HomeWork bll = new BLL_HomeWork();
                model             = bll.GetModel(HomeWorkID);
                model.CorrectMode = CorrectMode;
                if (bll.UpdateCorrectMode(model) > 0)
                {
                    return("1");
                }
                else
                {
                    return("");
                }
            }
            catch (Exception)
            {
                return("");
            }
        }
Esempio n. 4
0
        public static string GetHomework(string GroupId, string StudentId, string DateType, string DateValue, int PageSize, int PageIndex)
        {
            try
            {
                GroupId = GroupId.Filter();

                DataTable     dtCHW      = new DataTable();
                List <object> listReturn = new List <object>();
                string        strSql     = string.Empty;
                string        strWhereC  = string.Empty;
                string        strWhere   = string.Empty;
                strWhere += string.Format(" UserGroup_Id='{1}' ", GroupId);
                int          inum        = 0;
                BLL_HomeWork bll         = new BLL_HomeWork();
                DataTable    dt          = bll.GetListForStatisticsByPage(strWhere, "CreateTime desc", (PageIndex - 1) * PageSize + 1, PageIndex * PageSize).Tables[0];
                int          recordCount = bll.GetListForStatisticsRecordcount(strWhere);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    inum++;
                    int studentCount = Convert.ToInt32(dt.Rows[i]["StudentCount"]);
                    int submitCount  = Convert.ToInt32(dt.Rows[i]["SubmitCount"]);
                    listReturn.Add(new
                    {
                        HomeWork_Id = dt.Rows[i]["HomeWork_Id"],
                        ResourceToResourceFolder_Id = dt.Rows[i]["ResourceToResourceFolder_Id"],
                        HomeWork_Name = dt.Rows[i]["HomeWork_Name"],
                        UserGroup_Id  = dt.Rows[i]["UserGroup_Id"],
                        HomeworkCount = dt.Rows[i]["HomeworkCount"],
                        StudentCount  = dt.Rows[i]["StudentCount"],
                        SubmitCount   = dt.Rows[i]["SubmitCount"],
                        SubmitRate    = ((submitCount / studentCount) * 100).ToString("0.00")
                    });
                }
                if (inum > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = PageIndex,
                        PageSize = PageSize,
                        TotalCount = recordCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = "error"//ex.Message.ToString()
                }));
            }
        }
Esempio n. 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ResourceToResourceFolderId = Request.QueryString["ResourceToResourceFolderId"].Filter();
     classId = Request.QueryString["classId"].Filter();
     if (!IsPostBack)
     {
         if (!string.IsNullOrEmpty(ResourceToResourceFolderId))
         {
             DataTable dtHW = new BLL_HomeWork().GetListForTeacherView("UserGroup_Id='" + classId + "' and ResourceToResourceFolder_Id='" + ResourceToResourceFolderId + "'", "").Tables[0];
             rptHW.DataSource = dtHW;
             rptHW.DataBind();
         }
     }
 }
Esempio n. 6
0
 protected void btnComment_Click(object sender, EventArgs e)
 {
     try
     {
         Model_HomeWork modelHW = new BLL_HomeWork().GetModel(hwId);
         Response.Redirect("CheckCommentStatsHelper.aspx?ResourceToResourceFolder_Id=" + modelHW.ResourceToResourceFolder_Id
                           + "&HomeWork_Name=" + modelHW.HomeWork_Name
                           + "&HomeWork_Id=" + modelHW.HomeWork_Id, true);
     }
     catch (Exception)
     {
         ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>function(){layer.msg('数据加载失败!',{ time: 0,icon:2});</script>");
         return;
     }
 }
Esempio n. 7
0
        public static string UpdateS(string Id)
        {
            try
            {
                Model_F_User loginUser = HttpContext.Current.Session["FLoginUser"] as Model_F_User;

                Id = Id.Filter();
                Model_HomeWork model = new Model_HomeWork();
                BLL_HomeWork   bll   = new BLL_HomeWork();
                model = bll.GetModel(Id);
                model.HomeWork_Status     = 1;
                model.HomeWork_FinishTime = DateTime.Now;

                if (loginUser.UserId != model.HomeWork_AssignTeacher)//当前登录用户和布置改作业的老师不一致
                {
                    return("");
                }
                else
                {
                    if (bll.Update(model))
                    {
                        //#region 执行数据分析,记录日志

                        //Model_StatsLog modelLog = new Model_StatsLog();
                        //modelLog.StatsLogId = Guid.NewGuid().ToString();
                        //modelLog.DataId = model.HomeWork_Id;
                        //modelLog.DataName = model.HomeWork_Name;
                        //modelLog.DataType = "1";
                        //modelLog.LogStatus = "2";
                        //modelLog.CTime = DateTime.Now;
                        //modelLog.CUser = loginUser.UserId;

                        //new BLL_StatsLog().ExecuteStatsAddLog(modelLog);
                        //#endregion

                        return("1");
                    }
                    else
                    {
                        return("");
                    }
                }
            }
            catch (Exception)
            {
                return("");
            }
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                hwId = Request["hwId"].Filter();
                Model_HomeWork modelHW = new BLL_HomeWork().GetModel(hwId);
                strEndTime = modelHW.CreateTime.ToString();
                int.TryParse(modelHW.isTimeLength.ToString(), out intTimeLength);
                isCountdown = modelHW.IsCountdown;
                if (modelHW == null)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>function(){layer.msg('作业数据不存在或已删除!',{ time: 0,icon:2});</script>");
                    return;
                }
                DataTable dt = new BLL_Student_HomeWork().GetHWStuCount(hwId).Tables[0];
                if (dt.Rows.Count == 1)
                {
                    ltlStu_Assign.Text      = string.Format("共{0}位同学", dt.Rows[0]["AssignedCount"]);
                    ltlStu_Committed.Text   = string.Format("已交{0}位同学", dt.Rows[0]["CommittedCount"]);
                    ltlStu_UnCommitted.Text = string.Format("未交{0}位同学", dt.Rows[0]["UnCommittedCount"]);
                    if (Convert.ToInt16(dt.Rows[0]["CommittedCount"]) == 0)
                    {
                        btnComment.Attributes.Add("disabled", "disabled");
                    }
                }

                string strSql = string.Format(@"select shw.Student_Id,shws.Student_HomeWork_Status
,(CASE WHEN U.TrueName IS NULL THEN U.UserName WHEN U.TrueName = '' THEN U.UserName ELSE U.TrueName END) AS StuName 
from Student_HomeWork shw 
inner join F_User AS U on shw.Student_Id = U.UserId 
inner join Student_HomeWork_Submit shws on shws.Student_HomeWork_Id=shw.Student_HomeWork_Id and Student_HomeWork_Status='1'
where shw.HomeWork_Id='{0}' order by shws.Student_Answer_Time ", hwId);
                rptStu.DataSource = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                rptStu.DataBind();
            }
            catch (Exception)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>function(){layer.msg('数据加载失败!',{ time: 0,icon:2});</script>");
                return;
            }
        }
Esempio n. 9
0
        private void LoadData()
        {
            Model_HomeWork hwmodel = new Model_HomeWork();
            BLL_HomeWork   hwbll   = new BLL_HomeWork();

            hwmodel = hwbll.GetModel(HomeWork_Id);
            this.txtStopTime.Text = pfunction.ConvertToLongerDateTime(hwmodel.StopTime.ToString());
            //this.txtBeginTime.Text = pfunction.ConvertToLongerDateTime(hwmodel.BeginTime.ToString());
            string txtTimeLength = hwmodel.isTimeLength.ToString();

            string strWhere = string.Format(" User_ApplicationStatus='passed' and UserStatus='0' and UserGroup_Id='{0}' and MembershipEnum='{1}' ", classId, MembershipEnum.student);

            rptStudentList.DataSource = new BLL_UserGroup_Member().GetClassMemberListEX(strWhere, HomeWork_Id, "HomeWork_Id,TrueName").Tables[0];
            rptStudentList.DataBind();


            Model_UserGroup modelUserGroup = new BLL_UserGroup().GetModel(classId);

            if (modelUserGroup != null)
            {
                className = modelUserGroup.UserGroup_Name;
            }
        }
Esempio n. 10
0
        public static string CheckCalculation(string hwId, string hwName)
        {
            try
            {
                DataTable dtHWDetail = new BLL_HomeWork().GetHWDetail(hwId).Tables[0];
                //System.Threading.Thread.Sleep(10000);
                hwId   = hwId.Filter();
                hwName = hwName.Filter();
                Model_F_User loginUser = HttpContext.Current.Session["FLoginUser"] as Model_F_User;
                #region  作业HomeWork 执行数据分析,记录日志
                Model_StatsLog modelLog = new Model_StatsLog();
                modelLog.StatsLogId = Guid.NewGuid().ToString();
                modelLog.DataId     = hwId;
                modelLog.DataName   = hwName;
                modelLog.DataType   = "1";
                modelLog.LogStatus  = "2";
                modelLog.CTime      = DateTime.Now;
                modelLog.CUser      = loginUser.UserId;
                modelLog.GradeId    = dtHWDetail.Rows[0]["GradeId"].ToString();

                bool flag = new BLL_StatsLog().ExecuteStatsAddLog(modelLog);
                #endregion
                if (flag)
                {
                    return("1");
                }
                else
                {
                    return("0");
                }
            }
            catch (Exception ex)
            {
                new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS("", "计算失败:" + ex.Message.ToString());
                return("0");
            }
        }
Esempio n. 11
0
        public static string GetCorrectHomework(string ClassId)
        {
            try
            {
                ClassId = ClassId.Filter();

                DataTable     dtCHW      = new DataTable();
                List <object> listReturn = new List <object>();
                string        strSql     = string.Empty;
                string        strWhereC  = string.Empty;
                string        strWhere   = string.Empty;

                string SqlMTJ = @"
select  COUNT(*) as MTJ,shw.HomeWork_Id from Student_HomeWork shw 
inner join HomeWork hw on hw.HomeWork_Id=shw.HomeWork_Id 
inner join Student_HomeWork_Submit shwSubmit on shwSubmit.Student_HomeWork_Id=shw.Student_HomeWork_Id and shwSubmit.Student_HomeWork_Status=1 
inner join Student_HomeWork_Correct shwCorrect on shwCorrect.Student_HomeWork_Id=shw.Student_HomeWork_Id and shwCorrect.Student_HomeWork_CorrectStatus=0 
where  hw.UserGroup_Id='" + ClassId + "' group by shw.HomeWork_Id ";

                DataTable    dtMTJ      = Rc.Common.DBUtility.DbHelperSQL.Query(SqlMTJ).Tables[0];
                Model_F_User modelFUser = (Model_F_User)HttpContext.Current.Session["FLoginUser"];
                string       userId     = modelFUser.UserId;

                strWhere += string.Format(" and UserGroup_Id='{0}' and HomeWork_AssignTeacher='{1}' ", ClassId, userId);
                int inum = 0;
                Model_PagerInfo <List <Model_HomeWork> > pageInfo = new BLL_HomeWork().SearhList(strWhere, "CreateTime DESC", 1, 1000);
                List <Model_HomeWork> list = pageInfo.PageData;
                foreach (var item in list)
                {
                    DataRow[] drMTJ = dtMTJ.Select("HomeWork_Id='" + item.HomeWork_Id + "'");
                    inum++;
                    DateTime stopTime = DateTime.Now;
                    DateTime.TryParse(item.StopTime.ToString(), out stopTime);
                    listReturn.Add(new
                    {
                        HomeWork_Id            = item.HomeWork_Id,
                        HomeWork_Name          = item.HomeWork_Name,
                        HomeWork_AssignTeacher = item.HomeWork_AssignTeacher,
                        HomeWork_FinishTime    = item.HomeWork_FinishTime,
                        HomeWork_Status        = item.HomeWork_Status,
                        CreateTime             = pfunction.ConvertToLongDateTime(item.CreateTime.ToString(), "yyyy-MM-dd"),
                        UserGroup_Id           = item.UserGroup_Id,
                        IsCorrect = item.HomeWork_Status == 1 ? "no" : "yes",//作业已标记完成,不允许批改
                        IsUpdate  = (stopTime > DateTime.Now || string.IsNullOrEmpty(item.CorrectMode)) ? "no" : "yes",

                        StudentCountMTJ = drMTJ.Length > 0 ? drMTJ[0]["MTJ"] : "0" // 未批人数
                    });
                }
                if (inum > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = pageInfo.CurrentPage,
                        PageSize = pageInfo.PageSize,
                        TotalCount = pageInfo.RecordCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = "error"//ex.Message.ToString()
                }));
            }
        }
Esempio n. 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HomeWork_Id         = Request["HomeWork_Id"].Filter();
            Student_HomeWork_Id = Request["Student_HomeWork_Id"].Filter();
            StudentId           = Request["StudentId"].Filter();
            if (!IsPostBack)
            {
                Model_HomeWork model = new Model_HomeWork();
                model = new BLL_HomeWork().GetModel(HomeWork_Id);
                if (model != null)
                {
                    ResourceToResourceFolder_Id = model.ResourceToResourceFolder_Id;
                }
                #region 读取连接link
                if (string.IsNullOrEmpty(Student_HomeWork_Id))//web端批改
                {
                    link += string.Format("<li><a href='../student/OHomeWorkViewTTNew.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}'>批改详情</a></li><li><li><a href='../Evaluation/StudentAnalysisReportsNew.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}'>答题分析</a></li><li><a href='../Evaluation/StudentErrorAnalysis.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}'>错题分析</a></li><li  class='active'><a href='../Evaluation/StudentRemedyScheme.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}'>补救方案</a></li>", ResourceToResourceFolder_Id, HomeWork_Id, StudentId);
                }
                else//客户端批改
                {
                    link += string.Format(@"<li><a href='../student/ohomeworkview_clientNew.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}&Student_HomeWork_Id={3}'>批改详情</a></li><li><a href='../Evaluation/StudentAnalysisReportsNew.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}&Student_HomeWork_Id={3}'>答题分析</a></li><li><a href='../Evaluation/StudentErrorAnalysis.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}&Student_HomeWork_Id={3}'>错题分析</a></li><li  class='active'><a href='../Evaluation/StudentRemedyScheme.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}&Student_HomeWork_Id={3}'>补救方案</a></li>"
                                          , ResourceToResourceFolder_Id
                                          , HomeWork_Id
                                          , StudentId
                                          , Student_HomeWork_Id);
                }
                #endregion
                #region 读取作业基本信息
                DataTable dtw = new DataTable();
                dtw = Rc.Common.DBUtility.DbHelperSQL.Query(string.Format(@"select hw.*
,vw.GradeName,vw.GradeId,vw.ClassId,vw.ClassName
,u.UserName,u.TrueName
,HWScore=(select SUM(TestQuestions_Score) from TestQuestions_Score where TestQuestions_Score!=-1 and ResourceToResourceFolder_Id=hw.ResourceToResourceFolder_Id)
,StudentScore=(select SUM(Student_Score) from Student_HomeWorkAnswer where Student_Id='{0}' and HomeWork_Id=hw.HomeWork_Id )
,shwCorrect.Student_HomeWork_CorrectStatus
from HomeWork hw 
inner join Student_HomeWork shw on shw.Student_Id='{0}' and shw.HomeWork_Id=hw.HomeWork_Id 
inner join Student_HomeWork_Correct shwCorrect on shwCorrect.Student_HomeWork_Id=shw.Student_HomeWork_Id 
inner join F_User u on u.UserId=shw.Student_Id
left join VW_ClassGradeSchool vw on vw.ClassId=hw.UserGroup_Id and vw.GradeId!=''
where hw.HomeWork_Id='{1}'"
                                                                          , StudentId, HomeWork_Id)).Tables[0];
                this.Title               = dtw.Rows[0]["HomeWork_Name"].ToString();
                this.ltlHwName.Text      = dtw.Rows[0]["HomeWork_Name"].ToString();
                this.ltlClassName.Text   = dtw.Rows[0]["ClassName"].ToString();
                this.ltlGradeName.Text   = dtw.Rows[0]["GradeName"].ToString();
                this.ltlSundentName.Text = string.IsNullOrEmpty(dtw.Rows[0]["TrueName"].ToString()) ? dtw.Rows[0]["UserName"].ToString() : dtw.Rows[0]["TrueName"].ToString();
                this.ltlHwSorce.Text     = dtw.Rows[0]["HWScore"].ToString().clearLastZero();
                this.ltlStuScorce.Text   = dtw.Rows[0]["StudentScore"].ToString().clearLastZero();
                #endregion
                #region 数据分析
                string sql = string.Format(@" select  KPNameBasic=(select KPNameBasic+',' from [dbo].[StatsStuHW_Wrong_KP] where HomeWork_Id='{0}' and Student_Id='{1}' FOR XML PATH('') )
,CountKPNameBasic=(select count(*) from [dbo].[StatsStuHW_Wrong_KP] where HomeWork_Id='{0}' and Student_Id='{1}' )
,CountTQ=(select count(*) from [dbo].[StatsStuHW_Wrong_TQ] where HomeWork_Id='{0}' and Student_Id='{1}' )
,topicNumber=(select replace(topicNumber,'.','')+'题,' from [dbo].[StatsStuHW_Wrong_TQ]  where HomeWork_Id='{0}' and Student_Id='{1}' group by topicNumber,TestQuestions_Num order by TestQuestions_Num FOR XML PATH('') )"
                                           , HomeWork_Id
                                           , StudentId);
                DataTable Dt = Rc.Common.DBUtility.DbHelperSQL.Query(sql).Tables[0];
                if (Dt.Rows.Count > 0)
                {
                    ltlKPName.Text      = Dt.Rows[0]["KPNameBasic"].ToString().TrimEnd(',');
                    ltlCountKPName.Text = Dt.Rows[0]["CountKPNameBasic"].ToString();
                    ltlTQNum.Text       = string.IsNullOrEmpty(Dt.Rows[0]["topicNumber"].ToString().TrimEnd(',')) ? "" : "请该同学对本次作业中的" + Dt.Rows[0]["topicNumber"].ToString().TrimEnd(',') + "进行再次练习,以便从中总结规律、方法、技巧,巩固对知识点的学习。";
                    //ltlCountTQ.Text = Dt.Rows[0]["CountTQ"].ToString().clearLastZero();
                }
                #endregion
            }
        }
Esempio n. 13
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string strHomeWork_Id = Guid.NewGuid().ToString();

            try
            {
                Rc.Common.SystemLog.SystemLog.AddLogFromBS(FloginUser.UserId, "", "布置作业:1开始验证");
                // 学校公网IP
                string hostUrl = pfunction.GetResourceHost2("TestWebSiteUrl");
                #region 验证
                DataTable dtHWDetail = Rc.Common.DBUtility.DbHelperSQL.Query("select * from VW_ClassGradeSchool where ClassId='" + classId + "' and GradeId is not null and SchoolId is not null ").Tables[0];
                if (dtHWDetail.Rows.Count == 0)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.msg('加入年级后才可布置作业',{time:2000,icon:2});", true);
                    return;
                }
                BLL_HomeWork bll = new BLL_HomeWork();
                if (bll.GetRecordCount("ResourceToResourceFolder_Id='" + rtrId + "' and HomeWork_AssignTeacher='" + FloginUser.UserId + "' and UserGroup_Id='" + classId + "' ") > 0)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.msg('该作业已被布置',{time:2000,icon:2},function(){window.parent.location.reload();parent.layer.close(parent.layer.getFrameIndex(window.name));});", true);
                    return;
                }

                if (new BLL_UserGroup_Member().GetRecordCount("UserStatus='0' and User_Id='" + FloginUser.UserId + "' and UserGroup_Id='" + classId + "' ") == 0)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.msg('老师与所布置作业班级关系错误',{time:2000,icon:2},function(){window.parent.location.reload();parent.layer.close(parent.layer.getFrameIndex(window.name));});", true);
                    return;
                }

                Model_ResourceToResourceFolder modelRTRF = new BLL_ResourceToResourceFolder().GetModel(rtrId);

                if (modelRTRF.Resource_Class == Rc.Common.Config.Resource_ClassConst.自有资源)
                {
                    if (modelRTRF.Resource_Type != Resource_TypeConst.集体备课文件 && modelRTRF.CreateFUser != FloginUser.UserId)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.msg('此资源不是您的',{time:2000,icon:2},function(){window.parent.location.reload();parent.layer.close(parent.layer.getFrameIndex(window.name));});", true);
                        return;
                    }
                }
                else if (modelRTRF.Resource_Class == Rc.Common.Config.Resource_ClassConst.云资源)
                {
                    if (new BLL_UserBuyResources().GetRecordCount("UserId='" + FloginUser.UserId + "' and Book_Id='" + modelRTRF.Book_ID + "' ") == 0)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.msg('老师还未购买此资源',{time:2000,icon:2},function(){window.parent.location.reload();parent.layer.close(parent.layer.getFrameIndex(window.name));});", true);
                        return;
                    }
                }
                if (pfunction.FilterKeyWords(this.txtHomeWork_Name.Text))
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('作业名称存在敏感词汇,请重新填写。',{icon:2,time:2000});</script>");
                    return;
                }
                //Rc.Common.SystemLog.SystemLog.AddLogFromBS(FloginUser.UserId, "", "布置作业:验证网络是否通畅" + hostUrl);
                ////检测网络是否通畅
                //if (RemotWeb.PostDataToServer(hostUrl + "/AuthApi/index.aspx?key=onlinecheck", "", Encoding.UTF8, "Get") != "ok")
                //{
                //    ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('服务器网络不通畅。',{icon:2,time:3000});</script>");
                //    return;
                //}
                #endregion
                Rc.Common.SystemLog.SystemLog.AddLogFromBS(FloginUser.UserId, "", "布置作业:1结束验证");

                Rc.Common.SystemLog.SystemLog.AddLogFromBS(FloginUser.UserId, "", "布置作业:2开始组织提交数据");
                #region 组织提交数据

                DateTime hw_time      = DateTime.Now;
                int      isTimeLength = 0;
                int.TryParse(txtTimeLength.Text, out isTimeLength);
                int isTimeLimt = 1;
                isTimeLimt = (hwType_1.Checked == true) ? 1 : 2;//作业类型:1=作业,2=考试
                DateTime BeginTime = DateTime.Parse(txtBeginTime.Text);
                DateTime StopTime  = DateTime.Now;
                if (isTimeLimt == 2)
                {
                    StopTime = DateTime.Parse(BeginTime.ToString()).AddMinutes(int.Parse(isTimeLength.ToString()));
                }
                else
                {
                    StopTime = Convert.ToDateTime(txtStopTime.Text);
                }
                string strStudent = Rc.Cloud.Web.Common.pfunction.CheckImp(hidStudentId.Value);
                strStudent = strStudent.TrimEnd(',');
                string SubjectId = FloginUser.Subject;
                if (modelRTRF != null && modelRTRF.Resource_Class == Rc.Common.Config.Resource_ClassConst.云资源)
                {
                    SubjectId = modelRTRF.Subject;
                }
                object objAssign = new
                {
                    stuInfo     = strStudent,
                    HomeWork_Id = strHomeWork_Id,
                    ResourceToResourceFolder_Id = rtrId,
                    HomeWork_Name          = txtHomeWork_Name.Text,
                    HomeWork_AssignTeacher = FloginUser.UserId,
                    BeginTime       = BeginTime,
                    StopTime        = StopTime,
                    IsHide          = chkIsHide.Checked ? 1 : 0,
                    HomeWork_Status = 0,
                    CreateTime      = hw_time,
                    UserGroup_Id    = classId,
                    isTimeLimt      = isTimeLimt,
                    isTimeLength    = isTimeLength,
                    SubjectId       = SubjectId,
                    IsShowAnswer    = (chkIsShowAnswer.Checked == true) ? 1 : 0
                };
                #endregion
                Rc.Common.SystemLog.SystemLog.AddLogFromBS(FloginUser.UserId, "", "布置作业:2结束组织提交数据");

                Rc.Common.SystemLog.SystemLog.AddLogFromBS(FloginUser.UserId, "", "布置作业:3开始提交到学校服务器");

                hostUrl += "teacher/tchAssignHW.aspx";
                string result = Rc.Common.RemotWeb.PostDataToServer(hostUrl, JsonConvert.SerializeObject(objAssign), System.Text.Encoding.UTF8, "POST");
                Rc.Common.SystemLog.SystemLog.AddLogFromBS(FloginUser.UserId, "", "布置作业:3结束提交到学校服务器");
                if (result == "ok")
                {
                    string strJ = "layer.msg('布置作业成功" + result + "',{time:1000,icon:1},function(){";
                    if (Request.QueryString["tp"] != "1")
                    {
                        strJ += "window.parent.loadData();";
                    }
                    else
                    {
                        strJ += "window.parent.location.reload();";
                    }
                    strJ += "parent.layer.close(parent.layer.getFrameIndex(window.name));});";
                    Rc.Common.SystemLog.SystemLog.AddLogFromBS(FloginUser.UserId, "", "布置作业成功" + result);
                    ClientScript.RegisterStartupScript(this.GetType(), "temp", strJ, true);
                }
                else
                {
                    //RevokeHW 布置作业失败 撤销作业
                    new BLL_HomeWork().RevokeHW(strHomeWork_Id);
                    Rc.Common.SystemLog.SystemLog.AddLogErrorFromBS(FloginUser.UserId, "", "布置作业失败:学校未布置成功" + result + "; 。");
                    ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.msg('布置作业失败',{time:2000,icon:2});", true);
                }
            }
            catch (Exception ex)
            {
                //RevokeHW 布置作业失败 撤销作业
                new BLL_HomeWork().RevokeHW(strHomeWork_Id);
                Rc.Common.SystemLog.SystemLog.AddLogErrorFromBS(FloginUser.UserId, "", "布置作业失败:" + ex.Message.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.msg('布置作业异常,请联系管理员',{time:2000,icon:2});", true);
            }
        }
Esempio n. 14
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                bool flag = false;
                Rc.Cloud.Model.Model_VSysUserRole loginUser = HttpContext.Current.Session["LoginUser"] as Rc.Cloud.Model.Model_VSysUserRole;
                if (ddlType.Value == "1")
                {
                    List <Model_HomeWork> listHW = new BLL_HomeWork().GetModelList("HomeWork_Status='1' and HomeWork_FinishTime between '"
                                                                                   + txtSTime.Text.Filter() + "' and '" + txtETime.Text.Filter() + "' ");
                    foreach (var item in listHW)
                    {
                        #region  日期 执行数据分析,记录日志
                        Model_StatsLog modelLog = new Model_StatsLog();
                        modelLog.StatsLogId = Guid.NewGuid().ToString();
                        modelLog.DataId     = item.HomeWork_Id;
                        modelLog.DataName   = item.HomeWork_Name;
                        modelLog.DataType   = "1";
                        modelLog.LogStatus  = "2";
                        modelLog.CTime      = DateTime.Now;
                        modelLog.CUser      = loginUser.SysUser_ID;

                        flag = new BLL_StatsLog().ExecuteStatsAddLog(modelLog);
                        #endregion
                    }
                }
                else
                {
                    string rtrfId = hidtxtRTRFName.Value.Trim().Filter();
                    if (string.IsNullOrEmpty(rtrfId))
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('请选择试卷名称!',{ time: 2000,icon:2},function(){});</script>");
                        return;
                    }
                    else
                    {
                        #region  试卷 执行数据分析,记录日志
                        Model_ResourceToResourceFolder modelRTRF = new BLL_ResourceToResourceFolder().GetModel(rtrfId);
                        Model_StatsLog modelLog = new Model_StatsLog();
                        modelLog.StatsLogId = Guid.NewGuid().ToString();
                        modelLog.DataId     = modelRTRF.ResourceToResourceFolder_Id;
                        modelLog.DataName   = txtRTRFName.Value;
                        modelLog.DataType   = "2";
                        modelLog.LogStatus  = "2";
                        modelLog.CTime      = DateTime.Now;
                        modelLog.CUser      = loginUser.SysUser_ID;

                        flag = new BLL_StatsLog().ExecuteStatsAddLog(modelLog);
                        #endregion
                    }
                }
                if (flag)
                {
                    new Rc.Cloud.BLL.BLL_clsAuth().AddLogFromBS("10255000", "手动执行统计成功");
                    ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('执行统计成功!',{ time: 2000,icon:1},function(){parent.loadData();parent.layer.close(index);});</script>");
                }
                else
                {
                    new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS("10255000", "手动执行统计失败:执行SQL异常");
                    ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('执行统计失败!',{ time: 2000,icon:2},function(){parent.loadData();parent.layer.close(index);});</script>");
                }
            }
            catch (Exception ex)
            {
                new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS("10255000", "手动执行统计失败:" + ex.Message.ToString());
                ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('执行统计失败!',{ time: 2000,icon:2},function(){parent.loadData();parent.layer.close(index);});</script>");
            }
        }
Esempio n. 15
0
        /// <summary>
        /// 生成学生作业txt 17-07-17TS
        /// </summary>
        private bool GenerateTestPaperFileForStudent(string tchId, string HomeWork_Id)
        {
            bool flag = false;

            try
            {
                Rc.Common.SystemLog.SystemLog.AddLogFromBS(tchId, "", "布置作业(学校服务器):5开始组织试题");
                string uploadPath        = Server.MapPath("/Upload/Resource/");                     //存储文件基础路径
                string strTestWebSiteUrl = ConfigHelper.GetConfigString("StudentAnswerWebSiteUrl"); //学校局域网地址
                string hosturl           = pfunction.getHostPath();
                ////检测网络是否通畅
                //if (RemotWeb.PostDataToServer(strTestWebSiteUrl + "/AuthApi/index.aspx?key=onlinecheck", "", Encoding.UTF8, "Get") != "ok")
                //{
                //    Rc.Common.SystemLog.SystemLog.AddLogFromBS(tchId, "", "布置作业(学校服务器):网络不通畅-" + strTestWebSiteUrl +"访问者URL:"+ hosturl);
                //    flag = false;
                //    return flag;
                //}
                Model_HomeWork modelHW          = new BLL_HomeWork().GetModel(HomeWork_Id);
                string         rtrfId           = modelHW.ResourceToResourceFolder_Id;
                string         strHomeWork_Name = modelHW.HomeWork_Name;
                int            isTimeLimt       = 0;
                int            isTimeLength     = 0;
                bool           isShowAnswer     = false;
                int.TryParse(modelHW.isTimeLimt.ToString(), out isTimeLimt);
                int.TryParse(modelHW.isTimeLength.ToString(), out isTimeLength);
                if (modelHW.IsShowAnswer == 1)
                {
                    isShowAnswer = true;
                }
                string        filePath        = pfunction.ToShortDate(modelHW.CreateTime.ToString()) + "\\" + HomeWork_Id + ".txt";
                string        filePathForTch  = pfunction.ToShortDate(modelHW.CreateTime.ToString()) + "\\" + HomeWork_Id + ".tch.txt";
                List <object> listTQObjForTch = new List <object>();    //老师客户端批改
                List <object> listTQObj       = new List <object>();    //学生客户端答题

                List <object> listTQObjForTchBig = new List <object>(); //老师客户端批改
                List <object> listTQObjBig       = new List <object>(); //学生客户端答题

                Model_ResourceToResourceFolder modelRTRF = new BLL_ResourceToResourceFolder().GetModel(rtrfId);

                #region 试题
                //试题数据
                string    strSqlTQ = string.Format(@"select  t1.TestQuestions_Id,t1.TestQuestions_Num,t1.TestQuestions_Type,t1.Parent_Id,t1.[type],t1.topicNumber
,T2.Resource_Version,T2.GradeTerm,t2.Subject,t2.ParticularYear,t2.Resource_Class,t2.CreateTime,t2.LessonPlan_Type
FROM TestQuestions t1 inner join ResourceToResourceFolder t2 ON t1.ResourceToResourceFolder_ID=T2.ResourceToResourceFolder_ID 
where  t1.ResourceToResourceFolder_Id='{0}' order by TestQuestions_Num ", rtrfId);
                DataTable dtTQ     = Rc.Common.DBUtility.DbHelperSQL.Query(strSqlTQ).Tables[0];

                //获取这个试卷的所有试题分值
                string strSqlScore = string.Empty;
                strSqlScore = string.Format(@"select  [TestQuestions_Score_ID]
      ,[ResourceToResourceFolder_Id]
      ,[TestQuestions_Id]
      ,[TestCorrect]
      ,[AnalyzeHyperlinkData]
      ,[TrainHyperlinkData]
      ,[TestType]
      ,[ScoreText],[testIndex],[TestType]
,TestQuestions_OrderNum FROM TestQuestions_Score where ResourceToResourceFolder_Id='{0}' order by TestQuestions_OrderNum ", rtrfId);
                DataTable dtTQ_Score = Rc.Common.DBUtility.DbHelperSQL.Query(strSqlScore).Tables[0];

                #region 普通题型 list
                DataRow[] drList = dtTQ.Select("Parent_Id='' ", "TestQuestions_Num");
                foreach (DataRow item in drList)
                {
                    string savePath      = string.Empty;
                    string saveOwnerPath = string.Empty;
                    if (item["Resource_Class"].ToString() == Resource_ClassConst.云资源)
                    {
                        savePath = string.Format("{0}\\{1}\\{2}\\{3}\\", item["ParticularYear"].ToString(), item["GradeTerm"],
                                                 item["Resource_Version"].ToString(), item["Subject"].ToString());
                    }
                    if (item["Resource_Class"].ToString() == Resource_ClassConst.自有资源)
                    {
                        saveOwnerPath = string.Format("{0}\\", pfunction.ConvertToLongDateTime(item["CreateTime"].ToString(), "yyyy-MM-dd"));
                    }
                    DataRow   drTQ_S     = null;
                    DataRow[] drTQ_Score = dtTQ_Score.Select(string.Format("TestQuestions_ID='{0}'", item["TestQuestions_ID"].ToString()), "TestQuestions_OrderNum");

                    #region 试题分数
                    List <object> listTQ_SObjForTch = new List <object>(); //老师客户端批改
                    List <object> listTQ_SObj       = new List <object>(); //学生客户端答题
                    int           intIndex          = 0;
                    for (int j = 0; j < drTQ_Score.Length; j++)
                    {
                        drTQ_S = drTQ_Score[j];
                        string strAnalyzeUrl = string.Empty;
                        string strTrainUrl   = string.Empty;
                        if (!string.IsNullOrEmpty(drTQ_S["AnalyzeHyperlinkData"].ToString()))
                        {
                            strAnalyzeUrl = pfunction.GetAnalyzeTrainUrl(ConfigHelper.GetConfigString("StudentAnswerWebSiteUrl"), drTQ_S["AnalyzeHyperlinkData"].ToString());
                        }
                        if (!string.IsNullOrEmpty(drTQ_S["TrainHyperlinkData"].ToString()))
                        {
                            strTrainUrl = pfunction.GetAnalyzeTrainUrl(ConfigHelper.GetConfigString("StudentAnswerWebSiteUrl"), drTQ_S["TrainHyperlinkData"].ToString());
                        }
                        listTQ_SObj.Add(new
                        {
                            testScoreId = drTQ_S["TestQuestions_Score_ID"].ToString(),
                            testIndex   = drTQ_S["testIndex"].ToString(),
                            analyzeUrl  = strAnalyzeUrl,
                            trainUrl    = strTrainUrl
                        });

                        string strtestCorrectBase64 = string.Empty;
                        string strtestCorrect       = string.Empty;
                        switch (drTQ_Score[j]["TestType"].ToString())
                        {
                        case "selection":
                        case "clozeTest":
                        case "truefalse":
                            strtestCorrect = drTQ_Score[j]["TestCorrect"].ToString();
                            break;
                            //case "fill":
                            //case "answers":
                            //    strtestCorrectBase64 = pfunction.ReadAllText(uploadPath + saveOwnerPath + "testQuestionCurrent\\" + savePath + drTQ_Score[j]["TestQuestions_Score_ID"].ToString() + ".txt");
                            //    break;
                        }
                        listTQ_SObjForTch.Add(new
                        {
                            testScoreId = drTQ_S["TestQuestions_Score_ID"].ToString(),
                            testIndex   = drTQ_S["testIndex"].ToString(),
                            scoreText   = drTQ_Score[j]["ScoreText"].ToString(),
                            testCorrect = strtestCorrect
                        });
                    }
                    #endregion
                    string fileUrl = uploadPath + saveOwnerPath + "{0}\\" + savePath + "{1}.txt";//自有资源 savePath为空,云资源saveOwnerPath为空
                    if (drTQ_S != null)
                    {
                        string strtestQuestionBody = pfunction.ReadAllText(string.Format(fileUrl, "testQuestionBody", item["TestQuestions_Id"].ToString()));
                        string strtextTitle        = pfunction.ReadAllText(string.Format(fileUrl, "textTitle", item["TestQuestions_Id"].ToString()));
                        string strTopicNumber      = string.Empty;
                        if (item["LessonPlan_Type"].ToString() == LessonPlan_TypeConst.组卷)
                        {
                            strTopicNumber = item["topicNumber"].ToString();
                        }
                        listTQObj.Add(new
                        {
                            Testid      = item["TestQuestions_Id"],
                            testType    = item["TestQuestions_Type"],
                            topicNumber = strTopicNumber,
                            docBase64   = strtestQuestionBody,
                            textTitle   = strtextTitle,
                            list        = listTQ_SObj
                        });

                        if (drTQ_S["TestType"].ToString() == "selection" || drTQ_S["TestType"].ToString() == "clozeTest" || drTQ_S["TestType"].ToString() == "truefalse")
                        {
                            strtestQuestionBody = "";
                            strtextTitle        = "";
                        }
                        listTQObjForTch.Add(new
                        {
                            Testid      = item["TestQuestions_Id"],
                            testType    = item["TestQuestions_Type"],
                            topicNumber = strTopicNumber,
                            docBase64   = strtestQuestionBody,
                            textTitle   = strtextTitle,
                            list        = listTQ_SObjForTch
                        });
                    }
                    else
                    {
                        string strtestQuestionBody = pfunction.ReadAllText(string.Format(fileUrl, "testQuestionBody", item["TestQuestions_Id"].ToString()));
                        string strtextTitle        = pfunction.ReadAllText(string.Format(fileUrl, "textTitle", item["TestQuestions_Id"].ToString()));
                        string strTopicNumber      = string.Empty;
                        if (item["LessonPlan_Type"].ToString() == LessonPlan_TypeConst.组卷)
                        {
                            strTopicNumber = item["topicNumber"].ToString();
                        }
                        listTQObj.Add(new
                        {
                            Testid      = item["TestQuestions_Id"],
                            testType    = item["TestQuestions_Type"],
                            topicNumber = strTopicNumber,
                            docBase64   = strtestQuestionBody,
                            textTitle   = strtextTitle,
                            list        = ""
                        });

                        listTQObjForTch.Add(new
                        {
                            Testid      = item["TestQuestions_Id"],
                            testType    = item["TestQuestions_Type"],
                            topicNumber = strTopicNumber,
                            docBase64   = strtestQuestionBody,
                            textTitle   = strtextTitle,
                            list        = listTQ_SObjForTch
                        });
                    }
                }
                #endregion
                #region 综合题型 listBig
                DataRow[] drListBig = dtTQ.Select("Parent_Id='0' ", "TestQuestions_Num");
                foreach (DataRow item in drListBig)
                {
                    List <object> listTQObjForTchBig_Sub = new List <object>();
                    List <object> listTQObjBig_Sub       = new List <object>();
                    DataRow[]     drBig_Sub = dtTQ.Select("Parent_Id='" + item["TestQuestions_Id"] + "'", "TestQuestions_Num");
                    foreach (DataRow itemSub in drBig_Sub)
                    {
                        string savePath      = string.Empty;
                        string saveOwnerPath = string.Empty;
                        if (itemSub["Resource_Class"].ToString() == Resource_ClassConst.云资源)
                        {
                            savePath = string.Format("{0}\\{1}\\{2}\\{3}\\", itemSub["ParticularYear"].ToString(), itemSub["GradeTerm"],
                                                     itemSub["Resource_Version"].ToString(), itemSub["Subject"].ToString());
                        }
                        if (itemSub["Resource_Class"].ToString() == Resource_ClassConst.自有资源)
                        {
                            saveOwnerPath = string.Format("{0}\\", pfunction.ConvertToLongDateTime(itemSub["CreateTime"].ToString(), "yyyy-MM-dd"));
                        }
                        DataRow   drTQ_S     = null;
                        DataRow[] drTQ_Score = dtTQ_Score.Select(string.Format("TestQuestions_ID='{0}'", itemSub["TestQuestions_ID"].ToString()), "TestQuestions_OrderNum");

                        #region 试题分数
                        List <object> listTQ_SObjForTch = new List <object>(); //老师客户端批改 分值,正确答案
                        List <object> listTQ_SObj       = new List <object>(); //学生客户端答题 解析,强化训练
                        int           intIndex          = 0;
                        for (int j = 0; j < drTQ_Score.Length; j++)
                        {
                            drTQ_S = drTQ_Score[j];
                            string strAnalyzeUrl = string.Empty;
                            string strTrainUrl   = string.Empty;
                            if (!string.IsNullOrEmpty(drTQ_S["AnalyzeHyperlinkData"].ToString()))
                            {
                                strAnalyzeUrl = pfunction.GetAnalyzeTrainUrl(ConfigHelper.GetConfigString("StudentAnswerWebSiteUrl"), drTQ_S["AnalyzeHyperlinkData"].ToString());
                            }
                            if (!string.IsNullOrEmpty(drTQ_S["TrainHyperlinkData"].ToString()))
                            {
                                strTrainUrl = pfunction.GetAnalyzeTrainUrl(ConfigHelper.GetConfigString("StudentAnswerWebSiteUrl"), drTQ_S["TrainHyperlinkData"].ToString());
                            }
                            listTQ_SObj.Add(new
                            {
                                testScoreId = drTQ_S["TestQuestions_Score_ID"].ToString(),
                                testIndex   = drTQ_S["testIndex"].ToString(),
                                analyzeUrl  = strAnalyzeUrl,
                                trainUrl    = strTrainUrl
                            });

                            string strtestCorrectBase64 = string.Empty;
                            string strtestCorrect       = string.Empty;
                            switch (drTQ_Score[j]["TestType"].ToString())
                            {
                            case "selection":
                            case "clozeTest":
                            case "truefalse":
                                strtestCorrect = drTQ_Score[j]["TestCorrect"].ToString();
                                break;
                                //case "fill":
                                //case "answers":
                                //    strtestCorrectBase64 = pfunction.ReadAllText(uploadPath + saveOwnerPath + "testQuestionCurrent\\" + savePath + drTQ_Score[j]["TestQuestions_Score_ID"].ToString() + ".txt");
                                //    break;
                            }
                            listTQ_SObjForTch.Add(new
                            {
                                testScoreId = drTQ_S["TestQuestions_Score_ID"].ToString(),
                                testIndex   = drTQ_S["testIndex"].ToString(),
                                scoreText   = drTQ_Score[j]["ScoreText"].ToString(),
                                testCorrect = strtestCorrect
                            });
                        }
                        if (listTQ_SObjForTch.Count == 0)
                        {
                            listTQ_SObjForTch.Add(null);
                        }
                        #endregion
                        string fileUrl = uploadPath + saveOwnerPath + "{0}\\" + savePath + "{1}.txt";//自有资源 savePath为空,云资源saveOwnerPath为空
                        if (drTQ_S != null)
                        {
                            string strtestQuestionBody = pfunction.ReadAllText(string.Format(fileUrl, "testQuestionBody", itemSub["TestQuestions_Id"].ToString()));
                            string strtextTitle        = pfunction.ReadAllText(string.Format(fileUrl, "textTitle", itemSub["TestQuestions_Id"].ToString()));
                            string strTopicNumber      = string.Empty;
                            if (item["LessonPlan_Type"].ToString() == LessonPlan_TypeConst.组卷)
                            {
                                strTopicNumber = itemSub["topicNumber"].ToString();
                            }
                            listTQObjBig_Sub.Add(new
                            {
                                Testid      = itemSub["TestQuestions_Id"],
                                testType    = itemSub["TestQuestions_Type"],
                                topicNumber = strTopicNumber,
                                docBase64   = strtestQuestionBody,
                                textTitle   = strtextTitle,
                                list        = listTQ_SObj
                            });

                            if (drTQ_S["TestType"].ToString() == "selection" || drTQ_S["TestType"].ToString() == "clozeTest" || drTQ_S["TestType"].ToString() == "truefalse")
                            {
                                strtestQuestionBody = "";
                                strtextTitle        = "";
                            }
                            listTQObjForTchBig_Sub.Add(new
                            {
                                Testid      = itemSub["TestQuestions_Id"],
                                testType    = itemSub["TestQuestions_Type"],
                                topicNumber = strTopicNumber,
                                docBase64   = strtestQuestionBody,
                                textTitle   = strtextTitle,
                                list        = listTQ_SObjForTch
                            });
                        }
                        else
                        {
                            string strtestQuestionBody = pfunction.ReadAllText(string.Format(fileUrl, "testQuestionBody", itemSub["TestQuestions_Id"].ToString()));
                            string strtextTitle        = pfunction.ReadAllText(string.Format(fileUrl, "textTitle", itemSub["TestQuestions_Id"].ToString()));
                            string strTopicNumber      = string.Empty;
                            if (item["LessonPlan_Type"].ToString() == LessonPlan_TypeConst.组卷)
                            {
                                strTopicNumber = itemSub["topicNumber"].ToString();
                            }
                            listTQObjBig_Sub.Add(new
                            {
                                Testid      = itemSub["TestQuestions_Id"],
                                testType    = itemSub["TestQuestions_Type"],
                                topicNumber = strTopicNumber,
                                docBase64   = strtestQuestionBody,
                                textTitle   = strtextTitle,
                                list        = ""
                            });

                            listTQObjForTchBig_Sub.Add(new
                            {
                                Testid      = itemSub["TestQuestions_Id"],
                                testType    = itemSub["TestQuestions_Type"],
                                topicNumber = strTopicNumber,
                                docBase64   = strtestQuestionBody,
                                textTitle   = strtextTitle,
                                list        = listTQ_SObjForTch
                            });
                        }
                    }
                    string savePathBig      = string.Empty;
                    string saveOwnerPathBig = string.Empty;
                    if (item["Resource_Class"].ToString() == Resource_ClassConst.云资源)
                    {
                        savePathBig = string.Format("{0}\\{1}\\{2}\\{3}\\", item["ParticularYear"].ToString(), item["GradeTerm"],
                                                    item["Resource_Version"].ToString(), item["Subject"].ToString());
                    }
                    if (item["Resource_Class"].ToString() == Resource_ClassConst.自有资源)
                    {
                        saveOwnerPathBig = string.Format("{0}\\", pfunction.ConvertToLongDateTime(item["CreateTime"].ToString(), "yyyy-MM-dd"));
                    }
                    string fileUrlBig   = uploadPath + saveOwnerPathBig + "{0}\\" + savePathBig + "{1}.{2}";//自有资源 savePath为空,云资源saveOwnerPath为空
                    string strdocBase64 = pfunction.ReadAllText(string.Format(fileUrlBig, "testQuestionBody", item["TestQuestions_Id"].ToString(), "txt"));
                    string strdocHtml   = pfunction.ReadAllText(string.Format(fileUrlBig, "testQuestionBody", item["TestQuestions_Id"].ToString(), "htm"));
                    string textTitle    = pfunction.ReadAllText(string.Format(fileUrlBig, "textTitle", item["TestQuestions_Id"].ToString(), "txt"));
                    listTQObjBig.Add(new
                    {
                        docBase64   = strdocBase64,
                        docHtml     = strdocHtml,
                        textTitle   = textTitle,
                        topicNumber = (item["LessonPlan_Type"].ToString() == LessonPlan_TypeConst.组卷) ? item["topicNumber"].ToString() : "",
                        list        = listTQObjBig_Sub,
                        type        = item["type"].ToString()
                    });
                    if (drBig_Sub.Length > 0) //没有子级试题,不加载节点
                    {
                        listTQObjForTchBig.Add(new
                        {
                            docBase64 = strdocBase64,
                            docHtml   = strdocHtml,
                            textTitle = textTitle,
                            list      = listTQObjForTchBig_Sub,
                            type      = item["type"].ToString()
                        });
                    }
                }
                #endregion

                #endregion
                string strJson = string.Empty;
                strJson = JsonConvert.SerializeObject(new
                {
                    status                     = true,
                    errorMsg                   = "",
                    errorCode                  = "",
                    paperHeaderDoc             = GetPaperHeaderDoc(rtrfId),
                    testPaperName              = "",
                    isTimeLimt                 = isTimeLimt,
                    isTimeLength               = isTimeLength,
                    sysTime                    = DateTime.Now.ToString(),
                    isShowAnswerAfterSubmiting = isShowAnswer,
                    list    = listTQObj,
                    listBig = listTQObjBig
                });
                Rc.Common.SystemLog.SystemLog.AddLogFromBS(tchId, "", "布置作业(学校服务器):5结束组织试题");
                Rc.Common.SystemLog.SystemLog.AddLogFromBS(tchId, "", "布置作业(学校服务器):6开始写入文件");
                pfunction.WriteToFile(uploadPath + "studentPaper\\" + filePath, strJson, true);

                string strJsonForTch = string.Empty;
                strJsonForTch = JsonConvert.SerializeObject(new
                {
                    list    = listTQObjForTch,
                    listBig = listTQObjForTchBig
                });
                pfunction.WriteToFile(uploadPath + "studentPaper\\" + filePathForTch, strJsonForTch, true);
                Rc.Common.SystemLog.SystemLog.AddLogFromBS(tchId, "", "布置作业(学校服务器):6结束写入文件");
                flag = true;
                #region 判断作业文件是否存在,不存在则返回false
                if (!File.Exists(uploadPath + "studentPaper\\" + filePath) ||
                    !File.Exists(uploadPath + "studentPaper\\" + filePathForTch))
                {
                    flag = false;
                    Rc.Common.SystemLog.SystemLog.AddLogFromBS(tchId, "", "布置作业(学校服务器):6作业文件不存在,布置失败");
                }
                #endregion
            }
            catch (Exception ex)
            {
                flag = false;
                Rc.Common.SystemLog.SystemLog.AddLogFromBS(tchId, "", "布置作业(学校服务器):异常,布置失败");
                Rc.Common.SystemLog.SystemLog.AddLogErrorFromBS("", "", "布置作业失败(学校服务器):" + ex.Message.ToString());
            }
            return(flag);
        }
Esempio n. 16
0
        public static string GetCorrectHomework(string ClassId)
        {
            try
            {
                ClassId = ClassId.Filter();

                DataTable     dtCHW      = new DataTable();
                List <object> listReturn = new List <object>();
                string        strSql     = string.Empty;
                string        strWhereC  = string.Empty;
                string        strWhere   = string.Empty;

                Model_F_User modelFUser = (Model_F_User)HttpContext.Current.Session["FLoginUser"];
                string       userId     = modelFUser.UserId;

                strWhere += string.Format(" and UserGroup_Id='{0}' and HomeWork_AssignTeacher='{1}' ", ClassId, userId);
                int inum = 0;
                Model_PagerInfo <List <Model_HomeWork> > pageInfo = new BLL_HomeWork().SearhList(strWhere, " CreateTime DESC", 1, 1000);
                List <Model_HomeWork> list = pageInfo.PageData;
                foreach (var item in list)
                {
                    inum++;
                    DateTime stopTime = DateTime.Now;
                    DateTime.TryParse(item.StopTime.ToString(), out stopTime);
                    listReturn.Add(new
                    {
                        HomeWork_Id = item.HomeWork_Id,
                        ResourceToResourceFolder_Id = item.ResourceToResourceFolder_Id,
                        HomeWork_Name          = item.HomeWork_Name,
                        HomeWork_AssignTeacher = item.HomeWork_AssignTeacher,
                        HomeWork_FinishTime    = item.HomeWork_FinishTime,
                        HomeWork_Status        = item.HomeWork_Status,
                        CreateTime             = pfunction.ConvertToLongDateTime(item.CreateTime.ToString(), "MM-dd"),
                        UserGroup_Id           = item.UserGroup_Id,
                        CorrectModes           = item.CorrectMode,
                        IsUpdate = (stopTime > DateTime.Now || string.IsNullOrEmpty(item.CorrectMode)) ? "no" : "yes"
                    });
                }
                if (inum > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = pageInfo.CurrentPage,
                        PageSize = pageInfo.PageSize,
                        TotalCount = pageInfo.RecordCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = "error"//ex.Message.ToString()
                }));
            }
        }
Esempio n. 17
0
        public static string GetHomeworkTestQuestions(string HomeWork_Id, string ResourceToResourceFolder_Id)
        {
            try
            {
                HomeWork_Id = HomeWork_Id.Filter();
                ResourceToResourceFolder_Id = ResourceToResourceFolder_Id.Filter();

                Model_HomeWork modelHW = new BLL_HomeWork().GetModel(HomeWork_Id);

                DataTable     dt         = new DataTable();
                List <object> listReturn = new List <object>();
                string        strSql     = string.Empty;
                strSql = string.Format(@"select tq.*
,ConfirmCount=(select count(1) from (select distinct TestQuestions_Id from HomeWorkQuestionConfirm where TestQuestions_Id=tq.TestQuestions_Id and HomeWork_Id='{0}')t)
from TestQuestions tq where tq.TestQuestions_Type!='title' and tq.ResourceToResourceFolder_Id='{1}' order by tq.TestQuestions_Num "
                                       , HomeWork_Id
                                       , ResourceToResourceFolder_Id);

                dt = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                Rc.Model.Resources.Model_ResourceToResourceFolder modelRTRF = new Rc.BLL.Resources.BLL_ResourceToResourceFolder().GetModel(ResourceToResourceFolder_Id);
                string uploadPath = pfunction.GetResourceHost("TestWebSiteUrl") + "Upload/Resource/"; //存储文件基础路径
                //生成存储路径
                string savePath = string.Format("{0}\\{1}\\{2}\\{3}\\", modelRTRF.ParticularYear, modelRTRF.GradeTerm, modelRTRF.Resource_Version, modelRTRF.Subject);
                string fileUrl  = uploadPath + "{0}\\" + savePath + "{1}.{2}";//文件详细路径

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string strTestQuestions_Type = string.Empty;
                    switch (dt.Rows[i]["TestQuestions_Type"].ToString())
                    {
                    case "selection":
                        strTestQuestions_Type = "选择题";
                        break;

                    case "clozeTest":
                        strTestQuestions_Type = "完形填空题";
                        break;

                    case "truefalse":
                        strTestQuestions_Type = "判断题";
                        break;

                    case "fill":
                        strTestQuestions_Type = "填空题";
                        break;

                    case "answers":
                        strTestQuestions_Type = "简答题";
                        break;
                    }
                    //题干
                    string strTestQuestionBody = Rc.Common.RemotWeb.PostDataToServer(string.Format(fileUrl, "testQuestionBody", dt.Rows[i]["TestQuestions_Id"], "htm"), "", Encoding.UTF8, "Get");
                    listReturn.Add(new
                    {
                        HomeWork_Id = HomeWork_Id,
                        ResourceToResourceFolder_Id = ResourceToResourceFolder_Id,
                        TestQuestions_Id            = dt.Rows[i]["TestQuestions_Id"].ToString(),
                        topicNumber            = dt.Rows[i]["topicNumber"].ToString().TrimEnd('.'),
                        TestQuestions_Type     = dt.Rows[i]["TestQuestions_Type"].ToString(),
                        TestQuestions_TypeName = strTestQuestions_Type,
                        TestQuestionBody       = pfunction.NoHTML(strTestQuestionBody),
                        TestQuestions_SumScore = dt.Rows[i]["TestQuestions_SumScore"].ToString().clearLastZero(),
                        ConfirmCount           = Convert.ToInt32(dt.Rows[i]["ConfirmCount"].ToString()),
                        IsCorrect = modelHW.HomeWork_Status == 1 ? "no" : "yes"//作业已标记完成,不允许批改
                    });
                }
                if (dt.Rows.Count > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = "error"//ex.Message.ToString()
                }));
            }
        }
        public void SubmitStudentAnswer()
        {
            string StrSql = string.Empty;

            if (string.IsNullOrEmpty(SchoolId))
            {
                StrSql = @"select hw.HomeWork_Id,hw.CreateTime,shw.Student_HomeWork_Id,shw.HomeWork_Id,shw.Student_Id,shw.CreateTime,shwSubmit.Student_HomeWork_Status,shwSubmit.OpenTime,shwSubmit.StudentIP,shwSubmit.Student_Answer_Time 
from Student_HomeWork shw
inner join Student_HomeWork_Submit shwSubmit on shwSubmit.Student_HomeWork_Id=shw.Student_HomeWork_Id and shwSubmit.Student_HomeWork_Status='2'
inner join HomeWork hw on hw.HomeWork_Id=shw.HomeWork_Id
order by hw.CreateTime";
            }
            else
            {
                StrSql = string.Format(@"select hw.HomeWork_Id,hw.CreateTime,shw.Student_HomeWork_Id,shw.HomeWork_Id,shw.Student_Id,shw.CreateTime,shwSubmit.Student_HomeWork_Status,shwSubmit.OpenTime,shwSubmit.StudentIP,shwSubmit.Student_Answer_Time 
from Student_HomeWork shw
inner join Student_HomeWork_Submit shwSubmit on shwSubmit.Student_HomeWork_Id=shw.Student_HomeWork_Id and shwSubmit.Student_HomeWork_Status='2'
inner join HomeWork hw on hw.HomeWork_Id=shw.HomeWork_Id
where shw.Student_Id in(select UserId from VW_UserOnClassGradeSchool vw where vw.SchoolId='{0}')
order by hw.CreateTime", SchoolId);
            }

            DataTable dtShw = Rc.Common.DBUtility.DbHelperSQL.Query(StrSql).Tables[0];

            if (dtShw.Rows.Count == 0)
            {
                #region 记录执行结束信息并保存数据
                model_FileSyncExecRecordDetail.Detail_TimeEnd = DateTime.Now;
                model_FileSyncExecRecordDetail.Detail_Status  = "1";
                model_FileSyncExecRecordDetail.Detail_Remark  = "执行完成.没有待执行数据";
                bll_FileSyncExecRecordDetail.Update(model_FileSyncExecRecordDetail);
                #endregion
                return;
            }

            try
            {
                #region 自动提交学生答案
                int    sucNum  = 0;
                int    failNum = 0;
                string resInfo = string.Empty;
                foreach (DataRow itemShw in dtShw.Rows)
                {
                    try
                    {
                        #region 提交单份学生作业
                        string         savePath   = string.Empty;
                        Model_HomeWork modelHW    = new BLL_HomeWork().GetModel(itemShw["HomeWork_Id"].ToString());
                        string         homeWorkId = modelHW.HomeWork_Id;
                        string         rtrfId     = modelHW.ResourceToResourceFolder_Id;
                        string         resourceId = itemShw["Student_HomeWork_Id"].ToString(); //学生作业ID
                        string         userId     = itemShw["Student_Id"].ToString();          //学生ID
                        Model_ResourceToResourceFolder modelRTRFolder = new BLL_ResourceToResourceFolder().GetModel(rtrfId);
                        string filePath = pfunction.ConvertToLongDateTime(itemShw["CreateTime"].ToString(), "yyyy-MM-dd") + "\\" + itemShw["HomeWork_Id"] + "\\" + itemShw["Student_HomeWork_Id"].ToString() + ".txt";

                        if (File.Exists(Server.MapPath(uploadAnswerPath) + filePath))
                        {
                            resInfo = File.ReadAllText(Server.MapPath(uploadAnswerPath) + filePath);
                            Rc.Interface.testPaperAnswerSubmitModel resModel = Newtonsoft.Json.JsonConvert.DeserializeObject <Rc.Interface.testPaperAnswerSubmitModel>(resInfo);

                            Rc.Common.SystemLog.SystemLog.AddLogFromBS("", resourceId, string.Format("开始自动提交学生作业|操作人{0}|学生作业Id{1}|方法{2}", userId, resourceId, "testpaperanswersubmit"));
                            #region 学生作业表
                            Model_Student_HomeWork_Submit modelSHWSubmit = new Model_Student_HomeWork_Submit();
                            modelSHWSubmit = new BLL_Student_HomeWork_Submit().GetModel(itemShw["Student_HomeWork_Id"].ToString());
                            modelSHWSubmit.Student_HomeWork_Status = 1;
                            #endregion
                            #region 学生作业答案表
                            if (modelRTRFolder.Resource_Class == Rc.Common.Config.Resource_ClassConst.云资源)
                            {
                                savePath = string.Format("{0}\\{1}\\{2}\\{3}\\{4}\\"
                                                         , pfunction.ToShortDate(modelHW.CreateTime.ToString())//作业布置时间
                                                         , modelRTRFolder.ParticularYear, modelRTRFolder.GradeTerm
                                                         , modelRTRFolder.Resource_Version, modelRTRFolder.Subject);
                            }
                            if (modelRTRFolder.Resource_Class == Rc.Common.Config.Resource_ClassConst.自有资源)
                            {
                                savePath = string.Format("{0}\\"
                                                         , pfunction.ToShortDate(modelHW.CreateTime.ToString()));//作业布置时间);
                            }

                            //获取这个试卷的所有试题分值
                            string strSqlScore = string.Empty;
                            strSqlScore = string.Format(@"select [TestQuestions_Score_ID],TestQuestions_ID ,TestQuestions_Score,TestQuestions_OrderNum,TestType
 FROM TestQuestions_Score where ResourceToResourceFolder_Id='{0}'  ", rtrfId);
                            DataTable dtTQ_Score = Rc.Common.DBUtility.DbHelperSQL.Query(strSqlScore).Tables[0];

                            List <Model_Student_HomeWorkAnswer>         listSHWA = new List <Model_Student_HomeWorkAnswer>();
                            List <Rc.Interface.TestPaperAnswerModel>    listTestPaperAnswerModel = resModel.answerJson; //普通题型
                            List <Rc.Interface.TestPaperAnswerModelBig> TestPaperAnswerModelBig  = resModel.listBig;    //综合题型
                            #region 普通题型 list
                            int num = 0;
                            if (listTestPaperAnswerModel != null)
                            {
                                foreach (var item in listTestPaperAnswerModel)
                                {
                                    if (item != null && item.list != null)
                                    {
                                        num++;
                                        int detailNum = 0;
                                        foreach (var itemSub in item.list)
                                        {
                                            if (itemSub != null)
                                            {
                                                detailNum++;
                                                DataRow[] drTQ_Score = dtTQ_Score.Select(string.Format(" TestQuestions_ID='{0}'  and TestQuestions_OrderNum={1} ", item.Testid, detailNum));
                                                if (drTQ_Score != null && drTQ_Score.Length > 0)
                                                {
                                                    #region 学生答题表
                                                    Model_Student_HomeWorkAnswer modelSHWA = new Model_Student_HomeWorkAnswer();
                                                    modelSHWA.TestQuestions_Id = item.Testid;
                                                    string student_HomeWorkAnswer_Id = Guid.NewGuid().ToString();
                                                    modelSHWA.TestQuestions_Score_ID    = drTQ_Score[0]["TestQuestions_Score_ID"].ToString();
                                                    modelSHWA.Student_HomeWorkAnswer_Id = student_HomeWorkAnswer_Id;
                                                    modelSHWA.Student_HomeWork_Id       = resourceId;
                                                    modelSHWA.Student_Id                    = userId;
                                                    modelSHWA.HomeWork_Id                   = homeWorkId;
                                                    modelSHWA.TestQuestions_Num             = num;
                                                    modelSHWA.TestQuestions_Detail_OrderNum = detailNum;

                                                    if (itemSub.isHTML == "F")//是否以HTML提交 F: 文本提交; T: HTML提交(选择题,文本提交, 其余均为HTML提交)
                                                    {
                                                        modelSHWA.Student_Answer = itemSub.answerChooses;
                                                    }
                                                    else if (itemSub.isHTML == "T")//HTML提交
                                                    {
                                                        Model_TestQuestions modelTQ = new BLL_TestQuestions().GetModel(item.Testid);
                                                        if (modelTQ.TestQuestions_Type == "truefalse")//判断题答案保存到数据库
                                                        {
                                                            modelSHWA.Student_Answer = itemSub.answerHTML;
                                                        }
                                                        else
                                                        {
                                                            #region 学生答案 保存文件
                                                            if (!String.IsNullOrEmpty(itemSub.answerHTML))
                                                            {
                                                                pfunction.WriteToFile(string.Format("{0}studentAnswer\\{1}{2}.txt", uploadPath, savePath, student_HomeWorkAnswer_Id), itemSub.answerHTML, true);
                                                            }
                                                            if (!String.IsNullOrEmpty(itemSub.answerImageBase64))
                                                            {
                                                                pfunction.WriteToFile(string.Format("{0}studentAnswer\\{1}{2}.i.txt", uploadPath, savePath, student_HomeWorkAnswer_Id), itemSub.answerImageBase64, true);
                                                            }
                                                            if (!String.IsNullOrEmpty(itemSub.answerDocBase64))
                                                            {
                                                                pfunction.WriteToFile(string.Format("{0}studentAnswer\\{1}{2}.d.txt", uploadPath, savePath, student_HomeWorkAnswer_Id), itemSub.answerDocBase64, true);
                                                            }
                                                            #endregion
                                                        }
                                                    }
                                                    else //默认存HTML
                                                    {
                                                        #region 学生答案 保存文件
                                                        if (!String.IsNullOrEmpty(itemSub.answerHTML))
                                                        {
                                                            pfunction.WriteToFile(string.Format("{0}studentAnswer\\{1}{2}.txt", uploadPath, savePath, student_HomeWorkAnswer_Id), itemSub.answerHTML, true);
                                                        }
                                                        if (!String.IsNullOrEmpty(itemSub.answerImageBase64))
                                                        {
                                                            pfunction.WriteToFile(string.Format("{0}studentAnswer\\{1}{2}.i.txt", uploadPath, savePath, student_HomeWorkAnswer_Id), itemSub.answerImageBase64, true);
                                                        }
                                                        if (!String.IsNullOrEmpty(itemSub.answerDocBase64))
                                                        {
                                                            pfunction.WriteToFile(string.Format("{0}studentAnswer\\{1}{2}.d.txt", uploadPath, savePath, student_HomeWorkAnswer_Id), itemSub.answerDocBase64, true);
                                                        }
                                                        #endregion
                                                    }
                                                    //写入客户端的判卷
                                                    modelSHWA.Student_Score = 0;//学生得分默认值(NULL的话统计的时候会出现数据不正确)
                                                    if (itemSub.isRight == "true")
                                                    {
                                                        modelSHWA.Student_Answer_Status = "right";
                                                        decimal temp_decimal = 0;
                                                        decimal.TryParse(drTQ_Score[0]["TestQuestions_Score"].ToString(), out temp_decimal);
                                                        modelSHWA.Student_Score = temp_decimal;
                                                        modelSHWA.isRead        = 1;
                                                    }
                                                    else if (itemSub.isRight == "false")
                                                    {
                                                        modelSHWA.Student_Answer_Status = "wrong";
                                                        modelSHWA.isRead = 1;
                                                    }
                                                    else
                                                    {
                                                        modelSHWA.Student_Answer_Status = "unknown";
                                                        modelSHWA.isRead = 0;
                                                    }
                                                    modelSHWA.CreateTime = DateTime.Now;
                                                    string strTestQuestions_NumStr = item.topicNumber.Filter();
                                                    if (!string.IsNullOrEmpty(strTestQuestions_NumStr))
                                                    {
                                                        if (strTestQuestions_NumStr.Length >= 10)
                                                        {
                                                            strTestQuestions_NumStr = strTestQuestions_NumStr.Substring(0, 10);
                                                        }
                                                    }
                                                    modelSHWA.TestQuestions_NumStr = strTestQuestions_NumStr;//item.topicNumber
                                                    listSHWA.Add(modelSHWA);
                                                    #endregion
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            #endregion
                            #region 综合题型 listBig
                            if (TestPaperAnswerModelBig != null)
                            {
                                num = 0;
                                foreach (var itemBig in TestPaperAnswerModelBig)
                                {
                                    if (itemBig != null && itemBig.list != null)
                                    {
                                        foreach (var item in itemBig.list)
                                        {
                                            if (item != null && item.list != null)
                                            {
                                                num++;
                                                int detailNum = 0;
                                                foreach (var itemSub in item.list)
                                                {
                                                    if (itemSub != null)
                                                    {
                                                        detailNum++;
                                                        DataRow[] drTQ_Score = dtTQ_Score.Select(string.Format(" TestQuestions_ID='{0}'  and TestQuestions_OrderNum={1} ", item.Testid, detailNum));
                                                        if (drTQ_Score != null && drTQ_Score.Length > 0)
                                                        {
                                                            #region 学生答题表
                                                            Model_Student_HomeWorkAnswer modelSHWA = new Model_Student_HomeWorkAnswer();
                                                            modelSHWA.TestQuestions_Id = item.Testid;
                                                            string student_HomeWorkAnswer_Id = Guid.NewGuid().ToString();
                                                            modelSHWA.TestQuestions_Score_ID    = drTQ_Score[0]["TestQuestions_Score_ID"].ToString();
                                                            modelSHWA.Student_HomeWorkAnswer_Id = student_HomeWorkAnswer_Id;
                                                            modelSHWA.Student_HomeWork_Id       = resourceId;
                                                            modelSHWA.Student_Id                    = userId;
                                                            modelSHWA.HomeWork_Id                   = homeWorkId;
                                                            modelSHWA.TestQuestions_Num             = num;
                                                            modelSHWA.TestQuestions_Detail_OrderNum = detailNum;

                                                            //if (modelRTRFolder.Resource_Class == Rc.Common.Config.Resource_ClassConst.云资源)
                                                            //{
                                                            //    savePath = string.Format("{0}\\{1}\\{2}\\{3}\\{4}\\"
                                                            //       , pfunction.ToShortDate(modelHW.CreateTime.ToString())//作业布置时间
                                                            //       , modelRTRFolder.ParticularYear, modelRTRFolder.GradeTerm
                                                            //       , modelRTRFolder.Resource_Version, modelRTRFolder.Subject);
                                                            //}
                                                            //if (modelRTRFolder.Resource_Class == Rc.Common.Config.Resource_ClassConst.自有资源)
                                                            //{
                                                            //    savePath = string.Format("{0}\\"
                                                            //        , pfunction.ToShortDate(modelHW.CreateTime.ToString()));//作业布置时间);
                                                            //}
                                                            if (itemSub.isHTML == "F")//是否以HTML提交 F: 文本提交; T: HTML提交(选择题,文本提交, 其余均为HTML提交)
                                                            {
                                                                modelSHWA.Student_Answer = itemSub.answerChooses;
                                                            }
                                                            else if (itemSub.isHTML == "T")//HTML提交
                                                            {
                                                                Model_TestQuestions modelTQ = new BLL_TestQuestions().GetModel(item.Testid);
                                                                if (modelTQ.TestQuestions_Type == "truefalse")//判断题答案保存到数据库
                                                                {
                                                                    modelSHWA.Student_Answer = itemSub.answerHTML;
                                                                }
                                                                else
                                                                {
                                                                    #region 学生答案 保存文件
                                                                    if (!String.IsNullOrEmpty(itemSub.answerHTML))
                                                                    {
                                                                        pfunction.WriteToFile(string.Format("{0}studentAnswer\\{1}{2}.txt", uploadPath, savePath, student_HomeWorkAnswer_Id), itemSub.answerHTML, true);
                                                                    }
                                                                    if (!String.IsNullOrEmpty(itemSub.answerImageBase64))
                                                                    {
                                                                        pfunction.WriteToFile(string.Format("{0}studentAnswer\\{1}{2}.i.txt", uploadPath, savePath, student_HomeWorkAnswer_Id), itemSub.answerImageBase64, true);
                                                                    }
                                                                    if (!String.IsNullOrEmpty(itemSub.answerDocBase64))
                                                                    {
                                                                        pfunction.WriteToFile(string.Format("{0}studentAnswer\\{1}{2}.d.txt", uploadPath, savePath, student_HomeWorkAnswer_Id), itemSub.answerDocBase64, true);
                                                                    }
                                                                    #endregion
                                                                }
                                                            }
                                                            else //默认存HTML
                                                            {
                                                                #region 学生答案 保存文件
                                                                if (!String.IsNullOrEmpty(itemSub.answerHTML))
                                                                {
                                                                    pfunction.WriteToFile(string.Format("{0}studentAnswer\\{1}{2}.txt", uploadPath, savePath, student_HomeWorkAnswer_Id), itemSub.answerHTML, true);
                                                                }
                                                                if (!String.IsNullOrEmpty(itemSub.answerImageBase64))
                                                                {
                                                                    pfunction.WriteToFile(string.Format("{0}studentAnswer\\{1}{2}.i.txt", uploadPath, savePath, student_HomeWorkAnswer_Id), itemSub.answerImageBase64, true);
                                                                }
                                                                if (!String.IsNullOrEmpty(itemSub.answerDocBase64))
                                                                {
                                                                    pfunction.WriteToFile(string.Format("{0}studentAnswer\\{1}{2}.d.txt", uploadPath, savePath, student_HomeWorkAnswer_Id), itemSub.answerDocBase64, true);
                                                                }
                                                                #endregion
                                                            }
                                                            //写入客户端的判卷
                                                            modelSHWA.Student_Score = 0;//学生得分默认值(NULL的话统计的时候会出现数据不正确)
                                                            if (itemSub.isRight == "true")
                                                            {
                                                                modelSHWA.Student_Answer_Status = "right";
                                                                decimal temp_decimal = 0;
                                                                decimal.TryParse(drTQ_Score[0]["TestQuestions_Score"].ToString(), out temp_decimal);
                                                                modelSHWA.Student_Score = temp_decimal;
                                                                modelSHWA.isRead        = 1;
                                                            }
                                                            else if (itemSub.isRight == "false")
                                                            {
                                                                modelSHWA.Student_Answer_Status = "wrong";
                                                                modelSHWA.isRead = 1;
                                                            }
                                                            else
                                                            {
                                                                modelSHWA.Student_Answer_Status = "unknown";
                                                                modelSHWA.isRead = 0;
                                                            }
                                                            modelSHWA.CreateTime = DateTime.Now;
                                                            string strTestQuestions_NumStr = item.topicNumber.Filter();
                                                            if (!string.IsNullOrEmpty(strTestQuestions_NumStr))
                                                            {
                                                                if (strTestQuestions_NumStr.Length >= 10)
                                                                {
                                                                    strTestQuestions_NumStr = strTestQuestions_NumStr.Substring(0, 10);
                                                                }
                                                            }
                                                            modelSHWA.TestQuestions_NumStr = strTestQuestions_NumStr;//item.topicNumber
                                                            listSHWA.Add(modelSHWA);
                                                            #endregion
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            #endregion
                            #endregion

                            if (new BLL_Student_HomeWorkAnswer().StudentAnswerSubmit(modelSHWSubmit, listSHWA) > 0)
                            {
                                sucNum++;
                                #region 保存学生答题JSON串
                                //重置answerHTML为空,保存分值
                                List <Model_Student_HomeWorkAnswer> listStuScore = new BLL_Student_HomeWorkAnswer().GetModelList("Student_HomeWork_Id='" + resourceId + "'");
                                #region 普通题型 list
                                if (resModel.answerJson != null)
                                {
                                    foreach (var item in resModel.answerJson)
                                    {
                                        if (item != null && item.list != null)
                                        {
                                            int sNum = 0;
                                            foreach (var itemTQ_S in item.list)
                                            {
                                                if (itemTQ_S != null)
                                                {
                                                    itemTQ_S.answerHTML = "";
                                                    sNum++;
                                                    List <Model_Student_HomeWorkAnswer> listStuScoreSub = listStuScore.Where(o => o.TestQuestions_Id == item.Testid && o.TestQuestions_Detail_OrderNum == sNum).ToList();
                                                    if (listStuScoreSub.Count > 0)
                                                    {
                                                        itemTQ_S.studentScore = listStuScoreSub[0].Student_Score.ToString();
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                #endregion
                                #region 综合题型 listBig
                                if (resModel.listBig != null)
                                {
                                    foreach (var item in resModel.listBig)
                                    {
                                        if (item != null && item.list != null)
                                        {
                                            foreach (var itemSub in item.list)
                                            {
                                                if (itemSub != null && itemSub.list != null)
                                                {
                                                    int sNum = 0;
                                                    foreach (var itemTQ_S in itemSub.list)
                                                    {
                                                        if (itemTQ_S != null)
                                                        {
                                                            itemTQ_S.answerHTML = "";
                                                            sNum++;
                                                            List <Model_Student_HomeWorkAnswer> listStuScoreSub = listStuScore.Where(o => o.TestQuestions_Id == itemSub.Testid && o.TestQuestions_Detail_OrderNum == sNum).ToList();
                                                            if (listStuScoreSub.Count > 0)
                                                            {
                                                                itemTQ_S.studentScore = listStuScoreSub[0].Student_Score.ToString();
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                #endregion

                                string savePathForTch = string.Format("{0}\\", pfunction.ToShortDate(modelHW.CreateTime.ToString()));
                                savePathForTch = "{0}{1}\\" + savePathForTch + "{2}\\{2}.txt";
                                object stuAnswer = new
                                {
                                    list    = resModel.answerJson,
                                    listBig = resModel.listBig
                                };
                                pfunction.WriteToFile(string.Format(savePathForTch, uploadPath, "studentAnswerForMarking", resourceId)
                                                      , Newtonsoft.Json.JsonConvert.SerializeObject(stuAnswer), true);
                                #endregion
                                Rc.Common.SystemLog.SystemLog.AddLogFromBS("", resourceId, string.Format("成功-自动提交学生作业|操作人{0}|学生作业Id{1}|方法{2}", userId, resourceId, "testpaperanswersubmit"));
                            }
                            else
                            {
                                failNum++;
                                Rc.Common.SystemLog.SystemLog.AddLogFromBS("", resourceId, string.Format("失败-自动提交学生作业|操作人{0}|学生作业Id{1}|方法{2}", userId, resourceId, "testpaperanswersubmit"));
                            }
                        }
                        #endregion
                    }
                    catch (Exception ex)
                    {
                        failNum++;
                        Rc.Common.SystemLog.SystemLog.AddLogFromBS("", itemShw["Student_HomeWork_Id"].ToString()
                                                                   , string.Format("失败-自动提交学生作业|操作人{0}|学生作业Id{1}|方法{2}。错误:{3}"
                                                                                   , itemShw["Student_Id"].ToString()
                                                                                   , itemShw["Student_HomeWork_Id"].ToString()
                                                                                   , "testpaperanswersubmit"
                                                                                   , ex.Message.ToString().Filter()
                                                                                   )
                                                                   );
                    }


                    Rc.Common.SystemLog.SystemLog.AddLogFromBS("", itemShw["Student_HomeWork_Id"].ToString(), string.Format("完成-自动提交学生作业|操作人{0}|学生作业Id{1}|方法{2}", itemShw["Student_Id"].ToString(), itemShw["Student_HomeWork_Id"].ToString(), "testpaperanswersubmit"));
                }

                #endregion
                #region 记录执行结束信息并保存数据
                model_FileSyncExecRecordDetail.Detail_TimeEnd = DateTime.Now;
                model_FileSyncExecRecordDetail.Detail_Status  = "1";
                model_FileSyncExecRecordDetail.Detail_Remark  = string.Format("执行完成.数据总数{0},成功数{1},失败数{2}", dtShw.Rows.Count, sucNum, failNum);
                bll_FileSyncExecRecordDetail.Update(model_FileSyncExecRecordDetail);
                #endregion
            }
            catch (Exception ex)
            {
                model_FileSyncExecRecordDetail.Detail_TimeEnd = DateTime.Now;
                model_FileSyncExecRecordDetail.Detail_Status  = "2";
                model_FileSyncExecRecordDetail.Detail_Remark  = "执行失败:" + ex.Message.ToString();
                bll_FileSyncExecRecordDetail.Update(model_FileSyncExecRecordDetail);
            }
        }
        private void LoadData()
        {
            Model_ResourceToResourceFolder modelRTRF = new BLL_ResourceToResourceFolder().GetModel(ResourceToResourceFolder_Id);

            if (modelRTRF != null)
            {
                Model_HomeWork modelHW = new BLL_HomeWork().GetModel(HomeWork_Id);
                ltlHomeWorkName.Text = modelRTRF.File_Name;
                string uploadTestPaperPath     = pfunction.GetResourceHost("TestWebSiteUrl") + "Upload/Resource/"; //存储文件基础路径
                string uploadStudentAnswerPath = Rc.Cloud.Web.Common.pfunction.GetResourceHost("StudentAnswerWebSiteUrl") + "Upload/Resource/";
                //生成存储路径
                string savePath             = string.Format("{0}\\{1}\\{2}\\{3}\\", modelRTRF.ParticularYear, modelRTRF.GradeTerm, modelRTRF.Resource_Version, modelRTRF.Subject);
                string fileTestPaperUrl     = uploadTestPaperPath + "{0}\\" + savePath + "{1}.{2}";                                                                                       //试题文件详细路径
                string fileStudentAnswerUrl = uploadStudentAnswerPath + "{0}\\" + Rc.Cloud.Web.Common.pfunction.ToShortDate(modelHW.CreateTime.ToString()) + "\\" + savePath + "{1}.{2}"; //学生答案文件详细路径

                Model_UserGroup modelUG = new BLL_UserGroup().GetModel(modelHW.UserGroup_Id);
                ltlClassName.Text = modelUG.UserGroup_Name;

                Model_TestQuestions modelTQ = new BLL_TestQuestions().GetModel(TestQuestions_Id);

                //题干
                string strTestQuestionBody = Rc.Common.RemotWeb.PostDataToServer(string.Format(fileTestPaperUrl, "testQuestionBody", modelTQ.TestQuestions_Id, "htm"), "", Encoding.UTF8, "Get");


                ltlTQSumScore.Text = modelTQ.TestQuestions_SumScore.ToString().clearLastZero();
                DataTable dtTQScore = new DataTable();
                string    strSql    = "select * from TestQuestions_Score where TestQuestions_Id='" + TestQuestions_Id + "' order by TestQuestions_OrderNum ";
                dtTQScore = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                //选择题选项
                string strOption = string.Empty;
                int    num       = 0;
                foreach (DataRow item in dtTQScore.Rows)
                {
                    if (modelTQ.TestQuestions_Type == "selection" || modelTQ.TestQuestions_Type == "clozeTest")//选择题、完形填空题选项
                    {
                        //从文件读取选择题选项
                        string strTestQuestionOption = Rc.Common.RemotWeb.PostDataToServer(string.Format(fileTestPaperUrl, "testQuestionOption", item["TestQuestions_Score_ID"], "txt"), "", Encoding.UTF8, "Get");
                        List <Rc.Interface.TestSelections> listTestSelections = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Rc.Interface.TestSelections> >(strTestQuestionOption);
                        if (listTestSelections != null && listTestSelections.Count > 0)
                        {
                            foreach (var itemTS in listTestSelections)
                            {
                                if (!string.IsNullOrEmpty(itemTS.selectionHTML))
                                {
                                    strOption += string.Format("<div class=\"option_item\">{0}</div>", Rc.Cloud.Web.Common.pfunction.NoHTML(itemTS.selectionHTML));
                                }
                            }
                            if (num < dtTQScore.Rows.Count - 1 && !string.IsNullOrEmpty(strOption))
                            {
                                strOption += "<br/><hr style=' height:1px;border:none;border-top:1px dotted #185598;' />";
                            }
                        }
                    }

                    stbTQAnswerScore.Append("<div class=\"answer_main clearfix\">");
                    //从文件读取正确答案图片
                    string strTestQuestionCorrect = string.Empty;
                    if (modelTQ.TestQuestions_Type == "selection" || modelTQ.TestQuestions_Type == "clozeTest" || modelTQ.TestQuestions_Type == "truefalse")
                    {
                        strTestQuestionCorrect = item["TestCorrect"].ToString();
                    }
                    else if (modelTQ.TestQuestions_Type == "fill" || modelTQ.TestQuestions_Type == "answers")
                    {
                        strTestQuestionCorrect = Rc.Common.RemotWeb.PostDataToServer(string.Format(fileTestPaperUrl, "testQuestionCurrent", item["TestQuestions_Score_ID"], "txt"), "", Encoding.UTF8, "Get");
                        strTestQuestionCorrect = string.Format("<div>{0}</div>", Rc.Cloud.Web.Common.pfunction.NoHTML(strTestQuestionCorrect));
                    }
                    stbTQAnswerScore.AppendFormat("<div class=\"correct_answer\">{0}</div>", Rc.Cloud.Web.Common.pfunction.NoHTML(strTestQuestionCorrect));
                    stbTQAnswerScore.Append("<div class=\"score\">");
                    stbTQAnswerScore.AppendFormat("<div data-name=\"FillScore\"><input type=\"text\" name=\"fill_Score\" readonly value=\"{0}\" /></div>"
                                                  , item["TestQuestions_Score"].ToString().clearLastZero());
                    stbTQAnswerScore.Append("</div>");
                    stbTQAnswerScore.Append("</div>");

                    num++;
                }
                ltlTestQuestionsBody.Text = pfunction.NoHTML(strTestQuestionBody) + strOption;

                #region 学生答题详情
                string strWhere     = string.Empty;
                string strSqlAnswer = @"select tqs.TestQuestions_Id,tqs.TestQuestions_Score_ID,tqs.TestCorrect,tqs.TestQuestions_Score,tqs.TestQuestions_Num,tqs.TestQuestions_OrderNum,shwa.Student_HomeWorkAnswer_Id,shwa.Student_Id,shwa.Student_Answer,shwa.Student_Score,shwa.Student_Answer_Status,shwa.Comment
,fu.UserName,fu.TrueName,shwa.CreateTime
from TestQuestions_Score tqs 
                left join Student_HomeWorkAnswer shwa on TQS.TestQuestions_Id=SHWA.TestQuestions_Id and TQS.TestQuestions_Score_ID=SHWA.TestQuestions_Score_ID 
left join F_User fu on fu.UserId=shwa.Student_Id
where tqs.TestQuestions_Id='" + TestQuestions_Id + "' and shwa.HomeWork_Id='" + HomeWork_Id + "' " + strWhere + " order by tqs.TestQuestions_OrderNum,shwa.CreateTime";

                DataTable dtAnswerScore = Rc.Common.DBUtility.DbHelperSQL.Query(strSqlAnswer).Tables[0];
                DataTable dtDistinct    = dtAnswerScore.DefaultView.ToTable(true, "UserName", "TrueName", "Student_Id", "Comment");
                foreach (DataRow itemDistinct in dtDistinct.Rows)
                {
                    stbStuAnswer.Append("<div class=\"student_answer_box\">");
                    stbStuAnswer.Append("<div class=\"title clearfix\">");
                    stbStuAnswer.AppendFormat("<div class=\"student_name\">{0}的答案<a href='##' data-name=\"remark\" data-content=\"{1}\" id=\"{2}\">批注</a></div>"
                                              , string.IsNullOrEmpty(itemDistinct["TrueName"].ToString()) ? itemDistinct["UserName"] : itemDistinct["TrueName"]
                                              , itemDistinct["Comment"]
                                              , itemDistinct["Student_Id"]);

                    stbStuAnswer.Append("<div class=\"score_name\">得分</div>");
                    stbStuAnswer.Append("</div>");
                    stbStuAnswer.Append("<div class=\"con\">");
                    DataRow[] drScore = dtAnswerScore.Select("Student_Id='" + itemDistinct["Student_Id"] + "'");
                    foreach (DataRow item in drScore)
                    {
                        stbStuAnswer.Append("<div class=\"answer_score clearfix\">");
                        string strStudentAnswer = string.Empty;
                        if (modelTQ.TestQuestions_Type == "selection" || modelTQ.TestQuestions_Type == "clozeTest" || modelTQ.TestQuestions_Type == "truefalse")
                        {
                            strStudentAnswer = item["Student_Answer"].ToString();
                        }
                        else if (modelTQ.TestQuestions_Type == "fill" || modelTQ.TestQuestions_Type == "answers")
                        {
                            strStudentAnswer = Rc.Common.RemotWeb.PostDataToServer(string.Format(fileStudentAnswerUrl, "studentAnswer", item["Student_HomeWorkAnswer_Id"], "txt"), "", Encoding.UTF8, "Get");
                            strStudentAnswer = Rc.Cloud.Web.Common.pfunction.NoHTML(strStudentAnswer);
                            if (string.IsNullOrWhiteSpace(strStudentAnswer))
                            {
                                strStudentAnswer = "&nbsp;&nbsp;";
                            }
                            strStudentAnswer = string.Format("<div>{0}</div>", strStudentAnswer);
                        }
                        if (string.IsNullOrWhiteSpace(strStudentAnswer))
                        {
                            strStudentAnswer = "&nbsp;&nbsp;";
                        }
                        stbStuAnswer.AppendFormat("<div class=\"answer\">{0}</div>", strStudentAnswer);
                        stbStuAnswer.AppendFormat("<div class=\"score\"><input type=\"text\" data-actual-marks=\"{0}\" data-name=\"ScoreTxt\" value=\"{1}\" maxlength=\"3\" id=\"{2}\" tqsId=\"{3}\" /></div>"
                                                  , item["TestQuestions_Score"].ToString().clearLastZero()
                                                  , item["Student_Score"].ToString().clearLastZero()
                                                  , item["Student_HomeWorkAnswer_Id"].ToString()
                                                  , item["TestQuestions_Score_ID"].ToString());
                        stbStuAnswer.Append("</div>");
                    }
                    stbStuAnswer.Append("</div>");
                    stbStuAnswer.Append("</div>");
                }
                #endregion
            }
        }
Esempio n. 20
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                Model_HomeWork model = new Model_HomeWork();
                BLL_HomeWork   bll   = new BLL_HomeWork();

                #region 布置作业表
                string guid = HomeWork_Id;
                model          = bll.GetModel(guid);
                model.StopTime = Convert.ToDateTime(txtStopTime.Text);
                #endregion

                #region 学生作业表
                List <Model_Student_HomeWork>         listSHomwWork        = new List <Model_Student_HomeWork>();
                List <Model_Student_HomeWork_Submit>  listSHomwWorkSubmit  = new List <Model_Student_HomeWork_Submit>();
                List <Model_Student_HomeWork_Correct> listSHomwWorkCorrect = new List <Model_Student_HomeWork_Correct>();
                string strStudent = Rc.Cloud.Web.Common.pfunction.CheckImp(hidStudentId.Value);
                strStudent = strStudent.TrimEnd(',');
                string[] strArrStudent = strStudent.Split(',');
                for (int i = 0; i < strArrStudent.Length; i++)
                {
                    string ShwGuid = Guid.NewGuid().ToString();
                    Model_Student_HomeWork modelSHomeWork = new Model_Student_HomeWork();
                    modelSHomeWork.Student_HomeWork_Id = ShwGuid;
                    modelSHomeWork.HomeWork_Id         = guid;
                    modelSHomeWork.Student_Id          = strArrStudent[i];
                    modelSHomeWork.CreateTime          = DateTime.Now;
                    listSHomwWork.Add(modelSHomeWork);
                    #region 作业提交状态
                    Model_Student_HomeWork_Submit modelSHomeWorkSubmit = new Model_Student_HomeWork_Submit();
                    modelSHomeWorkSubmit.Student_HomeWork_Id     = ShwGuid;
                    modelSHomeWorkSubmit.Student_HomeWork_Status = 0;
                    listSHomwWorkSubmit.Add(modelSHomeWorkSubmit);
                    #endregion
                    #region 作业批改状态
                    Model_Student_HomeWork_Correct modelSHomeWorkCorrect = new Model_Student_HomeWork_Correct();
                    modelSHomeWorkCorrect.Student_HomeWork_Id            = ShwGuid;
                    modelSHomeWorkCorrect.Student_HomeWork_CorrectStatus = 0;
                    listSHomwWorkCorrect.Add(modelSHomeWorkCorrect);
                    #endregion
                }
                #endregion

                #region 统计帮助表
                DataTable         dtHWDetail = bll.GetHWDetail(HomeWork_Id).Tables[0];
                Model_StatsHelper modelSH_HW = new Model_StatsHelper();
                modelSH_HW.ResourceToResourceFolder_Id = model.ResourceToResourceFolder_Id;
                modelSH_HW.Homework_Id = model.HomeWork_Id;
                modelSH_HW.SchoolId    = dtHWDetail.Rows[0]["SchoolId"].ToString();
                modelSH_HW.GradeId     = dtHWDetail.Rows[0]["GradeId"].ToString();
                #endregion

                if (bll.UpdateHomework(model, listSHomwWork, listSHomwWorkSubmit, listSHomwWorkCorrect, modelSH_HW))
                {
                    string strJ = "layer.msg('布置作业成功',{time:1000,icon:1},function(){";
                    if (Request.QueryString["tp"] != "1")
                    {
                        strJ += "window.parent.loadData();";
                    }
                    else
                    {
                        strJ += "window.parent.location.reload();";
                    }
                    strJ += "parent.layer.close(parent.layer.getFrameIndex(window.name));});";
                    ClientScript.RegisterStartupScript(this.GetType(), "temp", strJ, true);
                    Rc.Common.SystemLog.SystemLog.AddLogFromBS(FloginUser.UserId, "", "布置作业成功");
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.msg('布置作业失败',{time:2000,icon:2});", true);
                    Rc.Common.SystemLog.SystemLog.AddLogErrorFromBS(FloginUser.UserId, "", "布置作业失败");
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.msg('布置作业失败',{time:2000,icon:2});", true);
                Rc.Common.SystemLog.SystemLog.AddLogErrorFromBS(FloginUser.UserId, "", "布置作业失败:" + ex.Message.ToString());
            }
        }