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; } }
protected void Page_Load(object sender, EventArgs e) { try { StudentId = Request.QueryString["StudentId"].Filter(); Student_HomeWork_Id = Request.QueryString["Student_HomeWork_Id"].Filter(); strTestpaperViewWebSiteUrl = pfunction.GetResourceHost("TestWebSiteUrl"); if (!string.IsNullOrEmpty(StudentId) && strTestpaperViewWebSiteUrl == Rc.Common.ConfigHelper.GetConfigString("TestWebSiteUrl")) { strTestpaperViewWebSiteUrl = pfunction.GetResourceHost("TestWebSiteUrl", StudentId); } string reqWrong = Request["wrong"].Filter(); if (reqWrong == "w") { isShowWrong = true; } ResourceToResourceFolder_Id = Request.QueryString["ResourceToResourceFolder_Id"].Filter(); HomeWork_Id = Request.QueryString["HomeWork_Id"].Filter(); modelHW = new BLL_HomeWork().GetModel(HomeWork_Id); hwCreateTime = modelHW.CreateTime.ToString(); string tempSql = string.Empty; tempSql = string.Format(@"select COUNT(1) as icount from Student_HomeWork shw inner join Student_HomeWork_Correct shwCorrect on shwCorrect.Student_HomeWork_Id=shw.Student_HomeWork_Id where HomeWork_Id='{0}' and Student_Id='{1}' and shwCorrect.Student_HomeWork_CorrectStatus='{2}'", HomeWork_Id, StudentId, "1"); int i = int.Parse(Rc.Common.DBUtility.DbHelperSQL.GetSingle(tempSql).ToString()); if (i > 0) { //} List <Model_StatsClassStudentHW_Score> listSCSHW = new BLL_StatsClassStudentHW_Score().GetModelList(" HomeWork_ID='" + HomeWork_Id + "' and StudentId='" + StudentId + "' "); if (listSCSHW.Count > 0) { isCorrect = true; this.Title = listSCSHW[0].Resource_Name.ReplaceForFilter(); this.ltlTitle.Text = listSCSHW[0].Resource_Name.ReplaceForFilter() + "<span class='panel_state bg-success'>已完成批改</span>"; ltlGradeSubject.Text = string.Format("<li>年级:{0}</li><li>班级:{1}</li><li>学生:{2}</li><li>满分:{3}分</li><li>得分:{4}分</li>" , listSCSHW[0].GradeName , listSCSHW[0].ClassName , listSCSHW[0].StudentName , listSCSHW[0].HWScore.ToString().clearLastZero() , listSCSHW[0].StudentScore.ToString().clearLastZero()); } } else { #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.ltlTitle.Text = dtw.Rows[0]["HomeWork_Name"].ToString() + "<span class='panel_state bg-warning'>未完成批改</span>"; ltlGradeSubject.Text = string.Format("<span>年级:{0}</span><span>班级:{1}</span><span>学生:{2}</span><span>满分:{3}分</span><span>得分:{4}分</span>" , dtw.Rows[0]["GradeName"] , dtw.Rows[0]["ClassName"] , string.IsNullOrEmpty(dtw.Rows[0]["TrueName"].ToString()) ? dtw.Rows[0]["UserName"] : dtw.Rows[0]["TrueName"] , dtw.Rows[0]["HWScore"].ToString().clearLastZero() , dtw.Rows[0]["StudentScore"].ToString().clearLastZero()); if (dtw.Rows[0]["Student_HomeWork_CorrectStatus"].ToString() == "1") { isCorrect = true; } #endregion } StringBuilder stbLink = new StringBuilder(); stbLink.AppendFormat("<li {3}><a href=\"OHomeWorkViewTT.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}\">批改详情</a></li>" , ResourceToResourceFolder_Id , HomeWork_Id , StudentId , (isShowWrong ? "" : "class=\"active\"")); if (isCorrect) { stbLink.AppendFormat("<li {3}><a href=\"OHomeWorkViewTT.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}&wrong=w\">错题详情</a></li>" , ResourceToResourceFolder_Id, HomeWork_Id, StudentId, (isShowWrong ? "class=\"active\"" : "")); stbLink.AppendFormat("<li><a href=\"../Evaluation/StudentAnalysisReports.aspx?ResourceToResourceFolder_Id={0}&HomeWork_Id={1}&StudentId={2}\">分析报告</a></li>" , ResourceToResourceFolder_Id, HomeWork_Id, StudentId); } ltlLink.Text = stbLink.ToString(); //listHW_TQ = new BLL_StatsClassHW_TQ().GetModelList("ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' and HomeWork_Id='" + HomeWork_Id + "' "); DataTable dtSHW = new BLL_Student_HomeWork().GetList("HomeWork_Id='" + HomeWork_Id + "' and Student_Id='" + StudentId + "'").Tables[0]; if (dtSHW.Rows.Count == 1) { Student_HomeWork_Id = dtSHW.Rows[0]["Student_HomeWork_Id"].ToString(); } if (!IsPostBack) { } } catch (Exception) { Response.Write("页面加载失败..."); Response.End(); } }
private void LoadData() { Model_Student_HomeWork modelSHW = new BLL_Student_HomeWork().GetModel(stuHomeWorkId); if (modelSHW != null) { Student_Id = modelSHW.Student_Id; string strSqlStudentClass = @"select um.User_ID,ug.UserGroup_Name,u.UserName,u.TrueName from dbo.UserGroup_Member um left join UserGroup ug on um.UserGroup_Id=ug.UserGroup_Id inner join F_User u on u.UserId=um.User_ID where um.User_ApplicationStatus='passed' and ug.UserGroup_Id='" + ClassId + "' and um.User_Id='" + modelSHW.Student_Id + "'"; DataTable dtStudentClass = Rc.Common.DBUtility.DbHelperSQL.Query(strSqlStudentClass).Tables[0]; if (dtStudentClass.Rows.Count == 1) { ltlStudentName.Text = string.IsNullOrEmpty(dtStudentClass.Rows[0]["TrueName"].ToString()) ? dtStudentClass.Rows[0]["UserName"].ToString() : dtStudentClass.Rows[0]["TrueName"].ToString(); ltlClassName.Text = dtStudentClass.Rows[0]["UserGroup_Name"].ToString(); } } choice.Visible = choice2.Visible = truefalse.Visible = truefalse2.Visible = false; DataTable dt = new DataTable(); #region 择题、完形填空题 string strSqlSel = string.Empty; strSqlSel = @"select SHWA.*,TQS.TestCorrect,TQS.TestQuestions_Score,TQS.TestType,TQS.testIndex,tq.topicNumber from TestQuestions_Score TQS inner join TestQuestions tq on tq.TestQuestions_Id=TQS.TestQuestions_Id and tq.Parent_Id='' left join Student_HomeWorkAnswer SHWA on TQS.TestQuestions_Id=SHWA.TestQuestions_Id and TQS.TestQuestions_Score_ID=SHWA.TestQuestions_Score_ID where 1=1 "; strSqlSel += string.Format("AND Student_HomeWork_Id='{0}'", stuHomeWorkId); strSqlSel += " and TQS.TestType in('selection','clozeTest') order by SHWA.TestQuestions_Num,SHWA.TestQuestions_Detail_OrderNum "; string strSqlSelection = strSqlSel + " "; dt = Rc.Common.DBUtility.DbHelperSQL.Query(strSqlSelection).Tables[0]; rptStuHomeworkSelection.DataSource = dt; rptStuHomeworkSelection.DataBind(); if (dt.Rows.Count > 0) { choice.Visible = choice2.Visible = true; } #endregion #region 判断题 string strSqlTruefalse = string.Empty; strSqlTruefalse = @"select SHWA.*,TQS.TestCorrect,TQS.TestQuestions_Score from TestQuestions_Score TQS inner join TestQuestions tq on tq.TestQuestions_Id=TQS.TestQuestions_Id and tq.Parent_Id='' left join Student_HomeWorkAnswer SHWA on TQS.TestQuestions_Id=SHWA.TestQuestions_Id and TQS.TestQuestions_Score_ID=SHWA.TestQuestions_Score_ID where 1=1 "; strSqlTruefalse += string.Format("AND Student_HomeWork_Id='{0}'", stuHomeWorkId); strSqlTruefalse += " and TQS.TestType='truefalse' order by SHWA.TestQuestions_Num,SHWA.TestQuestions_Detail_OrderNum "; dt = Rc.Common.DBUtility.DbHelperSQL.Query(strSqlTruefalse).Tables[0]; rptStuHomeworkTruefalse.DataSource = dt; rptStuHomeworkTruefalse.DataBind(); if (dt.Rows.Count > 0) { truefalse.Visible = truefalse2.Visible = true; } #endregion #region 普通题型 list 得分情况 string strSql = string.Format(@"select t.TestType,SUM(t.TestQuestions_Score) as FullScore,SUM(t2.Student_Score) as StuScore from TestQuestions_Score t inner join TestQuestions tq on tq.TestQuestions_Id=t.TestQuestions_Id and tq.Parent_Id='' left join Student_HomeWorkAnswer t2 on t2.TestQuestions_Score_ID=t.TestQuestions_Score_ID and t2.Student_Id='{0}' where t.ResourceToResourceFolder_Id='{1}' group by t.TestType ", Student_Id, ResourceToResourceFolder_Id); dtStuScore = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0]; #endregion #region 综合题型 listBig 得分情况 string strSqlBig = string.Format(@"select tq.Parent_Id,t.TestType,SUM(t.TestQuestions_Score) as FullScore,SUM(t2.Student_Score) as StuScore from TestQuestions_Score t inner join TestQuestions tq on tq.TestQuestions_Id=t.TestQuestions_Id and tq.Parent_Id<>'0' and tq.Parent_Id<>'' left join Student_HomeWorkAnswer t2 on t2.TestQuestions_Score_ID=t.TestQuestions_Score_ID and t2.Student_Id='{0}' where t.ResourceToResourceFolder_Id='{1}' group by tq.Parent_Id,t.TestType ", Student_Id, ResourceToResourceFolder_Id); dtStuScoreBig = Rc.Common.DBUtility.DbHelperSQL.Query(strSqlBig).Tables[0]; #endregion }