public static string GetStatsGradeHW_TQ(string GradeId, string ResourceToResourceFolder_Id) { try { GradeId = GradeId.Filter(); ResourceToResourceFolder_Id = ResourceToResourceFolder_Id.Filter(); string Temps = "<tr><td>{0}</td><td>{1}</td><td class='text-left'>{2}</td><td class='text-left'>{3}</td><td>{4}</td><td>{5}</td><td>{6}</td><td>{7}</td><td>{8}</td><td>{9}%</td><td class='table_opera'><a style='cursor:pointer;' onclick=\"javascript:PicPreview('../student/questionAttr.aspx?resourceid={10}&questionid={11}&attrType=AnalyzeHtml','解析');\">解析</a></td></tr>"; string TempDate = string.Empty; DataTable dtTQ_S = new BLL_TestQuestions_Score().GetList("ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' order by TestQuestions_Num,TestQuestions_OrderNum ").Tables[0]; BLL_StatsGradeHW_TQ bllStatsGradeHW_TQ = new BLL_StatsGradeHW_TQ(); List <Model_StatsGradeHW_TQ> StatsGradeHW_TQList = new List <Model_StatsGradeHW_TQ>(); StatsGradeHW_TQList = bllStatsGradeHW_TQ.GetModelList("TQ_Score!=-1 and GradeID='" + GradeId + "' and ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' order by TestQuestions_Num,TestQuestions_OrderNum"); foreach (var item in StatsGradeHW_TQList) { List <Model_StatsGradeHW_TQ> listSub = StatsGradeHW_TQList.Where(m => m.TestQuestions_Num == item.TestQuestions_Num).ToList(); DataRow[] drTQ_S = dtTQ_S.Select("TestQuestions_Score_ID='" + item.TestQuestions_Score_ID + "'"); string testIndex = string.Empty; if (drTQ_S.Length > 0 && (drTQ_S[0]["TestType"].ToString() == "clozeTest" || drTQ_S[0]["TestType"].ToString() == "fill")) { testIndex = string.IsNullOrEmpty(drTQ_S[0]["testIndex"].ToString()) ? "" : "-" + drTQ_S[0]["testIndex"].ToString(); } TempDate += string.Format(Temps , item.topicNumber.TrimEnd('.') + testIndex , item.TestQuestions_Type, item.TargetText, item.ContentText, item.complexityText, item.TQ_Score.ToString().clearLastZero(), item.ScoreAvg.ToString().clearLastZero(), item.StandardDeviation.ToString().clearLastZero(), item.Discrimination.ToString().clearLastZero(), item.ErrorRate.ToString().clearLastZero(), item.ResourceToResourceFolder_Id, item.TestQuestions_Score_ID); } return(TempDate); } catch (Exception) { return(""); } }
public static string AddAtrr(string ScoreId, string AttrId, string TestQuestions_Knowledge_ID) { try { ScoreId = ScoreId.Filter(); AttrId = AttrId.Filter(); TestQuestions_Knowledge_ID = TestQuestions_Knowledge_ID.Filter(); Rc.Cloud.Model.Model_VSysUserRole loginUser = (Rc.Cloud.Model.Model_VSysUserRole)HttpContext.Current.Session["LoginUser"]; Model_TestQuestions_Score score = new BLL_TestQuestions_Score().GetModel(ScoreId); Model_S_TestQuestions_TP model = new Model_S_TestQuestions_TP(); model.S_TestQuestions_TP_Id = TestQuestions_Knowledge_ID; model.S_TestingPoint_Id = AttrId; model.TestQuestions_Score_ID = ScoreId; model.TestQuestions_Id = score.TestQuestions_Id; model.ResourceToResourceFolder_Id = score.ResourceToResourceFolder_Id; model.CreateUser = loginUser.SysUser_ID; model.CreateTime = DateTime.Now; if (new BLL_S_TestQuestions_TP().Add(model)) { return("1"); } else { return(""); } } catch (Exception ex) { return(""); } }
public static string GetStatsClassHW_KP(string Class, string ResourceToResourceFolder_Id, string UserId, string KPName, string KPScoreAvgRate) { try { Class = Class.Filter(); ResourceToResourceFolder_Id = ResourceToResourceFolder_Id.Filter(); UserId = UserId.Filter(); KPName = KPName.Filter(); KPScoreAvgRate = KPScoreAvgRate.Filter(); string TempDate = string.Empty; string StrWhere = string.Empty; string ClassName = string.Empty; if (!string.IsNullOrEmpty(KPName)) { StrWhere += " and KPName like '%" + KPName.TrimEnd() + "%'"; } if (!string.IsNullOrEmpty(KPScoreAvgRate)) { StrWhere += " and KPScoreAvgRate<" + KPScoreAvgRate.TrimEnd() + ""; } // string Temp = "<tr><td>数列的极限</td><td>20</td><td>90%</td><td><a href="##">第1题</a><a href="##">第3题</a></td></tr>"; string Temp = "<tr><td>{0}</td><td>{1}</td><td>{2}%</td><td>{3}</td><td><a href='{4}' target='_blank'>查看</a></td></tr>"; string KPNames = string.Empty; string KPScoreAvgRates = string.Empty; //name: '一班',data: [83, 78, 98, 93, 56, 84, 65, 104, 91, 83] DataTable dtTQ_S = new BLL_TestQuestions_Score().GetList("ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' order by TestQuestions_Num,TestQuestions_OrderNum ").Tables[0]; if (Class == "-1") { HttpContext.Current.Session["StatsClassClassId"] = "-1"; BLL_StatsTeacherHW_KP bllTeacherHW_KP = new BLL_StatsTeacherHW_KP(); List <Model_StatsTeacherHW_KP> TeacherHW_KPList = new List <Model_StatsTeacherHW_KP>(); TeacherHW_KPList = bllTeacherHW_KP.GetModelList("TeacherID='" + UserId + "' and ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "'" + StrWhere + " order by TestQuestionNums "); foreach (var item in TeacherHW_KPList) { TempDate += string.Format(Temp , item.KPName , item.KPScoreSum.ToString().clearLastZero() , item.KPScoreAvgRate.ToString().clearLastZero() , GetTQNum(dtTQ_S, item.KPName, item.ResourceToResourceFolder_Id, item.TestQuestionNumStrs, item.TestQuestionNums) , "HisKlgAnalysisSource.aspx?SubjectID=" + item.SubjectID + "&ClassID=&KPName=" + Rc.Common.DBUtility.DESEncrypt.Encrypt(item.KPName.ToString()) + "&DateData=&DateType=month&TeacherId=" + item.TeacherID ); KPScoreAvgRates += item.KPScoreAvgRate.ToString().clearLastZero() + ","; KPNames += item.KPName + ","; } if (TempDate == "") { return(""); } else { return(TempDate + "|全部班级|" + KPScoreAvgRates.TrimEnd(',') + "|" + KPNames.TrimEnd(',')); } } else { HttpContext.Current.Session["StatsClassClassId"] = Class; BLL_StatsClassHW_KP bllClassHW_KP = new BLL_StatsClassHW_KP(); List <Model_StatsClassHW_KP> ClassHW_KPList = new List <Model_StatsClassHW_KP>(); ClassHW_KPList = bllClassHW_KP.GetModelList("ClassID='" + Class + "' and ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' " + StrWhere + " order by TestQuestionNums "); foreach (var item in ClassHW_KPList) { TempDate += string.Format(Temp , item.KPName , item.KPScoreSum.ToString().clearLastZero() , item.KPScoreAvgRate.ToString().clearLastZero() , GetTQNum(dtTQ_S, item.KPName, item.ResourceToResourceFolder_Id, item.TestQuestionNumStrs, item.TestQuestionNums) , "HisKlgAnalysisSource.aspx?SubjectID=" + item.SubjectID + "&ClassID=" + item.ClassID + "&KPName=" + Rc.Common.DBUtility.DESEncrypt.Encrypt(item.KPName.ToString()) + "&DateData=" + pfunction.ConvertToLongDateTime(item.HomeWorkCreateTime.ToString(), "yyyy-MM") + "&DateType=month&TeacherId=" + item.TeacherID ); KPScoreAvgRates += item.KPScoreAvgRate.ToString().clearLastZero() + ","; KPNames += item.KPName + ","; ClassName = item.ClassName; } if (TempDate == "") { return(""); } else { return(TempDate + "|" + ClassName + "|" + KPScoreAvgRates.TrimEnd(',') + "|" + KPNames.TrimEnd(',')); } } } catch (Exception) { return(""); } }
/// <summary> /// 执行数据同步 /// </summary> private void ExecSyncData(string strFileSyncExecRecord_id) { //所有需要同步数据new DataTable dtAll = new DataTable(); dtAll = new BLL_SyncData().GetList("SyncStatus='0' or SyncStatus='2' ").Tables[0]; if (dtAll.Rows.Count > 0) { DataView dataView = dtAll.DefaultView; dtAll = dataView.ToTable(true, "TableName", "DataId", "OperateType"); } //ResourceFolder数据 DataTable dtRF = new DataTable(); DataRow[] drRF = null; if (dtAll.Rows.Count > 0) { drRF = dtAll.Select("TableName='ResourceFolder'"); } if (drRF != null && drRF.Length > 0) { dtRF = drRF.CopyToDataTable(); } //ResourceToResourceFolder数据(delete) DataTable dtRTRF_Delete = new DataTable(); DataRow[] drRTRF_Delete = null; if (dtAll.Rows.Count > 0) { drRTRF_Delete = dtAll.Select("TableName='ResourceToResourceFolder' and OperateType='delete'"); } if (drRTRF_Delete != null && drRTRF_Delete.Length > 0) { dtRTRF_Delete = drRTRF_Delete.CopyToDataTable(); } //ResourceToResourceFolder数据(move,rename) DataTable dtRTRF_MoveRename = new DataTable(); DataRow[] drRTRF_MoveRename = null; if (dtAll.Rows.Count > 0) { drRTRF_MoveRename = dtAll.Select("TableName='ResourceToResourceFolder' and (OperateType='move' or OperateType='rename') "); } if (drRTRF_MoveRename != null && drRTRF_MoveRename.Length > 0) { dtRTRF_MoveRename = drRTRF_MoveRename.CopyToDataTable(); } //ResourceToResourceFolder数据(add,modify) DataTable dtRTRF_AddModify = new DataTable(); DataRow[] drRTRF_AddModify = null; if (dtAll.Rows.Count > 0) { drRTRF_AddModify = dtAll.Select("TableName='ResourceToResourceFolder' and (OperateType='modify' or OperateType='add') "); } if (drRTRF_AddModify != null && drRTRF_AddModify.Length > 0) { dtRTRF_AddModify = drRTRF_AddModify.CopyToDataTable(); } if (dtRTRF_AddModify.Rows.Count > 0) { DataView dataView = dtRTRF_AddModify.DefaultView; dtRTRF_AddModify = dataView.ToTable(true, "DataId"); } StringBuilder stbRF = new StringBuilder(); StringBuilder stbRTRF_Delete = new StringBuilder(); StringBuilder stbRTRF_MoveRename = new StringBuilder(); StringBuilder stbRTRF_AddModify = new StringBuilder(); #region ①删除ResourceToResourceFolder数据(delete) Rc.Model.Resources.Model_FileSyncExecRecordDetail model_FileSyncExecRecordDetail = new Rc.Model.Resources.Model_FileSyncExecRecordDetail(); Rc.BLL.Resources.BLL_FileSyncExecRecordDetail bll_FileSyncExecRecordDetail = new Rc.BLL.Resources.BLL_FileSyncExecRecordDetail(); model_FileSyncExecRecordDetail.FileSyncExecRecordDetail_id = Guid.NewGuid().ToString(); model_FileSyncExecRecordDetail.FileSyncExecRecord_id = strFileSyncExecRecord_id; model_FileSyncExecRecordDetail.Detail_Remark = "①删除ResourceToResourceFolder数据(delete)"; model_FileSyncExecRecordDetail.Detail_Status = "0"; model_FileSyncExecRecordDetail.Detail_TimeStart = DateTime.Now; bll_FileSyncExecRecordDetail.Add(model_FileSyncExecRecordDetail); foreach (DataRow item in dtRTRF_Delete.Rows) { stbRTRF_Delete = new StringBuilder(); stbRTRF_Delete.Append("declare @resourceId char(36);"); stbRTRF_Delete.AppendFormat(@"delete from TestQuestions_Option where TestQuestions_Id in(select TestQuestions_Id from TestQuestions where ResourceToResourceFolder_Id='{0}'); delete from TestQuestions_Score where ResourceToResourceFolder_Id='{0}'; delete from TestQuestions where ResourceToResourceFolder_Id='{0}'; delete from ResourceToResourceFolder_Property where ResourceToResourceFolder_Id='{0}'; delete from ResourceToResourceFolder_img where ResourceToResourceFolder_Id='{0}'; select @resourceId=Resource_Id from ResourceToResourceFolder where ResourceToResourceFolder_Id='{0}'; delete from ResourceToResourceFolder where ResourceToResourceFolder_Id='{0}'; delete from [Resource] where Resource_Id=@resourceId;", item["DataId"]); DbHelperSQL_Operate.ExecuteSqlByTime(stbRTRF_Delete.ToString(), 7200); DbHelperSQL.ExecuteSqlByTime(string.Format("update SyncData set SyncStatus='1' where OperateType='delete' and DataId='{0}'; ", item["DataId"]), 60); } model_FileSyncExecRecordDetail.Detail_Status = "1"; model_FileSyncExecRecordDetail.Detail_TimeEnd = DateTime.Now; bll_FileSyncExecRecordDetail.Update(model_FileSyncExecRecordDetail); #endregion #region ②同步ResourceFolder数据 model_FileSyncExecRecordDetail = new Rc.Model.Resources.Model_FileSyncExecRecordDetail(); model_FileSyncExecRecordDetail.FileSyncExecRecordDetail_id = Guid.NewGuid().ToString(); model_FileSyncExecRecordDetail.FileSyncExecRecord_id = strFileSyncExecRecord_id; model_FileSyncExecRecordDetail.Detail_Remark = "②同步ResourceFolder数据"; model_FileSyncExecRecordDetail.Detail_Status = "0"; model_FileSyncExecRecordDetail.Detail_TimeStart = DateTime.Now; bll_FileSyncExecRecordDetail.Add(model_FileSyncExecRecordDetail); foreach (DataRow item in dtRF.Rows) { stbRF = new StringBuilder(); #region delete if (item["OperateType"].ToString() == "delete") { stbRF.AppendFormat("delete from ResourceFolder where ResourceFolder_Id='{0}'; ", item["DataId"]); } #endregion DataTable dtSub = new BLL_ResourceFolder().GetList("ResourceFolder_Id='" + item["DataId"] + "'").Tables[0]; if (dtSub.Rows.Count == 1) { #region move,rename if (item["OperateType"].ToString() == "move" || item["OperateType"].ToString() == "rename") { stbRF.Append("update ResourceFolder set "); stbRF.AppendFormat("ResourceFolder_ParentId='{0}',", dtSub.Rows[0]["ResourceFolder_ParentId"]); stbRF.AppendFormat("ResourceFolder_Name=N'{0}',", dtSub.Rows[0]["ResourceFolder_Name"]); stbRF.AppendFormat("ResourceFolder_Level='{0}',", dtSub.Rows[0]["ResourceFolder_Level"]); stbRF.AppendFormat("Resource_Type='{0}',", dtSub.Rows[0]["Resource_Type"]); stbRF.AppendFormat("Resource_Class='{0}',", dtSub.Rows[0]["Resource_Class"]); stbRF.AppendFormat("Resource_Version='{0}',", dtSub.Rows[0]["Resource_Version"]); stbRF.AppendFormat("ResourceFolder_Remark='{0}',", dtSub.Rows[0]["ResourceFolder_Remark"]); stbRF.AppendFormat("ResourceFolder_Order='{0}',", dtSub.Rows[0]["ResourceFolder_Order"]); stbRF.AppendFormat("ResourceFolder_Owner='{0}',", dtSub.Rows[0]["ResourceFolder_Owner"]); stbRF.AppendFormat("CreateFUser='******',", dtSub.Rows[0]["CreateFUser"]); stbRF.AppendFormat("CreateTime='{0}',", dtSub.Rows[0]["CreateTime"]); stbRF.AppendFormat("ResourceFolder_isLast='{0}',", dtSub.Rows[0]["ResourceFolder_isLast"]); stbRF.AppendFormat("LessonPlan_Type='{0}',", dtSub.Rows[0]["LessonPlan_Type"]); stbRF.AppendFormat("GradeTerm='{0}',", dtSub.Rows[0]["GradeTerm"]); stbRF.AppendFormat("Subject='{0}',", dtSub.Rows[0]["Subject"]); stbRF.AppendFormat("Book_ID='{0}',", dtSub.Rows[0]["Book_ID"]); stbRF.AppendFormat("ParticularYear='{0}'", dtSub.Rows[0]["ParticularYear"]); stbRF.AppendFormat(" where ResourceFolder_Id='{0}' ", dtSub.Rows[0]["ResourceFolder_Id"]); } #endregion #region add if (item["OperateType"].ToString() == "add") { stbRF.AppendFormat("if(select COUNT(1) from ResourceFolder where ResourceFolder_Id='{0}')=0 insert into ResourceFolder(ResourceFolder_Id,ResourceFolder_ParentId,ResourceFolder_Name,ResourceFolder_Level,Resource_Type,Resource_Class,Resource_Version,ResourceFolder_Remark,ResourceFolder_Order,ResourceFolder_Owner,CreateFUser,CreateTime,ResourceFolder_isLast,LessonPlan_Type,GradeTerm,Subject,Book_ID,ParticularYear)", dtSub.Rows[0]["ResourceFolder_Id"]); stbRF.AppendFormat(" values ('{0}','{1}',N'{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}');" , dtSub.Rows[0]["ResourceFolder_Id"] , dtSub.Rows[0]["ResourceFolder_ParentId"] , dtSub.Rows[0]["ResourceFolder_Name"] , dtSub.Rows[0]["ResourceFolder_Level"] , dtSub.Rows[0]["Resource_Type"] , dtSub.Rows[0]["Resource_Class"] , dtSub.Rows[0]["Resource_Version"] , dtSub.Rows[0]["ResourceFolder_Remark"] , dtSub.Rows[0]["ResourceFolder_Order"] , dtSub.Rows[0]["ResourceFolder_Owner"] , dtSub.Rows[0]["CreateFUser"] , dtSub.Rows[0]["CreateTime"] , dtSub.Rows[0]["ResourceFolder_isLast"] , dtSub.Rows[0]["LessonPlan_Type"] , dtSub.Rows[0]["GradeTerm"] , dtSub.Rows[0]["Subject"] , dtSub.Rows[0]["Book_ID"] , dtSub.Rows[0]["ParticularYear"]); } #endregion } if (!string.IsNullOrEmpty(stbRF.ToString())) { DbHelperSQL_Operate.ExecuteSqlByTime(stbRF.ToString(), 7200); } DbHelperSQL.ExecuteSqlByTime(string.Format("update SyncData set SyncStatus='1' where TableName='ResourceFolder' and DataId='{0}'; ", item["DataId"]), 60); } model_FileSyncExecRecordDetail.Detail_Status = "1"; model_FileSyncExecRecordDetail.Detail_TimeEnd = DateTime.Now; bll_FileSyncExecRecordDetail.Update(model_FileSyncExecRecordDetail); #endregion #region ③更新ResourceToResourceFolder数据(move,rename) model_FileSyncExecRecordDetail = new Rc.Model.Resources.Model_FileSyncExecRecordDetail(); model_FileSyncExecRecordDetail.FileSyncExecRecordDetail_id = Guid.NewGuid().ToString(); model_FileSyncExecRecordDetail.FileSyncExecRecord_id = strFileSyncExecRecord_id; model_FileSyncExecRecordDetail.Detail_Remark = "③更新ResourceToResourceFolder数据(move,rename)"; model_FileSyncExecRecordDetail.Detail_Status = "0"; model_FileSyncExecRecordDetail.Detail_TimeStart = DateTime.Now; bll_FileSyncExecRecordDetail.Add(model_FileSyncExecRecordDetail); foreach (DataRow item in dtRTRF_MoveRename.Rows) { stbRTRF_MoveRename = new StringBuilder(); DataTable dtSub = new BLL_ResourceToResourceFolder().GetList("ResourceToResourceFolder_Id='" + item["DataId"] + "'").Tables[0]; if (dtSub.Rows.Count == 1) { stbRTRF_MoveRename.Append("update ResourceToResourceFolder set "); stbRTRF_MoveRename.AppendFormat("ResourceFolder_Id='{0}',", dtSub.Rows[0]["ResourceFolder_Id"]); stbRTRF_MoveRename.AppendFormat("Resource_Id='{0}',", dtSub.Rows[0]["Resource_Id"]); stbRTRF_MoveRename.AppendFormat("File_Name=N'{0}',", dtSub.Rows[0]["File_Name"]); stbRTRF_MoveRename.AppendFormat("Resource_Type='{0}',", dtSub.Rows[0]["Resource_Type"]); stbRTRF_MoveRename.AppendFormat("Resource_Name=N'{0}',", dtSub.Rows[0]["Resource_Name"]); stbRTRF_MoveRename.AppendFormat("Resource_Class='{0}',", dtSub.Rows[0]["Resource_Class"]); stbRTRF_MoveRename.AppendFormat("Resource_Version='{0}',", dtSub.Rows[0]["Resource_Version"]); stbRTRF_MoveRename.AppendFormat("File_Owner='{0}',", dtSub.Rows[0]["File_Owner"]); stbRTRF_MoveRename.AppendFormat("CreateFUser='******',", dtSub.Rows[0]["CreateFUser"]); stbRTRF_MoveRename.AppendFormat("CreateTime='{0}',", dtSub.Rows[0]["CreateTime"]); stbRTRF_MoveRename.AppendFormat("UpdateTime='{0}',", dtSub.Rows[0]["UpdateTime"]); stbRTRF_MoveRename.AppendFormat("File_Suffix='{0}',", dtSub.Rows[0]["File_Suffix"]); stbRTRF_MoveRename.AppendFormat("LessonPlan_Type='{0}',", dtSub.Rows[0]["LessonPlan_Type"]); stbRTRF_MoveRename.AppendFormat("GradeTerm='{0}',", dtSub.Rows[0]["GradeTerm"]); stbRTRF_MoveRename.AppendFormat("Subject='{0}',", dtSub.Rows[0]["Subject"]); stbRTRF_MoveRename.AppendFormat("Resource_Domain='{0}',", dtSub.Rows[0]["Resource_Domain"]); stbRTRF_MoveRename.AppendFormat("Resource_Url='{0}',", dtSub.Rows[0]["Resource_Url"]); stbRTRF_MoveRename.AppendFormat("Resource_shared='{0}',", dtSub.Rows[0]["Resource_shared"]); stbRTRF_MoveRename.AppendFormat("Book_ID='{0}',", dtSub.Rows[0]["Book_ID"]); stbRTRF_MoveRename.AppendFormat("ParticularYear='{0}',", dtSub.Rows[0]["ParticularYear"]); stbRTRF_MoveRename.AppendFormat("ResourceToResourceFolder_Order='{0}'", dtSub.Rows[0]["ResourceToResourceFolder_Order"]); stbRTRF_MoveRename.AppendFormat(" where ResourceToResourceFolder_Id='{0}'; ", dtSub.Rows[0]["ResourceToResourceFolder_Id"]); } if (!string.IsNullOrEmpty(stbRTRF_MoveRename.ToString())) { DbHelperSQL_Operate.ExecuteSqlByTime(stbRTRF_MoveRename.ToString(), 7200); } DbHelperSQL.ExecuteSqlByTime(string.Format("update SyncData set SyncStatus='1' where TableName='ResourceToResourceFolder' and (OperateType='move' or OperateType='rename') and DataId='{0}'; ", item["DataId"]), 60); } model_FileSyncExecRecordDetail.Detail_Status = "1"; model_FileSyncExecRecordDetail.Detail_TimeEnd = DateTime.Now; bll_FileSyncExecRecordDetail.Update(model_FileSyncExecRecordDetail); #endregion #region ④同步ResourceToResourceFolder数据 先删除数据 再增加数据(add,modify) model_FileSyncExecRecordDetail = new Rc.Model.Resources.Model_FileSyncExecRecordDetail(); model_FileSyncExecRecordDetail.FileSyncExecRecordDetail_id = Guid.NewGuid().ToString(); model_FileSyncExecRecordDetail.FileSyncExecRecord_id = strFileSyncExecRecord_id; model_FileSyncExecRecordDetail.Detail_Remark = "④同步ResourceToResourceFolder数据 先删除数据 再增加数据(add,modify)"; model_FileSyncExecRecordDetail.Detail_Status = "0"; model_FileSyncExecRecordDetail.Detail_TimeStart = DateTime.Now; bll_FileSyncExecRecordDetail.Add(model_FileSyncExecRecordDetail); foreach (DataRow item in dtRTRF_AddModify.Rows) { string resourceId = DbHelperSQL.GetSingle("select isnull(max(Resource_Id),'') from ResourceToResourceFolder where ResourceToResourceFolder_Id='" + item["DataId"] + "'").ToString(); if (!string.IsNullOrEmpty(resourceId.Trim())) { //删除数据 stbRTRF_AddModify = new StringBuilder(); stbRTRF_AddModify.AppendFormat(@"delete from TestQuestions_Option where TestQuestions_Id in(select TestQuestions_Id from TestQuestions where ResourceToResourceFolder_Id='{0}'); delete from TestQuestions_Score where ResourceToResourceFolder_Id='{0}'; delete from TestQuestions where ResourceToResourceFolder_Id='{0}'; delete from ResourceToResourceFolder_Property where ResourceToResourceFolder_Id='{0}'; delete from ResourceToResourceFolder_img where ResourceToResourceFolder_Id='{0}'; delete from ResourceToResourceFolder where ResourceToResourceFolder_Id='{0}'; delete from [Resource] where Resource_Id='{1}';" , item["DataId"] , resourceId); AddLogInfo(string.Format("{0}--结束--", stbRTRF_AddModify.ToString()), true); if (!string.IsNullOrEmpty(stbRTRF_AddModify.ToString())) { DbHelperSQL_Operate.ExecuteSqlByTime(stbRTRF_AddModify.ToString(), 7200); } //新增数据 #region Resource stbRTRF_AddModify = new StringBuilder(); DataTable dtRes = new BLL_Resource().GetList("Resource_Id='" + resourceId + "'").Tables[0]; stbRTRF_AddModify.Append("insert into Resource(Resource_Id,Resource_MD5,Resource_DataStrem,Resource_ContentHtml,CreateTime,Resource_ContentLength)"); stbRTRF_AddModify.AppendFormat(" values ('{0}','{1}','{2}','{3}','{4}','{5}');" , dtRes.Rows[0]["Resource_Id"] , dtRes.Rows[0]["Resource_MD5"] , dtRes.Rows[0]["Resource_DataStrem"] , dtRes.Rows[0]["Resource_ContentHtml"] , dtRes.Rows[0]["CreateTime"] , dtRes.Rows[0]["Resource_ContentLength"]); AddLogInfo(string.Format("{0}--结束--", stbRTRF_AddModify.ToString()), true); if (!string.IsNullOrEmpty(stbRTRF_AddModify.ToString())) { DbHelperSQL_Operate.ExecuteSqlByTime(stbRTRF_AddModify.ToString(), 7200); } #endregion #region ResourceToResourceFolder stbRTRF_AddModify = new StringBuilder(); DataTable dtRTRF = new BLL_ResourceToResourceFolder().GetList("ResourceToResourceFolder_Id='" + item["DataId"] + "'").Tables[0]; stbRTRF_AddModify.Append("insert into ResourceToResourceFolder(ResourceToResourceFolder_Id,ResourceFolder_Id,Resource_Id,File_Name,Resource_Type,Resource_Name,Resource_Class,Resource_Version,File_Owner,CreateFUser,CreateTime,UpdateTime,File_Suffix,LessonPlan_Type,GradeTerm,Subject,Resource_Domain,Resource_Url,Resource_shared,Book_ID,ParticularYear,ResourceToResourceFolder_Order)"); stbRTRF_AddModify.AppendFormat(" values ('{0}','{1}','{2}',N'{3}','{4}',N'{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}');" , dtRTRF.Rows[0]["ResourceToResourceFolder_Id"] , dtRTRF.Rows[0]["ResourceFolder_Id"] , dtRTRF.Rows[0]["Resource_Id"] , dtRTRF.Rows[0]["File_Name"] , dtRTRF.Rows[0]["Resource_Type"] , dtRTRF.Rows[0]["Resource_Name"] , dtRTRF.Rows[0]["Resource_Class"] , dtRTRF.Rows[0]["Resource_Version"] , dtRTRF.Rows[0]["File_Owner"] , dtRTRF.Rows[0]["CreateFUser"] , dtRTRF.Rows[0]["CreateTime"] , dtRTRF.Rows[0]["UpdateTime"] , dtRTRF.Rows[0]["File_Suffix"] , dtRTRF.Rows[0]["LessonPlan_Type"] , dtRTRF.Rows[0]["GradeTerm"] , dtRTRF.Rows[0]["Subject"] , dtRTRF.Rows[0]["Resource_Domain"] , dtRTRF.Rows[0]["Resource_Url"] , dtRTRF.Rows[0]["Resource_shared"] , dtRTRF.Rows[0]["Book_ID"] , dtRTRF.Rows[0]["ParticularYear"] , dtRTRF.Rows[0]["ResourceToResourceFolder_Order"]); AddLogInfo(string.Format("{0}--结束--", stbRTRF_AddModify.ToString()), true); if (!string.IsNullOrEmpty(stbRTRF_AddModify.ToString())) { DbHelperSQL_Operate.ExecuteSqlByTime(stbRTRF_AddModify.ToString(), 7200); } #endregion #region ResourceToResourceFolder_img stbRTRF_AddModify = new StringBuilder(); DataTable dtRTRF_Img = new BLL_ResourceToResourceFolder_img().GetList("ResourceToResourceFolder_Id='" + item["DataId"] + "'").Tables[0]; foreach (DataRow item_Img in dtRTRF_Img.Rows) { stbRTRF_AddModify.Append("insert into ResourceToResourceFolder_img(ResourceToResourceFolder_img_id,ResourceToResourceFolder_id,ResourceToResourceFolderImg_Url,ResourceToResourceFolderImg_Order,CreateTime)"); stbRTRF_AddModify.AppendFormat(" values ('{0}','{1}','{2}','{3}','{4}');" , item_Img["ResourceToResourceFolder_img_id"] , item_Img["ResourceToResourceFolder_id"] , item_Img["ResourceToResourceFolderImg_Url"] , item_Img["ResourceToResourceFolderImg_Order"] , item_Img["CreateTime"]); } AddLogInfo(string.Format("{0}--结束--", stbRTRF_AddModify.ToString()), true); if (!string.IsNullOrEmpty(stbRTRF_AddModify.ToString())) { DbHelperSQL_Operate.ExecuteSqlByTime(stbRTRF_AddModify.ToString(), 7200); } #endregion #region ResourceToResourceFolder_Property stbRTRF_AddModify = new StringBuilder(); DataTable dtRTRF_Property = new BLL_ResourceToResourceFolder_Property().GetList("ResourceToResourceFolder_Id='" + item["DataId"] + "'").Tables[0]; foreach (DataRow item_Property in dtRTRF_Property.Rows) { stbRTRF_AddModify.Append("insert into ResourceToResourceFolder_Property(ResourceToResourceFolder_Id,BooksCode,BooksUnitCode,GuidDoc,TestPaperName,CreateTime,paperHeaderDoc,paperHeaderHtml)"); stbRTRF_AddModify.AppendFormat(" values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}');" , item_Property["ResourceToResourceFolder_Id"] , item_Property["BooksCode"] , item_Property["BooksUnitCode"] , item_Property["GuidDoc"] , item_Property["TestPaperName"] , item_Property["CreateTime"] , item_Property["paperHeaderDoc"] , item_Property["paperHeaderHtml"]); } AddLogInfo(string.Format("{0}--结束--", stbRTRF_AddModify.ToString()), true); if (!string.IsNullOrEmpty(stbRTRF_AddModify.ToString())) { DbHelperSQL_Operate.ExecuteSqlByTime(stbRTRF_AddModify.ToString(), 7200); } #endregion #region TestQuestions,TestQuestions_Option stbRTRF_AddModify = new StringBuilder(); DataTable dtTQ = new BLL_TestQuestions().GetList("ResourceToResourceFolder_Id='" + item["DataId"] + "'").Tables[0]; foreach (DataRow item_TQ in dtTQ.Rows) { stbRTRF_AddModify.Append("insert into TestQuestions(TestQuestions_Id,ResourceToResourceFolder_Id,TestQuestions_Num,TestQuestions_Type,TestQuestions_SumScore,TestQuestions_Content,TestQuestions_Answer,CreateTime,topicNumber,Parent_Id,[type])"); stbRTRF_AddModify.AppendFormat(" values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}');" , item_TQ["TestQuestions_Id"] , item_TQ["ResourceToResourceFolder_Id"] , item_TQ["TestQuestions_Num"] , item_TQ["TestQuestions_Type"] , item_TQ["TestQuestions_SumScore"] , item_TQ["TestQuestions_Content"] , item_TQ["TestQuestions_Answer"] , item_TQ["CreateTime"] , item_TQ["topicNumber"].ToString().Filter() , item_TQ["Parent_Id"] , item_TQ["type"]); #region TestQuestions_Option DataTable dtTQ_Option = new BLL_TestQuestions_Option().GetList("TestQuestions_Id='" + item_TQ["TestQuestions_Id"] + "'").Tables[0]; foreach (DataRow item_TQ_Option in dtTQ_Option.Rows) { stbRTRF_AddModify.Append("insert into TestQuestions_Option(TestQuestions_Option_Id,TestQuestions_Id,TestQuestions_OptionParent_OrderNum,TestQuestions_Option_Content,TestQuestions_Option_OrderNum,CreateTime,TestQuestions_Score_ID)"); stbRTRF_AddModify.AppendFormat(" values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}');" , item_TQ_Option["TestQuestions_Option_Id"] , item_TQ_Option["TestQuestions_Id"] , item_TQ_Option["TestQuestions_OptionParent_OrderNum"] , item_TQ_Option["TestQuestions_Option_Content"].ToString().Filter() , item_TQ_Option["TestQuestions_Option_OrderNum"] , item_TQ_Option["CreateTime"] , item_TQ_Option["TestQuestions_Score_ID"]); } #endregion } AddLogInfo(string.Format("{0}--结束--", stbRTRF_AddModify.ToString()), true); if (!string.IsNullOrEmpty(stbRTRF_AddModify.ToString())) { DbHelperSQL_Operate.ExecuteSqlByTime(stbRTRF_AddModify.ToString(), 7200); } #endregion #region TestQuestions_Score stbRTRF_AddModify = new StringBuilder(); DataTable dtTQ_Score = new BLL_TestQuestions_Score().GetList("ResourceToResourceFolder_Id='" + item["DataId"] + "'").Tables[0]; foreach (DataRow item_TQ_Score in dtTQ_Score.Rows) { stbRTRF_AddModify.Append("insert into TestQuestions_Score(TestQuestions_Score_ID,ResourceToResourceFolder_Id,TestQuestions_Id,TestQuestions_Num,TestQuestions_OrderNum,TestQuestions_Score,AnalyzeHyperlink,AnalyzeHyperlinkData,AnalyzeHyperlinkHtml,AnalyzeText,ComplexityHyperlink,ComplexityText,ContentHyperlink,ContentText,DocBase64,DocHtml,ScoreHyperlink,ScoreText,TargetHyperlink,TrainHyperlinkData,TrainHyperlinkHtml,TargetText,TestCorrect,TestType,TrainHyperlink,TrainText,TypeHyperlink,TypeText,CreateTime,AreaHyperlink,AreaText,kaofaText,testIndex)"); stbRTRF_AddModify.AppendFormat(" values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}','{23}','{24}','{25}','{26}','{27}','{28}','{29}','{30}','{31}','{32}');" , item_TQ_Score["TestQuestions_Score_ID"] , item_TQ_Score["ResourceToResourceFolder_Id"] , item_TQ_Score["TestQuestions_Id"] , item_TQ_Score["TestQuestions_Num"] , item_TQ_Score["TestQuestions_OrderNum"] , item_TQ_Score["TestQuestions_Score"] , item_TQ_Score["AnalyzeHyperlink"] , item_TQ_Score["AnalyzeHyperlinkData"] , item_TQ_Score["AnalyzeHyperlinkHtml"] , item_TQ_Score["AnalyzeText"] , item_TQ_Score["ComplexityHyperlink"] , item_TQ_Score["ComplexityText"] , item_TQ_Score["ContentHyperlink"] , item_TQ_Score["ContentText"] , item_TQ_Score["DocBase64"] , item_TQ_Score["DocHtml"] , item_TQ_Score["ScoreHyperlink"] , item_TQ_Score["ScoreText"] , item_TQ_Score["TargetHyperlink"] , item_TQ_Score["TrainHyperlinkData"] , item_TQ_Score["TrainHyperlinkHtml"] , item_TQ_Score["TargetText"] , item_TQ_Score["TestCorrect"] , item_TQ_Score["TestType"] , item_TQ_Score["TrainHyperlink"] , item_TQ_Score["TrainText"] , item_TQ_Score["TypeHyperlink"] , item_TQ_Score["TypeText"] , item_TQ_Score["CreateTime"] , item_TQ_Score["AreaHyperlink"] , item_TQ_Score["AreaText"] , item_TQ_Score["kaofaText"] , item_TQ_Score["testIndex"]); } AddLogInfo(string.Format("{0}--结束--", stbRTRF_AddModify.ToString()), true); if (!string.IsNullOrEmpty(stbRTRF_AddModify.ToString())) { DbHelperSQL_Operate.ExecuteSqlByTime(stbRTRF_AddModify.ToString(), 7200); } #endregion } DbHelperSQL.ExecuteSqlByTime(string.Format("update SyncData set SyncStatus='1' where TableName='ResourceToResourceFolder' and (OperateType='add' or OperateType='modify') and DataId='{0}'; ", item["DataId"]), 60); } model_FileSyncExecRecordDetail.Detail_Status = "1"; model_FileSyncExecRecordDetail.Detail_TimeEnd = DateTime.Now; bll_FileSyncExecRecordDetail.Update(model_FileSyncExecRecordDetail); #endregion #region ⑤同步BookAudit表数据 model_FileSyncExecRecordDetail = new Rc.Model.Resources.Model_FileSyncExecRecordDetail(); model_FileSyncExecRecordDetail.FileSyncExecRecordDetail_id = Guid.NewGuid().ToString(); model_FileSyncExecRecordDetail.FileSyncExecRecord_id = strFileSyncExecRecord_id; model_FileSyncExecRecordDetail.Detail_Remark = "⑤同步BookAudit表数据"; model_FileSyncExecRecordDetail.Detail_Status = "0"; model_FileSyncExecRecordDetail.Detail_TimeStart = DateTime.Now; bll_FileSyncExecRecordDetail.Add(model_FileSyncExecRecordDetail); StringBuilder stbBookAudit = new StringBuilder(); DataTable dtBookAudit = new BLL_BookAudit().GetList(" ResourceFolder_Id in(select DataId from SyncData where TableName='BookAudit' and (SyncStatus='0' or SyncStatus='2') ) ").Tables[0]; foreach (DataRow item in dtBookAudit.Rows) { stbBookAudit.AppendFormat(@"if(select COUNT(1) from BookAudit where ResourceFolder_Id='{0}')=0 begin insert into BookAudit(ResourceFolder_Id,Book_Name,AuditState,AuditRemark,CreateUser,CreateTime) values ('{0}',N'{1}','{2}','{3}','{4}','{5}');" , item["ResourceFolder_Id"] , item["Book_Name"] , item["AuditState"] , item["AuditRemark"] , item["CreateUser"] , item["CreateTime"]); stbBookAudit.Append(" end "); stbBookAudit.Append(" else "); stbBookAudit.Append(" begin "); stbBookAudit.AppendFormat(@"if(select COUNT(1) from BookAudit where ResourceFolder_Id='{0}' and (AuditState='{1}' or CreateTime='{2}') )=0 begin update BookAudit set AuditState='{1}',CreateTime='{2}' where ResourceFolder_Id='{0}'; end ", item["ResourceFolder_Id"], item["AuditState"], item["CreateTime"]); stbBookAudit.Append(" end "); DbHelperSQL.ExecuteSqlByTime(string.Format("update SyncData set SyncStatus='1' where TableName='BookAudit' and OperateType='bookaudit' and DataId='{0}'; ", item["ResourceFolder_Id"]), 60); } AddLogInfo(string.Format("{0}--结束--", stbBookAudit.ToString()), true); if (!string.IsNullOrEmpty(stbBookAudit.ToString())) { DbHelperSQL_Operate.ExecuteSqlByTime(stbBookAudit.ToString(), 7200); } model_FileSyncExecRecordDetail.Detail_Status = "1"; model_FileSyncExecRecordDetail.Detail_TimeEnd = DateTime.Now; bll_FileSyncExecRecordDetail.Update(model_FileSyncExecRecordDetail); #endregion #region ⑥同步SyncData表数据 model_FileSyncExecRecordDetail = new Rc.Model.Resources.Model_FileSyncExecRecordDetail(); model_FileSyncExecRecordDetail.FileSyncExecRecordDetail_id = Guid.NewGuid().ToString(); model_FileSyncExecRecordDetail.FileSyncExecRecord_id = strFileSyncExecRecord_id; model_FileSyncExecRecordDetail.Detail_Remark = "⑥同步SyncData表数据"; model_FileSyncExecRecordDetail.Detail_Status = "0"; model_FileSyncExecRecordDetail.Detail_TimeStart = DateTime.Now; bll_FileSyncExecRecordDetail.Add(model_FileSyncExecRecordDetail); StringBuilder stbSyncData = new StringBuilder(); DataTable dtSyncData = new BLL_SyncData().GetList("").Tables[0]; foreach (DataRow item in dtSyncData.Rows) { stbSyncData.AppendFormat("if(select COUNT(1) from SyncData where SyncDataId='{0}')=0 insert into SyncData(SyncDataId,TableName,DataId,OperateType,CreateTime,SyncStatus)", item["SyncDataId"]); stbSyncData.AppendFormat(" values ('{0}','{1}','{2}','{3}','{4}','{5}');" , item["SyncDataId"] , item["TableName"] , item["DataId"] , item["OperateType"] , item["CreateTime"] , item["SyncStatus"]); } AddLogInfo(string.Format("{0}--结束--", stbSyncData.ToString()), true); if (!string.IsNullOrEmpty(stbSyncData.ToString())) { DbHelperSQL_Operate.ExecuteSqlByTime(stbSyncData.ToString(), 7200); } model_FileSyncExecRecordDetail.Detail_Status = "1"; model_FileSyncExecRecordDetail.Detail_TimeEnd = DateTime.Now; bll_FileSyncExecRecordDetail.Update(model_FileSyncExecRecordDetail); #endregion }
/// <summary> /// 验证试卷是否有效 /// </summary> /// <param name="Two_WayChecklist_Id"></param> /// <param name="arrRTRF"></param> /// <param name="msg"></param> /// <returns></returns> private static bool VerifyTestpaper(string TestPaper_Frame_Id, string TestPaper_FrameDetail_Id, string[] arrRTRF, out string msg) { bool flag = true; msg = string.Empty; try { TestPaper_Frame_Id = TestPaper_Frame_Id.Filter(); TestPaper_FrameDetail_Id = TestPaper_FrameDetail_Id.Filter(); BLL_Two_WayChecklistDetail bll = new BLL_Two_WayChecklistDetail(); BLL_TestQuestions_Score bllTQScore = new BLL_TestQuestions_Score(); DataTable dtTWC_Count = new DataTable(); // 双向细目表总分、试题数量 DataTable dtTWC = new DataTable(); // 双向细目表明细 DataTable dtTQ_Count = new DataTable(); // 习题集资源总分、试题数量 DataTable dtTQScore = new DataTable(); // 习题集试题明细 Model_VSysUserRole loginUser = (Model_VSysUserRole)HttpContext.Current.Session["LoginUser"]; string strSql = string.Empty; strSql = string.Format(@"select count(1) as ICount,sum(Score) as SumScore from TestPaper_FrameDetail where ParentId!='0' and TestPaper_FrameDetail_Id='{0}' ", TestPaper_FrameDetail_Id); dtTWC_Count = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0]; DataRow drTWC_Count = dtTWC_Count.Rows[0]; int twCount = 0; double twSumScore = 0; int.TryParse(drTWC_Count["ICount"].ToString(), out twCount); double.TryParse(drTWC_Count["SumScore"].ToString(), out twSumScore); strSql = string.Empty; strSql = string.Format(@"select t.* from TestPaper_FrameDetail t where t.ParentId!='0' and t.TestPaper_FrameDetail_Id='{0}' order by t.TestQuestions_Num,t.CreateTime ", TestPaper_FrameDetail_Id); dtTWC = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0]; foreach (var rtrfId in arrRTRF) { List <Model_TestPaper_FrameDetailToTestQuestions> listmodel = new List <Model_TestPaper_FrameDetailToTestQuestions>(); string strSqlTQ = string.Empty; strSqlTQ = string.Format(@"select max(rtrf.Resource_Name) as Resource_Name,count(1) as ICount ,sum(t.TestQuestions_SumScore) as SumScore from ( select TestQuestions_SumScore,tq.ResourceToResourceFolder_Id from TestQuestions tq where tq.TestQuestions_Type!='title' and tq.TestQuestions_Type<>'' and tq.[type]='simple' and tq.ResourceToResourceFolder_Id='{0}' union all select TestQuestions_SumScore,tq.ResourceToResourceFolder_Id from TestQuestions tq where tq.Parent_Id='0' and tq.[type]='complex' and tq.ResourceToResourceFolder_Id='{0}' ) t inner join ResourceToResourceFolder rtrf on rtrf.ResourceToResourceFolder_Id=t.ResourceToResourceFolder_Id", rtrfId); dtTQ_Count = Rc.Common.DBUtility.DbHelperSQL.Query(strSqlTQ).Tables[0]; DataRow drTQ_Count = dtTQ_Count.Rows[0]; int tqCount = 0; double tqSumScore = 0; int.TryParse(drTQ_Count["ICount"].ToString(), out tqCount); double.TryParse(drTQ_Count["SumScore"].ToString(), out tqSumScore); if (flag) { string strSqlScore = string.Empty; strSqlScore = string.Format(@"select * from ( select tq.TestQuestions_Id,tq.TestQuestions_Type,tq.[type],tq.TestQuestions_Num,tq.topicNumber,tq.TestQuestions_SumScore from TestQuestions tq where tq.TestQuestions_Type!='title' and tq.TestQuestions_Type<>'' and tq.[type]='simple' and tq.ResourceToResourceFolder_Id='{0}' union all select tq.TestQuestions_Id,tq.TestQuestions_Type,tq.[type],tq.TestQuestions_Num,tq.topicNumber,tq.TestQuestions_SumScore from TestQuestions tq where tq.Parent_Id='0' and tq.[type]='complex' and tq.ResourceToResourceFolder_Id='{0}' ) t order by TestQuestions_Num ", rtrfId); dtTQScore = Rc.Common.DBUtility.DbHelperSQL.Query(strSqlScore).Tables[0]; int row = 0; foreach (DataRow item in dtTQScore.Rows) { if (flag && dtTWC.Rows[0]["TestPaper_FrameType"].ToString() == "simple" && item["type"].ToString() == "complex") { flag = false; msg = string.Format("资源【{0}】第{1}题{2}与双向细目表不匹配" , drTQ_Count["Resource_Name"].ToString().ReplaceForFilter() , dtTQScore.Rows[row]["topicNumber"] , "试题类型"); } if (flag && dtTWC.Rows[0]["TestPaper_FrameType"].ToString() == "complex" && item["type"].ToString() != "complex") { flag = false; msg = string.Format("资源【{0}】第{1}题{2}与双向细目表不匹配" , drTQ_Count["Resource_Name"].ToString().ReplaceForFilter() , dtTQScore.Rows[row]["topicNumber"] , "试题类型"); } double twScore = 0; // 双向细目表分值 double tqScore = 0; // 试题分值 double.TryParse(dtTWC.Rows[0]["Score"].ToString(), out twScore); double.TryParse(item["TestQuestions_SumScore"].ToString(), out tqScore); if (flag && twScore != tqScore) { flag = false; msg = string.Format("资源【{0}】第{1}题{2}与双向细目表不匹配" , drTQ_Count["Resource_Name"].ToString().ReplaceForFilter() , item["topicNumber"] , "试题分值"); } Model_TestPaper_FrameDetailToTestQuestions model = new Model_TestPaper_FrameDetailToTestQuestions(); model.TestPaper_FrameDetailToTestQuestions_Id = Guid.NewGuid().ToString(); model.TestPaper_Frame_Id = dtTWC.Rows[0]["TestPaper_Frame_Id"].ToString(); model.TestPaper_FrameDetail_Id = dtTWC.Rows[0]["TestPaper_FrameDetail_Id"].ToString(); model.ResourceToResourceFolder_Id = rtrfId; model.TestQuestions_Id = item["TestQuestions_Id"].ToString(); model.CreateTime = DateTime.Now; model.CreateUser = loginUser.SysUser_ID; listmodel.Add(model); row++; } } if (flag) { if (new BLL_TestPaper_FrameToTestpaper().GetRecordCount("TestPaper_Frame_Id='" + TestPaper_FrameDetail_Id + "' and ResourceToResourceFolder_Id='" + rtrfId + "'") > 0) { Rc.Common.DBUtility.DbHelperSQL.ExecuteSqlByTime(string.Format("exec P_GenerateTF_Attr '{0}','{1}'", TestPaper_Frame_Id, loginUser.SysUser_ID), 7200); flag = true; } else { Rc.Model.Resources.Model_TestPaper_FrameToTestpaper model = new Rc.Model.Resources.Model_TestPaper_FrameToTestpaper(); model.CreateTime = DateTime.Now; model.CreateUser = loginUser.SysUser_ID; model.ResourceToResourceFolder_Id = rtrfId; model.TestPaper_FrameToTestpaper_Id = Guid.NewGuid().ToString(); model.TestPaper_Frame_Id = TestPaper_FrameDetail_Id; model.TestPaper_FrameToTestpaper_Type = "1"; if (new BLL_TestPaper_FrameToTestpaper().AddRelationPaper(model, listmodel) > 0) { Rc.Common.DBUtility.DbHelperSQL.ExecuteSqlByTime(string.Format("exec P_GenerateTF_Attr '{0}','{1}'", TestPaper_Frame_Id, loginUser.SysUser_ID), 7200); flag = true; } else { flag = false; msg = "关联试卷失败"; } } } } } catch (Exception ex) { flag = false; msg = ex.Message.ToString(); } return(flag); }
/// <summary> /// 获取资源对应文件路径 17-06-07TS /// </summary> private List <string> GetResourceFile(Model_ResourceToResourceFolder modelRTRF, string uploadPath) { try { List <string> listReturn = new List <string>(); //生成存储路径 string savePath = string.Empty; string savePathOwn = string.Empty; if (modelRTRF.Resource_Class == Resource_ClassConst.云资源) { savePath = string.Format("{0}\\{1}\\{2}\\{3}\\", modelRTRF.ParticularYear, modelRTRF.GradeTerm, modelRTRF.Resource_Version, modelRTRF.Subject); } if (modelRTRF.Resource_Class == Resource_ClassConst.自有资源) { DateTime dateTime = Convert.ToDateTime(modelRTRF.CreateTime); savePathOwn = string.Format("{0}\\", dateTime.ToString("yyyy-MM-dd")); } if (modelRTRF.Resource_Type == Rc.Common.Config.Resource_TypeConst.testPaper类型文件) { string fileUrl = uploadPath + savePathOwn + "{0}\\" + savePath + "{1}.{2}"; #region 习题集文件 DataTable dtTQ = new BLL_TestQuestions().GetList("ResourceToResourceFolder_Id='" + modelRTRF.ResourceToResourceFolder_Id + "'").Tables[0]; DataTable dtTQ_Score = new BLL_TestQuestions_Score().GetList("ResourceToResourceFolder_Id='" + modelRTRF.ResourceToResourceFolder_Id + "'").Tables[0]; foreach (DataRow item in dtTQ.Rows) { listReturn.Add(string.Format(fileUrl, "testQuestionBody", item["TestQuestions_Id"], "txt")); listReturn.Add(string.Format(fileUrl, "testQuestionBody", item["TestQuestions_Id"], "htm")); listReturn.Add(string.Format(fileUrl, "textTitle", item["TestQuestions_Id"], "htm")); } foreach (DataRow item in dtTQ_Score.Rows) { listReturn.Add(string.Format(fileUrl, "testQuestionCurrent", item["TestQuestions_Score_Id"], "txt")); listReturn.Add(string.Format(fileUrl, "testQuestionOption", item["TestQuestions_Score_Id"], "txt")); listReturn.Add(string.Format(fileUrl, "AnalyzeData", item["TestQuestions_Score_Id"], "txt")); listReturn.Add(string.Format(fileUrl, "AnalyzeHtml", item["TestQuestions_Score_Id"], "htm")); listReturn.Add(string.Format(fileUrl, "TrainData", item["TestQuestions_Score_Id"], "txt")); listReturn.Add(string.Format(fileUrl, "TrainHtml", item["TestQuestions_Score_Id"], "htm")); listReturn.Add(string.Format(fileUrl, "bodySub", item["TestQuestions_Score_Id"], "txt")); } #endregion } else { #region 教案文件 string filePath = string.Empty;//文件存储路径 //判断产品类型 switch (modelRTRF.Resource_Type) { case Resource_TypeConst.ScienceWord类型文件: filePath += "swDocument\\"; break; case Resource_TypeConst.class类型微课件: filePath += "microClassDocument\\"; break; case Resource_TypeConst.class类型文件: filePath += "classDocument\\"; break; } #region 文件及图片 filePath += savePath; filePath = savePathOwn + filePath; listReturn.Add(uploadPath + filePath + modelRTRF.ResourceToResourceFolder_Id + "." + modelRTRF.File_Suffix); listReturn.Add(uploadPath + filePath + modelRTRF.ResourceToResourceFolder_Id + ".htm"); DataTable dtImg = new BLL_ResourceToResourceFolder_img().GetList("ResourceToResourceFolder_Id='" + modelRTRF.ResourceToResourceFolder_Id + "'").Tables[0]; foreach (DataRow item in dtImg.Rows) { listReturn.Add(uploadPath + item["ResourceToResourceFolderImg_Url"].ToString()); } #endregion #endregion } return(listReturn); } catch (Exception ex) { Rc.Common.SystemLog.SystemLog.AddLogErrorFromBS("", Request.Url.ToString(), string.Format("获取资源对应所有文件路径失败。{0}", ex.Message.ToString())); return(null); } }
//276d7051-ac19-4f8b-baa6-6257c088ea58 private bool VerifyTestpaper(string Two_WayChecklist_Id, string[] arrRTRF, out string msg) { bool flag = true; msg = string.Empty; try { BLL_Two_WayChecklistDetail bll = new BLL_Two_WayChecklistDetail(); BLL_TestQuestions_Score bllTQScore = new BLL_TestQuestions_Score(); DataTable dtTWC_Count = new DataTable(); // 双向细目表总分、试题数量 DataTable dtTWC = new DataTable(); // 双向细目表明细 DataTable dtTQ_Count = new DataTable(); // 习题集资源总分、试题数量 DataTable dtTQScore = new DataTable(); // 习题集试题明细 string strSql = string.Empty; strSql = string.Format(@"select count(1) as ICount,sum(Score) as SumScore from Two_WayChecklistDetail where ParentId!='0' and Two_WayChecklist_Id='{0}' ", Two_WayChecklist_Id); dtTWC_Count = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0]; DataRow drTWC_Count = dtTWC_Count.Rows[0]; int twCount = 0; double twSumScore = 0; int.TryParse(drTWC_Count["ICount"].ToString(), out twCount); double.TryParse(drTWC_Count["SumScore"].ToString(), out twSumScore); strSql = string.Empty; strSql = string.Format(@"select t.* from Two_WayChecklistDetail t inner join Two_WayChecklistDetail t2 on t.ParentId=t2.Two_WayChecklistDetail_Id where t.ParentId!='0' and t.Two_WayChecklist_Id='{0}' order by t2.TestQuestions_Num,t.TestQuestions_Num ", Two_WayChecklist_Id); dtTWC = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0]; foreach (var rtrfId in arrRTRF) { string strSqlTQ = string.Empty; strSqlTQ = string.Format(@"select max(rtrf.Resource_Name) as Resource_Name,count(1) as ICount ,sum(t.TestQuestions_SumScore) as SumScore from ( select TestQuestions_SumScore,tq.ResourceToResourceFolder_Id from TestQuestions tq where tq.Parent_Id!='0' and tq.[type]='simple' and tq.ResourceToResourceFolder_Id='{0}' union all select TestQuestions_SumScore,tq.ResourceToResourceFolder_Id from TestQuestions tq where tq.Parent_Id='0' and tq.[type]='complex' and tq.ResourceToResourceFolder_Id='{0}' ) t inner join ResourceToResourceFolder rtrf on rtrf.ResourceToResourceFolder_Id=t.ResourceToResourceFolder_Id", rtrfId); dtTQ_Count = Rc.Common.DBUtility.DbHelperSQL.Query(strSqlTQ).Tables[0]; DataRow drTQ_Count = dtTQ_Count.Rows[0]; int tqCount = 0; double tqSumScore = 0; int.TryParse(drTQ_Count["ICount"].ToString(), out tqCount); double.TryParse(drTQ_Count["SumScore"].ToString(), out tqSumScore); if (flag && tqCount != twCount) { flag = false; msg = string.Format("资源【{0}】试题数不等于双向细目表明细数", drTQ_Count["Resource_Name"].ToString().ReplaceForFilter()); } if (flag && tqSumScore != twSumScore) { flag = false; msg = string.Format("资源【{0}】总分不等于双向细目表总分", drTQ_Count["Resource_Name"].ToString().ReplaceForFilter()); } if (flag) { string strSqlScore = string.Empty; strSqlScore = string.Format(@"select * from ( select tq.TestQuestions_Type,tq.[type],tq.TestQuestions_Num,tq.topicNumber,tq.TestQuestions_SumScore from TestQuestions tq where tq.Parent_Id!='0' and tq.[type]='simple' and tq.ResourceToResourceFolder_Id='{0}' union all select tq.TestQuestions_Type,tq.[type],tq.TestQuestions_Num,tq.topicNumber,tq.TestQuestions_SumScore from TestQuestions tq where tq.Parent_Id='0' and tq.[type]='complex' and tq.ResourceToResourceFolder_Id='{0}' ) t order by TestQuestions_Num ", rtrfId); dtTQScore = Rc.Common.DBUtility.DbHelperSQL.Query(strSqlScore).Tables[0]; int row = 0; foreach (DataRow item in dtTWC.Rows) { if (flag && item["Two_WayChecklistType"].ToString() == "simple" && item["TestQuestions_Type"].ToString() != dtTQScore.Rows[row]["TestQuestions_Type"].ToString()) { flag = false; msg = string.Format("资源【{0}】第{1}题{2}与双向细目表不匹配" , drTQ_Count["Resource_Name"].ToString().ReplaceForFilter() , dtTQScore.Rows[row]["topicNumber"] , "试题类型"); } if (flag && item["Two_WayChecklistType"].ToString() == "complex" && item["Two_WayChecklistType"].ToString() != dtTQScore.Rows[row]["type"].ToString()) { flag = false; msg = string.Format("资源【{0}】第{1}题{2}与双向细目表不匹配" , drTQ_Count["Resource_Name"].ToString().ReplaceForFilter() , dtTQScore.Rows[row]["topicNumber"] , "试题类型"); } double twScore = 0; // 双向细目表分值 double tqScore = 0; // 试题分值 double.TryParse(item["Score"].ToString(), out twScore); double.TryParse(dtTQScore.Rows[row]["TestQuestions_SumScore"].ToString(), out tqScore); if (flag && twScore != tqScore) { flag = false; msg = string.Format("资源【{0}】第{1}题{2}与双向细目表不匹配" , drTQ_Count["Resource_Name"].ToString().ReplaceForFilter() , dtTQScore.Rows[row]["topicNumber"] , "试题分值"); } row++; } } } } catch (Exception ex) { flag = false; msg = ex.Message.ToString(); } return(flag); }
public static string StatsClassHW_TQ(string ResourceToResourceFolder_Id, string UserId, string ClassID) { try { string StrWhere = "ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id.Filter() + "' and TeacherID='" + UserId.Filter() + "'"; //if (!string.IsNullOrEmpty(ClassID.Filter())) //{ // StrWhere += " and ClassID='" + ClassID.Filter() + "'"; //} StringBuilder StrTBody = new StringBuilder(); StringBuilder StrTHead = new StringBuilder(); string StrClassname = string.Empty; string DateSour = string.Empty; string StrScoreTemp = string.Empty; string StrTQNum = string.Empty; BLL_StatsClassHW_TQ bllStatsClassHW_TQ = new BLL_StatsClassHW_TQ(); List <Model_StatsClassHW_TQ> StatsClassHW_TQList = new List <Model_StatsClassHW_TQ>(); List <Model_StatsClassHW_TQ> listAll = new List <Model_StatsClassHW_TQ>(); //所有数据 listAll = bllStatsClassHW_TQ.GetModelList(StrWhere + " order by TestQuestions_Num,TestQuestions_OrderNum "); List <Model_StatsClassHW_TQ> listDistictClass = listAll.Where((x, i) => listAll.FindIndex(z => z.ClassID == x.ClassID) == i).ToList(); //去重后数据 List <Model_StatsClassHW_TQ> listDistictTQ = listAll.Where((x, i) => listAll.FindIndex(z => z.TestQuestions_Score_ID == x.TestQuestions_Score_ID) == i).ToList(); //去重后数据 StrTHead.Append("<tr><td>题号</td><td>小题分数</td>"); foreach (var item in listDistictClass) { StrTHead.AppendFormat("<td>{0}平均得分率</td>", item.ClassName); List <Model_StatsClassHW_TQ> listAllbyClass = listAll.Where(x => x.ClassID == item.ClassID).ToList(); foreach (var itemtq in listAllbyClass) { StrScoreTemp += itemtq.ScoreAvgRate.ToString().clearLastZero() + ","; } DateSour += "{\"name\":\"" + item.ClassName + "\",\"data\":[" + StrScoreTemp.TrimEnd(',') + "]},"; StrScoreTemp = ""; } StrTHead.Append("</tr>"); DataTable dtTQ_S = new BLL_TestQuestions_Score().GetList("ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' order by TestQuestions_Num,TestQuestions_OrderNum ").Tables[0]; foreach (var item in listDistictTQ) { DataRow[] drTQ_S = dtTQ_S.Select("TestQuestions_Score_ID='" + item.TestQuestions_Score_ID + "'"); string testIndex = string.Empty; if (drTQ_S.Length > 0 && (drTQ_S[0]["TestType"].ToString() == "clozeTest" || drTQ_S[0]["TestType"].ToString() == "fill")) { testIndex = string.IsNullOrEmpty(drTQ_S[0]["testIndex"].ToString()) ? "" : "-" + drTQ_S[0]["testIndex"].ToString(); } List <Model_StatsClassHW_TQ> listSub = listDistictTQ.Where(m => m.TestQuestions_Num == item.TestQuestions_Num).ToList(); StrTBody.AppendFormat("<tr><td>{0}</td><td>{1}</td>" , item.topicNumber.TrimEnd('.') + testIndex , item.TQ_Score.ToString().clearLastZero()); foreach (var itemClass in listDistictClass) { List <Model_StatsClassHW_TQ> listDistictBody = listAll.Where(x => x.ClassID == itemClass.ClassID && x.TestQuestions_Score_ID == item.TestQuestions_Score_ID).ToList(); foreach (var itemBody in listDistictBody) { StrTBody.AppendFormat("<td>{0}%</td>", itemBody.ScoreAvgRate.ToString().clearLastZero()); } if (listDistictBody.Count == 0) { StrTBody.Append("<td>-</td>"); } } StrTQNum += item.topicNumber.TrimEnd('.') + "题,"; StrTBody.Append("</tr>"); } string oo = DateSour; return(Newtonsoft.Json.JsonConvert.SerializeObject(new { thead = StrTHead.ToString(), tbody = StrTBody.ToString(), DateSour = "[" + DateSour.TrimEnd(',') + "]", StrTQNum = StrTQNum.TrimEnd(',') })); } catch (Exception) { return(""); } }
public static string GetHWList(string TeacherID, string SubjectID, string ClassID, string KPName, string DateData, string DateType) { try { TeacherID = TeacherID.Filter(); SubjectID = SubjectID.Filter(); ClassID = ClassID.Filter(); KPName = KPName = Rc.Common.DBUtility.DESEncrypt.Decrypt(KPName); DateData = DateData.Filter(); DateType = DateType.Filter(); string strWhere = "TeacherID ='" + TeacherID + "'"; if (!string.IsNullOrEmpty(SubjectID)) { strWhere += " AND SubjectID ='" + SubjectID + "'"; } if (!string.IsNullOrEmpty(ClassID)) { strWhere += " AND ClassID ='" + ClassID + "'"; } if (!string.IsNullOrEmpty(KPName)) { strWhere += " AND KPName ='" + KPName + "'"; } if (!string.IsNullOrEmpty(DateData)) { switch (DateType) { case "month": strWhere += " AND CONVERT(varchar(7),HomeWorkCreateTime,120)='" + DateData + "'"; break; case "halfyear": strWhere += " AND dbo.[f_GetDatePartHalfYear](CONVERT(varchar(10),HomeWorkCreateTime,120))='" + DateData + "'"; break; case "quarter": strWhere += " AND dbo.[f_GetDatePartQuarter](CONVERT(varchar(10),HomeWorkCreateTime,120))='" + DateData + "'"; break; } } DataTable dt = new DataTable(); if (string.IsNullOrEmpty(ClassID))//从老师表读取数据 { dt = new BLL_StatsTeacherHW_KP().GetList(strWhere + " ORDER BY Resource_Name DESC").Tables[0]; } else { dt = new BLL_StatsClassHW_KP().GetList(strWhere + " ORDER BY HomeWorkCreateTime DESC").Tables[0]; } List <object> listReturn = new List <object>(); int inum = 1; string temp = string.Empty; string strxAxis = string.Empty; string strSeries = string.Empty; for (int i = 0; i < dt.Rows.Count; i++) { DataTable dtTQ_S = new BLL_TestQuestions_Score().GetList("ResourceToResourceFolder_Id='" + dt.Rows[i]["ResourceToResourceFolder_Id"] + "' and ContentText='" + KPName + "' order by TestQuestions_Num,TestQuestions_OrderNum ").Tables[0]; string TQNums = string.Empty; string TQStr = dt.Rows[i]["TestQuestionNumStrs"].ToString(); string TQNumsStr = dt.Rows[i]["TestQuestionNums"].ToString(); if (!string.IsNullOrEmpty(TQStr)) { string[] strArr = TQStr.Split(','); string[] strNumArr = TQNumsStr.Split(','); for (int j = 0; j < strArr.Length; j++) { string testIndex = string.Empty; if (dtTQ_S.Rows.Count > 0 && (dtTQ_S.Rows[j]["TestType"].ToString() == "clozeTest" || dtTQ_S.Rows[j]["TestType"].ToString() == "fill")) { testIndex = string.IsNullOrEmpty(dtTQ_S.Rows[j]["testIndex"].ToString()) ? "" : "-" + dtTQ_S.Rows[j]["testIndex"].ToString(); } TQNums += string.Format("<a href='../teacher/HomeworkPreviewT.aspx?ResourceToResourceFolder_Id={0}#{2}' target=\"_blank\">第{1}题", dt.Rows[i]["ResourceToResourceFolder_Id"].ToString() , strArr[j].TrimEnd('.') + testIndex , strNumArr[j].TrimEnd('.')); } } strxAxis += ((!string.IsNullOrEmpty(dt.Rows[i]["Resource_Name"].ToString())) ? dt.Rows[i]["Resource_Name"].ToString().ReplaceForFilter() : "-") + ","; strSeries += dt.Rows[i]["KPScoreAvgRate"].ToString() + ","; listReturn.Add(new { HomeWork_Name = dt.Rows[i]["Resource_Name"].ToString().ReplaceForFilter(), HomeWorkCreateTime = string.IsNullOrEmpty(ClassID) ? pfunction.ConvertToLongDateTime(dt.Rows[i]["CreateTime"].ToString(), "yyyy-MM-dd HH:mm") : pfunction.ConvertToLongDateTime(dt.Rows[i]["HomeWorkCreateTime"].ToString(), "yyyy-MM-dd HH:mm"), KPScoreSum = dt.Rows[i]["KPScoreSum"].ToString().clearLastZero(), KPScoreAvgRate = (!string.IsNullOrEmpty(dt.Rows[i]["KPScoreAvgRate"].ToString())) ? dt.Rows[i]["KPScoreAvgRate"].ToString().clearLastZero() + "%" : "-", TestQuestionNums = TQNums, ClassID = string.IsNullOrEmpty(ClassID) ? "" : ClassID }); inum++; } if (inum > 1) { return(JsonConvert.SerializeObject(new { err = "null", list = listReturn, strxAxisCategories = strxAxis.TrimEnd(','), strSeriesData = strSeries.TrimEnd(','), DataCount = dt.Rows.Count })); } else { return(JsonConvert.SerializeObject(new { err = "暂无数据" })); } } catch (Exception ex) { return(JsonConvert.SerializeObject(new { err = ex.Message.ToString() })); } }
protected void btnOn_Click(object sender, EventArgs e) { try { BLL_FileSyncRecordFail fsrfbll = new BLL_FileSyncRecordFail(); fsrfbll.DeleteClass(" Resource_Type='df94a052-8cdb-4e49-ae1d-635fe129c89a'"); List <Rc.Model.Resources.Model_ResourceToResourceFolder> rtrflist = new List <Model_ResourceToResourceFolder>(); string StrWhere = string.Empty; string StartTime = txtStartTime.Text; string EndTime = txtEndTiem.Text; string uploadPath = "\\Upload\\Resource\\"; string filePath = string.Empty; string imgPath = string.Empty; string savePath = string.Empty; string StrText = string.Empty; StrWhere = " Resource_Class='" + Resource_ClassConst.云资源 + "' "; if (!string.IsNullOrEmpty(StartTime)) { StrWhere += " and CreateTime >= '" + StartTime.Filter() + "'"; } if (!string.IsNullOrEmpty(EndTime)) { StrWhere += " and CreateTime <= '" + EndTime.Filter() + "'"; } if (!string.IsNullOrEmpty(hidtxtBook.Value)) { StrWhere += " and Book_ID='" + hidtxtBook.Value + "'"; } StrWhere += " and Resource_Type='df94a052-8cdb-4e49-ae1d-635fe129c89a'"; BLL_ResourceToResourceFolder rtrfbll = new BLL_ResourceToResourceFolder(); rtrflist = rtrfbll.GetModelList(StrWhere); if (rtrflist != null) { string SqlTemp = "delete from FileSyncRecordFail where Resource_Type='df94a052-8cdb-4e49-ae1d-635fe129c89a'"; Rc.Common.DBUtility.DbHelperSQL.ExecuteSql(SqlTemp); foreach (var item in rtrflist) { savePath = string.Format("{0}\\{1}\\{2}\\{3}\\", item.ParticularYear, item.GradeTerm, item.Resource_Version, item.Subject); #region 试卷 BLL_TestQuestions tqbll = new BLL_TestQuestions(); List <Model_TestQuestions> tqlist = new List <Model_TestQuestions>(); tqlist = tqbll.GetModelList("ResourceToResourceFolder_Id='" + item.ResourceToResourceFolder_Id + "'"); if (tqlist != null) { foreach (var tqitem in tqlist) { #region 题干testQuestionBody if (!File.Exists(Server.MapPath(uploadPath + "testQuestionBody\\" + savePath + tqitem.TestQuestions_Id + ".htm"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "testQuestionBody\\" + savePath + tqitem.TestQuestions_Id + ".htm"), item.Resource_Type, "题干htm"); } if (!File.Exists(Server.MapPath(uploadPath + "testQuestionBody\\" + savePath + tqitem.TestQuestions_Id + ".txt"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "testQuestionBody\\" + savePath + tqitem.TestQuestions_Id + ".txt"), item.Resource_Type, "题干txt"); } #endregion #region 分值表 BLL_TestQuestions_Score tqsbll = new BLL_TestQuestions_Score(); DataTable tqsdt = tqsbll.GetList("TestQuestions_Id='" + tqitem.TestQuestions_Id + "'").Tables[0]; if (tqsdt.Rows.Count > 0) { for (int k = 0; k < tqsdt.Rows.Count; k++) { #region 项testQuestionOption if ((tqsdt.Rows[k]["TestType"].ToString() == "selection" || tqsdt.Rows[k]["TestType"].ToString() == "clozeTest") && !File.Exists(Server.MapPath(uploadPath + "testQuestionOption\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "testQuestionOption\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"), item.Resource_Type, "选项txt"); } #endregion #region 答案testQuestionCurrent if ((tqsdt.Rows[k]["TestType"].ToString() == "fill" || tqsdt.Rows[k]["TestType"].ToString() == "answers") && !File.Exists(Server.MapPath(uploadPath + "testQuestionCurrent\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "testQuestionCurrent\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"), item.Resource_Type, "答案txt"); } #endregion #region 解析AnalyzeData/AnalyzeHtml if (!string.IsNullOrEmpty(tqsdt.Rows[k]["AnalyzeHyperlinkData"].ToString()) && !File.Exists(Server.MapPath(uploadPath + "AnalyzeData\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "AnalyzeData\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"), item.Resource_Type, "解析txt"); } if (!string.IsNullOrEmpty(tqsdt.Rows[k]["AnalyzeHyperlinkData"].ToString()) && !File.Exists(Server.MapPath(uploadPath + "AnalyzeHtml\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".htm"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "AnalyzeHtml\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".htm"), item.Resource_Type, "解析htm"); } #endregion #region 强化训练TrainData/TrainHtml if (!string.IsNullOrEmpty(tqsdt.Rows[k]["TrainHyperlinkData"].ToString()) && !File.Exists(Server.MapPath(uploadPath + "TrainData\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "TrainData\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"), item.Resource_Type, "强化训练txt"); } if (!string.IsNullOrEmpty(tqsdt.Rows[k]["TrainHyperlinkData"].ToString()) && !File.Exists(Server.MapPath(uploadPath + "TrainHtml\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".htm"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "TrainHtml\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".htm"), item.Resource_Type, "强化训练htm"); } #endregion } } #endregion } } } #endregion } Response.Redirect(Request.Url.ToString()); } catch (Exception ex) { new BLL_clsAuth().AddLogErrorFromBS("检测同步完成情况失败:", string.Format("类:{0},方法{1},错误信息:{2}", ex.TargetSite.DeclaringType.ToString() , ex.TargetSite.Name.ToString(), ex.Message)); Response.Redirect(Request.Url.ToString()); } }
public static string GetStatsGradeHW_KP(string ResourceToResourceFolder_Id, string GradeId) { try { StringBuilder StrTBody = new StringBuilder(); StringBuilder StrTHead = new StringBuilder(); string StrClassname = string.Empty; string DateSour = string.Empty; string StrKPNum = string.Empty; //班级 BLL_StatsClassHW_KP bllStatsClassHW_KP = new BLL_StatsClassHW_KP(); List <Model_StatsClassHW_KP> StatsClassHW_KPList = new List <Model_StatsClassHW_KP>(); List <Model_StatsClassHW_KP> listAll = new List <Model_StatsClassHW_KP>(); //所有数据 listAll = bllStatsClassHW_KP.GetModelList("ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' and Gradeid='" + GradeId + "' and KPName<>'' order by TestQuestionNums "); List <Model_StatsClassHW_KP> listDistictClass = listAll.Where((x, i) => listAll.FindIndex(z => z.ClassID == x.ClassID) == i).ToList(); //去重后数据 List <Model_StatsClassHW_KP> listDistictKP = listAll.Where((x, i) => listAll.FindIndex(z => z.KPName == x.KPName) == i).ToList(); //去重后数据 foreach (var item in listDistictClass) { StrTHead.AppendFormat("<li title='{0}得分率'>{0}得分率</li>", item.ClassName); } //年级 BLL_StatsGradeHW_KP bllStatsGradeHW_KP = new BLL_StatsGradeHW_KP(); List <Model_StatsGradeHW_KP> StatsGradeHW_KPList = new List <Model_StatsGradeHW_KP>(); List <Model_StatsGradeHW_KP> StatsGradeHW_KPlistAll = new List <Model_StatsGradeHW_KP>(); //所有数据 StatsGradeHW_KPlistAll = bllStatsGradeHW_KP.GetModelList("ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' and Gradeid='" + GradeId + "' and KPName<>'' order by TestQuestionNums "); List <Model_StatsGradeHW_KP> listStatsGradeHW_KP = StatsGradeHW_KPlistAll.Where((x, i) => StatsGradeHW_KPlistAll.FindIndex(z => z.KPName == x.KPName) == i).ToList(); //去重后数据 DataTable dtTQ_S = new BLL_TestQuestions_Score().GetList("ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' order by TestQuestions_Num,TestQuestions_OrderNum ").Tables[0]; string GradeBody = string.Empty; GradeBody = "<ul class=\"clearfix\"><li class=\"perform_left\"><ul class=\"clearfix\"><li class=\"l_1\" title='{0}'>{0}</li><li class=\"l_2\">{1}</li><li class=\"l_3\" title='{2}'>{2}</li><li class=\"l_4\">{3}%</li></ul></li>"; foreach (var item in listStatsGradeHW_KP) { string KPClassNameTemp = string.Empty; string KPScoreAvgRateTemp = string.Empty; string strKPName = item.KPName.Replace("'", "").Replace("\"", ""); StrTBody.AppendFormat(GradeBody , strKPName , item.KPScoreSum.ToString().clearLastZero() , GetTQNum(dtTQ_S, item.KPName, item.TestQuestionNumStrs.TrimEnd('.'), item.TestQuestionNums) , item.KPScoreAvgRate.ToString().clearLastZero()); StrTBody.Append("<li class=\"perform_center\"><div class=\"perform_div\" data-name=\"perform_div\"><ul class=\"clearfix\">"); foreach (var itemClass in listDistictClass) { List <Model_StatsClassHW_KP> listDistictBody = listAll.Where(x => x.ClassID == itemClass.ClassID && x.KPName == item.KPName).ToList(); foreach (var itemBody in listDistictBody) { StrTBody.AppendFormat("<li>{0}%</li>", itemBody.KPScoreAvgRate.ToString().clearLastZero()); KPClassNameTemp += itemClass.ClassName + "†"; KPScoreAvgRateTemp += itemBody.KPScoreAvgRate + "†"; } if (listDistictBody.Count == 0) { StrTBody.Append("<li>-</li>"); KPClassNameTemp += itemClass.ClassName + "†"; KPScoreAvgRateTemp += "0" + "†"; } } //string Josn = "['" + item.KPName + "','" + KPClassNameTemp.TrimEnd(',') + "','" + KPScoreAvgRateTemp.TrimEnd(',') + "']"; //string Josn = ""; StrTBody.Append("</ul></div></li><li class=\"perform_right\"><a href='##' onclick=\"javascript:ShowPic('" + strKPName + "','" + KPClassNameTemp.TrimEnd('†') + "','" + KPScoreAvgRateTemp.TrimEnd('†') + "');\">图表</a></li></ul>"); } string oo = StrTBody.ToString(); return(Newtonsoft.Json.JsonConvert.SerializeObject(new { err = "", thead = StrTHead.ToString(), tbody = StrTBody.ToString() })); } catch (Exception) { return(""); } }
public static string GetStatsGradeHW_TQ(string ResourceToResourceFolder_Id, string GradeId) { try { StringBuilder StrTBody = new StringBuilder(); StringBuilder StrTHead = new StringBuilder(); string StrClassname = string.Empty; string DateSour = string.Empty; string KPScoreAvgRateTemp = string.Empty; string StrKPNum = string.Empty; //班级 BLL_StatsClassHW_TQ bllStatsClassHW_TQ = new BLL_StatsClassHW_TQ(); List <Model_StatsClassHW_TQ> StatsClassHW_TQList = new List <Model_StatsClassHW_TQ>(); List <Model_StatsClassHW_TQ> listAll = new List <Model_StatsClassHW_TQ>(); //所有数据 listAll = bllStatsClassHW_TQ.GetModelList("ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' and Gradeid='" + GradeId + "' order by TestQuestions_Num "); List <Model_StatsClassHW_TQ> listDistictClass = listAll.Where((x, i) => listAll.FindIndex(z => z.ClassID == x.ClassID) == i).ToList(); //去重后数据 List <Model_StatsClassHW_TQ> listDistictKP = listAll.Where((x, i) => listAll.FindIndex(z => z.TestQuestions_Score_ID == x.TestQuestions_Score_ID) == i).ToList(); //去重后数据 foreach (var item in listDistictClass) { StrTHead.AppendFormat("<li title='{0}得分率'>{0}得分率</li>", item.ClassName); } //年级 DataTable dtTQ_S = new BLL_TestQuestions_Score().GetList("ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' order by TestQuestions_Num,TestQuestions_OrderNum ").Tables[0]; BLL_StatsGradeHW_TQ bllStatsGradeHW_TQ = new BLL_StatsGradeHW_TQ(); List <Model_StatsGradeHW_TQ> StatsGradeHW_TQlistAll = new List <Model_StatsGradeHW_TQ>(); //所有数据 StatsGradeHW_TQlistAll = bllStatsGradeHW_TQ.GetModelList("TQ_Score!=-1 and ResourceToResourceFolder_Id='" + ResourceToResourceFolder_Id + "' and Gradeid='" + GradeId + "' order by TestQuestions_Num,TestQuestions_OrderNum "); List <Model_StatsGradeHW_TQ> listStatsGradeHW_TQ = StatsGradeHW_TQlistAll.Where((x, i) => StatsGradeHW_TQlistAll.FindIndex(z => z.TestQuestions_Score_ID == x.TestQuestions_Score_ID) == i).ToList(); //去重后数据 string GradeBody = string.Empty; GradeBody = "<ul class=\"clearfix\"><li class=\"perform_left\"><ul class=\"clearfix\"><li class=\"l_1\">{0}</li><li class=\"l_2\">{1}</li><li class=\"l_3\">{2}%</li></ul></li>"; foreach (var item in listStatsGradeHW_TQ) { List <Model_StatsGradeHW_TQ> listSub = StatsGradeHW_TQlistAll.Where(m => m.TestQuestions_Num == item.TestQuestions_Num).ToList(); DataRow[] drTQ_S = dtTQ_S.Select("TestQuestions_Score_ID='" + item.TestQuestions_Score_ID + "'"); string testIndex = string.Empty; if (drTQ_S.Length > 0 && (drTQ_S[0]["TestType"].ToString() == "clozeTest" || drTQ_S[0]["TestType"].ToString() == "fill")) { testIndex = string.IsNullOrEmpty(drTQ_S[0]["testIndex"].ToString()) ? "" : "-" + drTQ_S[0]["testIndex"].ToString(); } StrTBody.AppendFormat(GradeBody , item.topicNumber.TrimEnd('.') + testIndex , item.TQ_Score.ToString().clearLastZero() , item.ScoreAvgRate.ToString().clearLastZero()); StrTBody.Append("<li class=\"perform_center\"><div class=\"perform_div\" data-name=\"perform_div\"><ul class=\"clearfix\">"); foreach (var itemClass in listDistictClass) { List <Model_StatsClassHW_TQ> listDistictBody = listAll.Where(x => x.ClassID == itemClass.ClassID && x.TestQuestions_Score_ID == item.TestQuestions_Score_ID).ToList(); foreach (var itemBody in listDistictBody) { StrTBody.AppendFormat("<li>{0}%</li>", itemBody.ScoreAvgRate.ToString().clearLastZero()); } if (listDistictBody.Count == 0) { StrTBody.Append("<li>-</li>"); } } StrTBody.Append("</ul></div></li></ul>"); } string oo = StrTBody.ToString(); return(Newtonsoft.Json.JsonConvert.SerializeObject(new { err = "", thead = StrTHead.ToString(), tbody = StrTBody.ToString() })); } catch (Exception) { return(""); } }
protected void btnOn_Click(object sender, EventArgs e) { try { //删除 BLL_FileSyncRecordFail fsrfbll = new BLL_FileSyncRecordFail(); fsrfbll.DeleteClass(" Resource_Type in ('b8ea8767-4ae6-4b90-883f-93415a14e461','f1d1db22-c427-47e6-a8af-13d516d90633','e3a3e85e-2903-4ae6-ba17-f7f2ad9d7e0d')"); List <Rc.Model.Resources.Model_ResourceToResourceFolder> rtrflist = new List <Model_ResourceToResourceFolder>(); string StrWhere = string.Empty; string StartTime = txtStartTime.Text; string EndTime = txtEndTiem.Text; string uploadPath = "\\Upload\\Resource\\"; string filePath = string.Empty; string imgPath = string.Empty; string savePath = string.Empty; string StrText = string.Empty; StrWhere = " Resource_Class='" + Resource_ClassConst.云资源 + "' "; if (!string.IsNullOrEmpty(StartTime)) { StrWhere += " and CreateTime >= '" + StartTime.Filter() + "'"; } if (!string.IsNullOrEmpty(EndTime)) { StrWhere += " and CreateTime <= '" + EndTime.Filter() + "'"; } if (!string.IsNullOrEmpty(hidtxtBook.Value)) { StrWhere += " and Book_ID='" + hidtxtBook.Value + "'"; } StrWhere += " and (Resource_Type in ('b8ea8767-4ae6-4b90-883f-93415a14e461','f1d1db22-c427-47e6-a8af-13d516d90633','e3a3e85e-2903-4ae6-ba17-f7f2ad9d7e0d'))"; BLL_ResourceToResourceFolder rtrfbll = new BLL_ResourceToResourceFolder(); rtrflist = rtrfbll.GetModelList(StrWhere); if (rtrflist != null) { string SqlTemp = "delete from FileSyncRecordFail where Resource_Type in ('b8ea8767-4ae6-4b90-883f-93415a14e461','f1d1db22-c427-47e6-a8af-13d516d90633','e3a3e85e-2903-4ae6-ba17-f7f2ad9d7e0d')"; Rc.Common.DBUtility.DbHelperSQL.ExecuteSql(SqlTemp); foreach (var item in rtrflist) { savePath = string.Format("{0}\\{1}\\{2}\\{3}\\", item.ParticularYear, item.GradeTerm, item.Resource_Version, item.Subject); #region 教案 if ("1" == "1") { switch (item.Resource_Type) { case Resource_TypeConst.ScienceWord类型文件: filePath = "swDocument\\"; imgPath = "swView\\"; StrText = "ScienceWord类型文件"; break; case Resource_TypeConst.class类型微课件: filePath = "microClassDocument\\"; imgPath = "microClassView\\"; StrText = "class类型微课件"; break; case Resource_TypeConst.class类型文件: filePath = "classDocument\\"; imgPath = "classView\\"; StrText = "class类型文件"; break; } #region 判断源文件 和html文件 if (!File.Exists(Server.MapPath(uploadPath + filePath + savePath + item.ResourceToResourceFolder_Id + "." + item.File_Suffix))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + filePath + savePath + item.ResourceToResourceFolder_Id + "." + item.File_Suffix), item.Resource_Type, StrText); } if (!File.Exists(Server.MapPath(uploadPath + filePath + savePath + item.ResourceToResourceFolder_Id + ".htm"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + filePath + savePath + item.ResourceToResourceFolder_Id + ".htm"), item.Resource_Type, StrText); } #endregion #region 判断图片 BLL_ResourceToResourceFolder_img rtrfimgbll = new BLL_ResourceToResourceFolder_img(); DataTable dt = rtrfimgbll.GetList(" ResourceToResourceFolder_id='" + item.ResourceToResourceFolder_Id + "'").Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { if (!File.Exists(Server.MapPath(uploadPath + imgPath + savePath + dt.Rows[i]["ResourceToResourceFolder_img_id"] + ".jpg"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + imgPath + savePath + dt.Rows[i]["ResourceToResourceFolder_img_id"] + ".jpg"), item.Resource_Type, StrText + "jpg"); } } } #endregion } #endregion #region 试卷 else { BLL_TestQuestions tqbll = new BLL_TestQuestions(); List <Model_TestQuestions> tqlist = new List <Model_TestQuestions>(); tqlist = tqbll.GetModelList("ResourceToResourceFolder_Id='" + item.ResourceToResourceFolder_Id + "'"); if (tqlist != null) { foreach (var tqitem in tqlist) { #region 题干testQuestionBody if (!File.Exists(Server.MapPath(uploadPath + "testQuestionBody\\" + savePath + tqitem.TestQuestions_Id + ".htm"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "testQuestionBody\\" + savePath + tqitem.TestQuestions_Id + ".htm"), item.Resource_Type, "题干htm"); } if (!File.Exists(Server.MapPath(uploadPath + "testQuestionBody\\" + savePath + tqitem.TestQuestions_Id + ".txt"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "testQuestionBody\\" + savePath + tqitem.TestQuestions_Id + ".txt"), item.Resource_Type, "题干txt"); } #endregion #region 分值表 BLL_TestQuestions_Score tqsbll = new BLL_TestQuestions_Score(); DataTable tqsdt = tqsbll.GetList("TestQuestions_Id='" + tqitem.TestQuestions_Id + "'").Tables[0]; if (tqsdt.Rows.Count > 0) { for (int k = 0; k < tqsdt.Rows.Count; k++) { #region 项testQuestionOption if (!File.Exists(Server.MapPath(uploadPath + "testQuestionOption\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "testQuestionOption\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"), item.Resource_Type, "选项txt"); } #endregion #region 答案testQuestionCurrent if (!File.Exists(Server.MapPath(uploadPath + "testQuestionCurrent\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "testQuestionCurrent\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"), item.Resource_Type, "答案txt"); } #endregion #region 解析AnalyzeData/AnalyzeHtml if (!File.Exists(Server.MapPath(uploadPath + "AnalyzeData\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "AnalyzeData\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"), item.Resource_Type, "解析txt"); } if (!File.Exists(Server.MapPath(uploadPath + "AnalyzeHtml\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".htm"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "AnalyzeHtml\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".htm"), item.Resource_Type, "解析htm"); } #endregion #region 强化训练TrainData/TrainHtml if (!File.Exists(Server.MapPath(uploadPath + "TrainData\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "TrainData\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"), item.Resource_Type, "强化训练txt"); } if (!File.Exists(Server.MapPath(uploadPath + "TrainHtml\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".htm"))) { InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "TrainHtml\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".htm"), item.Resource_Type, "强化训练htm"); } #endregion } } #endregion } } } #endregion } } Response.Redirect(Request.Url.ToString()); } catch (Exception ex) { new BLL_clsAuth().AddLogErrorFromBS("检测同步完成情况失败:", string.Format("类:{0},方法{1},错误信息:{2}", ex.TargetSite.DeclaringType.ToString() , ex.TargetSite.Name.ToString(), ex.Message)); Response.Redirect(Request.Url.ToString()); } }