/// <summary> /// 同步习题集 /// </summary> public void ResSynchroTeachingPlan() { //生产环境web站点存放文件的主目录 string strProductPublicUrl = ConfigurationManager.AppSettings["ProductPublicUrl"].ToString(); string strCondition = string.Empty; strCondition = string.Format("日期【{0}】;书本【{1}】【{2}】;是覆盖:【{3}】", txtSDate.Value, txtBOOK.Value, hidtxtBOOK.Value, chbCover.Checked); string strFileSyncExecRecord_id = Guid.NewGuid().ToString(); bool isCover = false; isCover = chbCover.Checked; #region 记录同步开始信息 Rc.Model.Resources.Model_FileSyncExecRecord model_FileSyncExecRecord = new Rc.Model.Resources.Model_FileSyncExecRecord(); Rc.BLL.Resources.BLL_FileSyncExecRecord bll_FileSyncExecRecord = new Rc.BLL.Resources.BLL_FileSyncExecRecord(); model_FileSyncExecRecord.FileSyncExecRecord_id = strFileSyncExecRecord_id; model_FileSyncExecRecord.FileSyncExecRecord_Type = "同步试卷" + SchoolId; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "同步进行中..."; model_FileSyncExecRecord.FileSyncExecRecord_TimeStart = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "0"; model_FileSyncExecRecord.FileSyncExecRecord_Condition = strCondition; model_FileSyncExecRecord.createUser = SysUser_ID; #endregion try { bll_FileSyncExecRecord.Add(model_FileSyncExecRecord); //试卷文件相关数据 DataTable dtFileTestPaper = GetDtFileTestPaperTestQuestion(); DataRow[] dvFileTestPaper = dtFileTestPaper.Select(); #region 载文件 //题干 BASE64内容,存储目录:testQuestionBody/属性层次目录/试题标识.txt DownLoadFile(dvFileTestPaper, "testQuestionBody", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "题干txt", isCover); //题干 HTML内容,存储目录:testQuestionBody/属性层次目录/试题标识.htm DownLoadFile(dvFileTestPaper, "testQuestionBody", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "题干htm", isCover); DataTable dtFileTestPaperScore = GetDtFileTestPaperTestQuestions_Score(); DataRow[] dvFileTestPaperScore = dtFileTestPaperScore.Select(); // 选择题的选项(数组对象)存储目录:testQuestionOption/属性层次目录/试题标识.txt(存储JSION结构到文本文件,一个题只有一个文件) DownLoadFile(dvFileTestPaperScore, "testQuestionOption", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "选择题选项txt", isCover); // c) 标准答案(数组)存储目录:testQuestionCurrent/属性层次目录/试题标识.txt(存储JSION结构到文本文件,一个题只有一个文件) DownLoadFile(dvFileTestPaperScore, "testQuestionCurrent", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "标准答案txt", isCover); // 解析 BASE64内容AnalyzeData/属性层次目录/试题标识.txt DownLoadFile(dvFileTestPaperScore, "AnalyzeData", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "解析txt", isCover); // 解析 HTML内容AnalyzeHtml/属性层次目录/试题标识.htm DownLoadFile(dvFileTestPaperScore, "AnalyzeHtml", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "解析htm", isCover); // e) 强化训练 BASE64内容TrainData/属性层次目录/试题标识.txt DownLoadFile(dvFileTestPaperScore, "TrainData", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "强化训练txt", isCover); // e) 强化训练 HTML内容TrainHtml/属性层次目录/试题标识.htm DownLoadFile(dvFileTestPaperScore, "TrainHtml", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "强化训练htm", isCover); #endregion #region 记录同步结束信息并保存数据 model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "1"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "同步已完成"; bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); #endregion } catch (Exception ex) { model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "2"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "同步失败:" + ex.Message.ToString(); model_FileSyncExecRecord.FileSyncExecRecord_Remark = ex.Message.ToString(); bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); throw; } }
/// <summary> /// 自动同步教案 /// </summary> public void ResSynResource() { //生产环境web站点存放文件的主目录 string strProductPublicUrl = ConfigurationManager.AppSettings["ProductPublicUrl"].ToString(); string strCondition = string.Empty; string strFileSyncExecRecord_id = Guid.NewGuid().ToString(); bool isCover = false; #region 记录同步开始信息 Rc.Model.Resources.Model_FileSyncExecRecord model_FileSyncExecRecord = new Rc.Model.Resources.Model_FileSyncExecRecord(); Rc.BLL.Resources.BLL_FileSyncExecRecord bll_FileSyncExecRecord = new Rc.BLL.Resources.BLL_FileSyncExecRecord(); model_FileSyncExecRecord.FileSyncExecRecord_id = strFileSyncExecRecord_id; model_FileSyncExecRecord.FileSyncExecRecord_Type = "自动同步教案"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "同步进行中..."; model_FileSyncExecRecord.FileSyncExecRecord_TimeStart = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "0"; model_FileSyncExecRecord.FileSyncExecRecord_Condition = strCondition; model_FileSyncExecRecord.createUser = ""; #endregion try { bll_FileSyncExecRecord.Add(model_FileSyncExecRecord); string strSql = string.Empty; strSql = string.Format(@"select ResourceToResourceFolder_Id,Resource_Type,Resource_Class,Resource_Version,GradeTerm,Subject,ParticularYear,Book_Id from ResourceToResourceFolder where ResourceToResourceFolder_Id in( select DataId from SyncData where OperateType in('add','modify') and TableName='ResourceToResourceFolder' and SyncStatus=1 ) and Resource_Type in ('{0}','{1}','{2}') and Resource_Class='{3}' " , Resource_TypeConst.ScienceWord类型文件 , Resource_TypeConst.class类型文件 , Resource_TypeConst.class类型微课件 , Resource_ClassConst.云资源);//and CONVERT(varchar(10),CreateTime,23)=CONVERT(varchar(10),DATEADD(day,-1,getDate()),23)) DataTable dtResource = Rc.Common.DBUtility.DbHelperSQL.Query(strSql, 300).Tables[0]; foreach (DataRow item in dtResource.Rows) { #region class类型文件下载 strSql = string.Format(@"select ResourceToResourceFolder_Id,ResourceToResourceFolder_Id as FileName,Resource_Type,Resource_Class,Resource_Version,GradeTerm,Subject,ParticularYear from ResourceToResourceFolder where ResourceToResourceFolder_Id='" + item["ResourceToResourceFolder_Id"].ToString() + "'"); DataTable dtFilePlan = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0]; //教案SW+thm DataRow[] drSWdsc = dtFilePlan.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.ScienceWord类型文件)); DownLoadFile(drSWdsc, "swDocument", item["ParticularYear"].ToString(), item["GradeTerm"].ToString(), item["Resource_Version"].ToString(), item["Subject"].ToString(), "dsc", strProductPublicUrl, strFileSyncExecRecord_id, "教案SWdsc", item["Book_Id"].ToString(), item["Resource_Type"].ToString(), isCover); DownLoadFile(drSWdsc, "swDocument", item["ParticularYear"].ToString(), item["GradeTerm"].ToString(), item["Resource_Version"].ToString(), item["Subject"].ToString(), "htm", strProductPublicUrl, strFileSyncExecRecord_id, "教案SWdsc", item["Book_Id"].ToString(), item["Resource_Type"].ToString(), isCover); //教案class+thm DataRow[] drClass = dtFilePlan.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.class类型文件)); DownLoadFile(drClass, "classDocument", item["ParticularYear"].ToString(), item["GradeTerm"].ToString(), item["Resource_Version"].ToString(), item["Subject"].ToString(), "class", strProductPublicUrl, strFileSyncExecRecord_id, "教案class", item["Book_Id"].ToString(), item["Resource_Type"].ToString(), isCover); DownLoadFile(drClass, "classDocument", item["ParticularYear"].ToString(), item["GradeTerm"].ToString(), item["Resource_Version"].ToString(), item["Subject"].ToString(), "htm", strProductPublicUrl, strFileSyncExecRecord_id, "教案class", item["Book_Id"].ToString(), item["Resource_Type"].ToString(), isCover); //微课class+thm DataRow[] drMicroClass = dtFilePlan.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.class类型微课件)); DownLoadFile(drMicroClass, "microClassDocument", item["ParticularYear"].ToString(), item["GradeTerm"].ToString(), item["Resource_Version"].ToString(), item["Subject"].ToString(), "class", strProductPublicUrl, strFileSyncExecRecord_id, "微课class", item["Book_Id"].ToString(), item["Resource_Type"].ToString(), isCover); DownLoadFile(drMicroClass, "microClassDocument", item["ParticularYear"].ToString(), item["GradeTerm"].ToString(), item["Resource_Version"].ToString(), item["Subject"].ToString(), "htm", strProductPublicUrl, strFileSyncExecRecord_id, "微课class", item["Book_Id"].ToString(), item["Resource_Type"].ToString(), isCover); //教案预览图片文件相关数据 //教案SW+预览图片 strSql = string.Format(@" select t.ResourceToResourceFolder_img_id as FileName,t.ResourceToResourceFolder_Id ,rtrf.Resource_Type from ResourceToResourceFolder_img t inner join ResourceToResourceFolder rtrf on t.ResourceToResourceFolder_id=rtrf.ResourceToResourceFolder_id where t.ResourceToResourceFolder_id='{0}'", item["ResourceToResourceFolder_id"].ToString()); DataTable dtFilePlanView = new DataTable(); dtFilePlanView = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0]; DataRow[] drSWdscView = dtFilePlanView.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.ScienceWord类型文件)); DownLoadFile(drSWdscView, "swView", item["ParticularYear"].ToString(), item["GradeTerm"].ToString(), item["Resource_Version"].ToString(), item["Subject"].ToString(), "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "教案SW预览图片", item["Book_Id"].ToString(), item["Resource_Type"].ToString(), isCover); //教案Class+预览图片 DataRow[] drClassView = dtFilePlanView.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.class类型文件)); DownLoadFile(drClassView, "classView", item["ParticularYear"].ToString(), item["GradeTerm"].ToString(), item["Resource_Version"].ToString(), item["Subject"].ToString(), "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "教案Class预览图片", item["Book_Id"].ToString(), item["Resource_Type"].ToString(), isCover); //微课Class+预览图片 DataRow[] drMicroClassView = dtFilePlanView.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.class类型微课件)); DownLoadFile(drMicroClassView, "microClassView", item["ParticularYear"].ToString(), item["GradeTerm"].ToString(), item["Resource_Version"].ToString(), item["Subject"].ToString(), "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "微课Class预览图片", item["Book_Id"].ToString(), item["Resource_Type"].ToString(), isCover); #endregion #region 成功更新SycnData 状态 string sql = " update SyncData set SyncStatus='3' where OperateType in('add','modify') and DataId='" + item["ResourceToResourceFolder_Id"] + "'"; int i = Rc.Common.DBUtility.DbHelperSQL.ExecuteSql(sql); #endregion } #region 记录同步结束信息并保存数据 model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "1"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "同步已完成"; bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); #endregion } catch (Exception ex) { model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "2"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "同步失败:" + ex.Message.ToString(); model_FileSyncExecRecord.FileSyncExecRecord_Remark = ex.Message.ToString(); bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); } }
/// <summary> /// 同步老师自有文件 /// </summary> public void ResSynchroFile() { //运营平台web站点存放文件的主目录 string strProductPublicUrl = sourceServerUrl; string strFileSyncExecRecord_id = Guid.NewGuid().ToString(); string strSchoolName = string.Empty; if (!string.IsNullOrEmpty(SchoolId)) { Rc.Model.Resources.Model_UserGroup modelUG = new Rc.BLL.Resources.BLL_UserGroup().GetModel(SchoolId); if (modelUG != null) { strSchoolName = string.Format(",学校名称:{0}", modelUG.UserGroup_Name); } } string strCondition = string.Format("学校标识:{0}{1},来源服务器:{2},目标服务器:{3}", SchoolId, strSchoolName, sourceServerUrl, targetServerUrl); #region 记录同步开始信息 Rc.Model.Resources.Model_FileSyncExecRecord model_FileSyncExecRecord = new Rc.Model.Resources.Model_FileSyncExecRecord(); Rc.BLL.Resources.BLL_FileSyncExecRecord bll_FileSyncExecRecord = new Rc.BLL.Resources.BLL_FileSyncExecRecord(); model_FileSyncExecRecord.FileSyncExecRecord_id = strFileSyncExecRecord_id; model_FileSyncExecRecord.FileSyncExecRecord_Type = "同步老师自有文件" + SchoolId; model_FileSyncExecRecord.FileSyncExecRecord_TimeStart = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "0"; model_FileSyncExecRecord.createUser = SysUser_ID; model_FileSyncExecRecord.FileSyncExecRecord_Condition = strCondition; bll_FileSyncExecRecord.Add(model_FileSyncExecRecord); #endregion try { #region 载文件 //教案文件,htm文件相关数据 DataTable dtFilePlan = GetDtFilePlan(); //教案SW+thm DataRow[] drSWdsc = dtFilePlan.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.ScienceWord类型文件)); DownLoadFileTeachingPlan(drSWdsc, "swDocument", "dsc", strProductPublicUrl, strFileSyncExecRecord_id, "教案SWdsc"); DownLoadFileTeachingPlan(drSWdsc, "swDocument", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "教案SWdsc"); //教案class+thm DataRow[] drClass = dtFilePlan.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.class类型文件)); DownLoadFileTeachingPlan(drClass, "classDocument", "class", strProductPublicUrl, strFileSyncExecRecord_id, "教案class"); DownLoadFileTeachingPlan(drClass, "classDocument", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "教案class"); //微课class+thm DataRow[] drMicroClass = dtFilePlan.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.class类型微课件)); DownLoadFileTeachingPlan(drMicroClass, "microClassDocument", "class", strProductPublicUrl, strFileSyncExecRecord_id, "微课class"); DownLoadFileTeachingPlan(drMicroClass, "microClassDocument", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "微课class"); //教案预览图片文件相关数据 DataTable dtFilePlanView = GetDtFilePlanView(); //教案SW+预览图片 DataRow[] drSWdscView = dtFilePlanView.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.ScienceWord类型文件)); DownLoadFileTeachingPlan(drSWdscView, "swView", "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "教案SW预览图片"); //教案Class+预览图片 DataRow[] drClassView = dtFilePlanView.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.class类型文件)); DownLoadFileTeachingPlan(drClassView, "classView", "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "教案Class预览图片"); //微课Class+预览图片 DataRow[] drMicroClassView = dtFilePlanView.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.class类型微课件)); DownLoadFileTeachingPlan(drMicroClassView, "microClassView", "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "微课Class预览图片"); #endregion #region 载文件 //试卷文件相关数据 DataTable dtFileTestPaper = GetDtFileTestPaperTestQuestion(); DataRow[] dvFileTestPaper = dtFileTestPaper.Select(); //题干 BASE64内容,存储目录:testQuestionBody/属性层次目录/试题标识.txt DownLoadFileTestpaper(dvFileTestPaper, "testQuestionBody", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "题干txt"); //题干 HTML内容,存储目录:testQuestionBody/属性层次目录/试题标识.htm DownLoadFileTestpaper(dvFileTestPaper, "testQuestionBody", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "题干htm"); DataTable dtFileTestPaperScore = GetDtFileTestPaperTestQuestions_Score(); DataRow[] dvFileTestPaperScore = dtFileTestPaperScore.Select(); // 选择题的选项(数组对象)存储目录:testQuestionOption/属性层次目录/试题标识.txt(存储JSION结构到文本文件,一个题只有一个文件) DownLoadFileTestpaper(dvFileTestPaperScore, "testQuestionOption", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "选择题选项txt"); // c) 标准答案(数组)存储目录:testQuestionCurrent/属性层次目录/试题标识.txt(存储JSION结构到文本文件,一个题只有一个文件) DownLoadFileTestpaper(dvFileTestPaperScore, "testQuestionCurrent", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "标准答案txt"); // 解析 BASE64内容AnalyzeData/属性层次目录/试题标识.txt DownLoadFileTestpaper(dvFileTestPaperScore, "AnalyzeData", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "解析txt"); // 解析 HTML内容AnalyzeHtml/属性层次目录/试题标识.htm DownLoadFileTestpaper(dvFileTestPaperScore, "AnalyzeHtml", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "解析htm"); // e) 强化训练 BASE64内容TrainData/属性层次目录/试题标识.txt DownLoadFileTestpaper(dvFileTestPaperScore, "TrainData", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "强化训练txt"); // e) 强化训练 HTML内容TrainHtml/属性层次目录/试题标识.htm DownLoadFileTestpaper(dvFileTestPaperScore, "TrainHtml", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "强化训练htm"); #endregion #region 记录同步结束信息并保存数据 model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "1"; bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); #endregion } catch (Exception ex) { model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "2"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "同步失败:" + ex.Message.ToString(); bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); } }
/// <summary> /// 同步习题集 /// </summary> public void ResSynResource() { //生产环境web站点存放文件的主目录 string strProductPublicUrl = ConfigurationManager.AppSettings["ProductPublicUrl"].ToString(); string strCondition = string.Empty; string strFileSyncExecRecord_id = Guid.NewGuid().ToString(); bool isCover = false; #region 记录同步开始信息 Rc.Model.Resources.Model_FileSyncExecRecord model_FileSyncExecRecord = new Rc.Model.Resources.Model_FileSyncExecRecord(); Rc.BLL.Resources.BLL_FileSyncExecRecord bll_FileSyncExecRecord = new Rc.BLL.Resources.BLL_FileSyncExecRecord(); model_FileSyncExecRecord.FileSyncExecRecord_id = strFileSyncExecRecord_id; model_FileSyncExecRecord.FileSyncExecRecord_Type = "自动同步习题集"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "同步进行中..."; model_FileSyncExecRecord.FileSyncExecRecord_TimeStart = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "0"; model_FileSyncExecRecord.FileSyncExecRecord_Condition = strCondition; model_FileSyncExecRecord.createUser = ""; #endregion try { bll_FileSyncExecRecord.Add(model_FileSyncExecRecord); string strSql = string.Empty; strSql = string.Format(@"select ResourceToResourceFolder_Id,Resource_Type,Resource_Class,Resource_Version,GradeTerm,Subject,ParticularYear,Book_Id from ResourceToResourceFolder where ResourceToResourceFolder_Id in( select DataId from SyncData where OperateType in('add','modify') and TableName='ResourceToResourceFolder' and SyncStatus=1 ) and Resource_Type='{0}' and Resource_Class='{1}' " , Resource_TypeConst.testPaper类型文件 , Resource_ClassConst.云资源);//and CONVERT(varchar(10),CreateTime,23)=CONVERT(varchar(10),DATEADD(day,-1,getDate()),23)) DataTable dtResource = Rc.Common.DBUtility.DbHelperSQL.Query(strSql, 300).Tables[0]; foreach (DataRow item in dtResource.Rows) { #region 载文件 试卷类型 strSql = string.Format(@"select TestQuestions_Id as FileName,ResourceToResourceFolder_Id from TestQuestions where ResourceToResourceFolder_Id in('{0}')", item["ResourceToResourceFolder_Id"]); DataTable dtFileTestPaper = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0]; //试卷文件相关数据 DataRow[] dvFileTestPaper = dtFileTestPaper.Select(); //题干 BASE64内容,存储目录:testQuestionBody/属性层次目录/试题标识.txt DownLoadFile(dvFileTestPaper, "testQuestionBody", item["ParticularYear"].ToString(), item["GradeTerm"].ToString(), item["Resource_Version"].ToString(), item["Subject"].ToString(), "txt", strProductPublicUrl, strFileSyncExecRecord_id, "题干txt", item["Book_Id"].ToString(), item["Resource_Type"].ToString(), isCover); //题干 HTML内容,存储目录:testQuestionBody/属性层次目录/试题标识.htm DownLoadFile(dvFileTestPaper, "testQuestionBody", item["ParticularYear"].ToString(), item["GradeTerm"].ToString(), item["Resource_Version"].ToString(), item["Subject"].ToString(), "htm", strProductPublicUrl, strFileSyncExecRecord_id, "题干htm", item["Book_Id"].ToString(), item["Resource_Type"].ToString(), isCover); //题的选项等 strSql = string.Format(@"select t3.TestQuestions_Score_ID as FileName,t2.ResourceToResourceFolder_Id from TestQuestions t2 inner join TestQuestions_Score t3 on t2.TestQuestions_Id=t3.TestQuestions_Id where t2.ResourceToResourceFolder_Id='{0}' and TestQuestions_Type!='title'", item["ResourceToResourceFolder_Id"]); DataTable dtFileTestPaperScore = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0]; DataRow[] dvFileTestPaperScore = dtFileTestPaperScore.Select(); // 选择题的选项(数组对象)存储目录:testQuestionOption/属性层次目录/试题标识.txt(存储JSION结构到文本文件,一个题只有一个文件) DownLoadFile(dvFileTestPaperScore, "testQuestionOption", item["ParticularYear"].ToString(), item["GradeTerm"].ToString(), item["Resource_Version"].ToString(), item["Subject"].ToString(), "txt", strProductPublicUrl, strFileSyncExecRecord_id, "选择题选项txt", item["Book_Id"].ToString(), item["Resource_Type"].ToString(), isCover); // c) 标准答案(数组)存储目录:testQuestionCurrent/属性层次目录/试题标识.txt(存储JSION结构到文本文件,一个题只有一个文件) DownLoadFile(dvFileTestPaperScore, "testQuestionCurrent", item["ParticularYear"].ToString(), item["GradeTerm"].ToString(), item["Resource_Version"].ToString(), item["Subject"].ToString(), "txt", strProductPublicUrl, strFileSyncExecRecord_id, "标准答案txt", item["Book_Id"].ToString(), item["Resource_Type"].ToString(), isCover); // 解析 BASE64内容AnalyzeData/属性层次目录/试题标识.txt DownLoadFile(dvFileTestPaperScore, "AnalyzeData", item["ParticularYear"].ToString(), item["GradeTerm"].ToString(), item["Resource_Version"].ToString(), item["Subject"].ToString(), "txt", strProductPublicUrl, strFileSyncExecRecord_id, "解析txt", item["Book_Id"].ToString(), item["Resource_Type"].ToString(), isCover); // 解析 HTML内容AnalyzeHtml/属性层次目录/试题标识.htm DownLoadFile(dvFileTestPaperScore, "AnalyzeHtml", item["ParticularYear"].ToString(), item["GradeTerm"].ToString(), item["Resource_Version"].ToString(), item["Subject"].ToString(), "htm", strProductPublicUrl, strFileSyncExecRecord_id, "解析htm", item["Book_Id"].ToString(), item["Resource_Type"].ToString(), isCover); // e) 强化训练 BASE64内容TrainData/属性层次目录/试题标识.txt DownLoadFile(dvFileTestPaperScore, "TrainData", item["ParticularYear"].ToString(), item["GradeTerm"].ToString(), item["Resource_Version"].ToString(), item["Subject"].ToString(), "txt", strProductPublicUrl, strFileSyncExecRecord_id, "强化训练txt", item["Book_Id"].ToString(), item["Resource_Type"].ToString(), isCover); // e) 强化训练 HTML内容TrainHtml/属性层次目录/试题标识.htm DownLoadFile(dvFileTestPaperScore, "TrainHtml", item["ParticularYear"].ToString(), item["GradeTerm"].ToString(), item["Resource_Version"].ToString(), item["Subject"].ToString(), "htm", strProductPublicUrl, strFileSyncExecRecord_id, "强化训练htm", item["Book_Id"].ToString(), item["Resource_Type"].ToString(), isCover); #endregion #region 成功更新SycnData 状态 string sql = " update SyncData set SyncStatus='3' where OperateType in('add','modify') and DataId='" + item["ResourceToResourceFolder_Id"] + "' "; int i = Rc.Common.DBUtility.DbHelperSQL.ExecuteSql(sql); #endregion } #region 记录同步结束信息并保存数据 model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "1"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "同步已完成"; bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); #endregion } catch (Exception ex) { model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "2"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "同步失败:" + ex.Message.ToString(); model_FileSyncExecRecord.FileSyncExecRecord_Remark = ex.Message.ToString(); bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); } }
/// <summary> /// 同步学校教案数据 /// </summary> public void ResSynchroTeachingPlan() { //生产环境web站点存放文件的主目录 string strProductPublicUrl = ConfigurationManager.AppSettings["ProductPublicUrl"].ToString(); string strFileSyncExecRecord_id = Guid.NewGuid().ToString(); bool isCover = false; string strCondition = string.Empty; strCondition = string.Format("日期【{0}】;书本【{1}】【{2}】;是覆盖:【{3}】", txtSDate.Value, txtBOOK.Value, hidtxtBOOK.Value, chbCover.Checked); #region 记录同步开始信息 Rc.Model.Resources.Model_FileSyncExecRecord model_FileSyncExecRecord = new Rc.Model.Resources.Model_FileSyncExecRecord(); Rc.BLL.Resources.BLL_FileSyncExecRecord bll_FileSyncExecRecord = new Rc.BLL.Resources.BLL_FileSyncExecRecord(); model_FileSyncExecRecord.FileSyncExecRecord_id = strFileSyncExecRecord_id; model_FileSyncExecRecord.FileSyncExecRecord_Type = "同步教案" + SchoolId; model_FileSyncExecRecord.FileSyncExecRecord_TimeStart = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "0"; model_FileSyncExecRecord.createUser = SysUser_ID; model_FileSyncExecRecord.FileSyncExecRecord_Condition = strCondition; #endregion isCover = chbCover.Checked; try { bll_FileSyncExecRecord.Add(model_FileSyncExecRecord); //教案文件,htm文件相关数据 DataTable dtFilePlan = GetDtFilePlan(); #region 载文件 //教案SW+thm DataRow[] drSWdsc = dtFilePlan.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.ScienceWord类型文件)); DownLoadFile(drSWdsc, "swDocument", "dsc", strProductPublicUrl, strFileSyncExecRecord_id, "教案SWdsc", isCover); DownLoadFile(drSWdsc, "swDocument", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "教案SWdsc", isCover); //教案class+thm DataRow[] drClass = dtFilePlan.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.class类型文件)); DownLoadFile(drClass, "classDocument", "class", strProductPublicUrl, strFileSyncExecRecord_id, "教案class", isCover); DownLoadFile(drClass, "classDocument", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "教案class", isCover); //微课class+thm DataRow[] drMicroClass = dtFilePlan.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.class类型微课件)); DownLoadFile(drMicroClass, "microClassDocument", "class", strProductPublicUrl, strFileSyncExecRecord_id, "微课class", isCover); DownLoadFile(drMicroClass, "microClassDocument", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "微课class", isCover); //教案预览图片文件相关数据 DataTable dtFilePlanView = GetDtFilePlanView(); //教案SW+预览图片 DataRow[] drSWdscView = dtFilePlanView.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.ScienceWord类型文件)); DownLoadFile(drSWdscView, "swView", "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "教案SW预览图片", isCover); //教案Class+预览图片 DataRow[] drClassView = dtFilePlanView.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.class类型文件)); DownLoadFile(drClassView, "classView", "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "教案Class预览图片", isCover); //微课Class+预览图片 DataRow[] drMicroClassView = dtFilePlanView.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.class类型微课件)); DownLoadFile(drMicroClassView, "microClassView", "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "微课Class预览图片", isCover); #endregion #region 记录同步结束信息并保存数据 model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "1"; bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); #endregion } catch (Exception ex) { model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "2"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "同步失败:" + ex.Message.ToString(); bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); } }
/// <summary> /// 同步作业相关文件 /// </summary> public void ResSynchroFile() { // web站点存放文件的主目录 string strProductPublicUrl = sourceServerUrl; string strFileSyncExecRecord_id = Guid.NewGuid().ToString(); string strCondition = string.Format("学校标识:{0},来源服务器:{1},目标服务器:{2}", SchoolId, sourceServerUrl, targetServerUrl); #region 记录同步开始信息 Rc.Model.Resources.Model_FileSyncExecRecord model_FileSyncExecRecord = new Rc.Model.Resources.Model_FileSyncExecRecord(); Rc.BLL.Resources.BLL_FileSyncExecRecord bll_FileSyncExecRecord = new Rc.BLL.Resources.BLL_FileSyncExecRecord(); model_FileSyncExecRecord.FileSyncExecRecord_id = strFileSyncExecRecord_id; model_FileSyncExecRecord.FileSyncExecRecord_Type = "同步作业相关文件" + SchoolId; model_FileSyncExecRecord.FileSyncExecRecord_TimeStart = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "0"; model_FileSyncExecRecord.createUser = SysUser_ID; model_FileSyncExecRecord.FileSyncExecRecord_Condition = strCondition; bll_FileSyncExecRecord.Add(model_FileSyncExecRecord); #endregion try { #region 载作业文件 // 作业数据 DataTable dtHW = GetDtHW(); DataRow[] dvHW = dtHW.Select(); // 学生作业文件 JSON结构内容,存储目录:studentPaper/作业时间/作业标识.txt DownLoadFile(dvHW, "studentPaper", "hwTime", "hwId", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "学生作业txt"); // 老师作业文件 JSON结构内容,存储目录:studentPaper/作业时间/作业标识.htm DownLoadFile(dvHW, "studentPaper", "hwTime", "hwId", "tch.txt", strProductPublicUrl, strFileSyncExecRecord_id, "老师作业txt"); // 学生作业数据 DataTable dtStuHW = GetDtStuHW(); DataRow[] dvStuHW = dtStuHW.Select(); // 学生答题文件 JSON结构内容,存储目录:studentAnswerForSubmit/作业时间/作业标识/学生作业标识.txt DownLoadFile(dvStuHW, "studentAnswerForSubmit", "hwTime,hwId", "shwId", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "学生答题txt"); // 学生答题批改文件 JSON结构内容,存储目录:studentAnswerForMarking/作业时间/学生作业标识/学生作业标识.txt DownLoadFile(dvStuHW, "studentAnswerForMarking", "hwTime,shwId", "shwId", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "学生答题For批改txt"); // 老师批改笔记 BASE64内容,存储目录:teacherMarking/作业时间/学生作业标识/学生作业标识.txt DownLoadFile(dvStuHW, "teacherMarking", "hwTime,shwId", "shwId", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "老师批改笔记txt"); // 学生作业答题数据 DataTable dtStuHWAnswer = GetDtStuHWAnswer(); DataRow[] dvStuHWAnswer = dtStuHWAnswer.Select(); // 学生答题答案文件 html内容,存储目录:studentAnswer/作业时间/云资源属性层次目录/学生作业答题标识.txt(一个答题空有一个文件) DownLoadFile(dvStuHWAnswer, "studentAnswer", "hwTime,ParticularYear,GradeTerm,Resource_Version,Subject", "shwaId", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "学生答题-答案文件txt"); // 老师批改批注 BASE64内容,存储目录:teacherMarking/作业时间/学生作业标识/试题标识.txt(一个试题有一个文件) DownLoadFile(dvStuHW, "teacherMarking", "hwTime,shwId", "tqId", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "老师批改批注txt"); #endregion #region 记录同步结束信息并保存数据 model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "1"; bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); #endregion } catch (Exception ex) { model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "2"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "同步失败:" + ex.Message.ToString(); bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); } }
/// <summary> /// 同步老师自有教案 /// </summary> public void ResSynchroFile() { //运营平台web站点存放文件的主目录 string strProductPublicUrl = sourceServerUrl; string strFileSyncExecRecord_id = Guid.NewGuid().ToString(); string strSchoolName = string.Empty; if (!string.IsNullOrEmpty(SchoolId)) { Rc.Model.Resources.Model_UserGroup modelUG = new Rc.BLL.Resources.BLL_UserGroup().GetModel(SchoolId); if (modelUG != null) { strSchoolName = string.Format(",学校名称:{0}", modelUG.UserGroup_Name); } } string strCondition = string.Format("学校标识:{0}{1},来源服务器:{2},目标服务器:{3}", SchoolId, strSchoolName, sourceServerUrl, targetServerUrl); #region 记录同步开始信息 Rc.Model.Resources.Model_FileSyncExecRecord model_FileSyncExecRecord = new Rc.Model.Resources.Model_FileSyncExecRecord(); Rc.BLL.Resources.BLL_FileSyncExecRecord bll_FileSyncExecRecord = new Rc.BLL.Resources.BLL_FileSyncExecRecord(); model_FileSyncExecRecord.FileSyncExecRecord_id = strFileSyncExecRecord_id; model_FileSyncExecRecord.FileSyncExecRecord_Type = "同步老师自有教案" + SchoolId; model_FileSyncExecRecord.FileSyncExecRecord_TimeStart = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "0"; model_FileSyncExecRecord.createUser = SysUser_ID; model_FileSyncExecRecord.FileSyncExecRecord_Condition = strCondition; bll_FileSyncExecRecord.Add(model_FileSyncExecRecord); #endregion try { #region 载文件 //教案文件,htm文件相关数据 DataTable dtFilePlan = GetDtFilePlan(); //教案SW+thm DataRow[] drSWdsc = dtFilePlan.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.ScienceWord类型文件)); DownLoadFileTeachingPlan(drSWdsc, "swDocument", "dsc", strProductPublicUrl, strFileSyncExecRecord_id, "教案SWdsc"); DownLoadFileTeachingPlan(drSWdsc, "swDocument", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "教案SWdsc"); //教案class+thm DataRow[] drClass = dtFilePlan.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.class类型文件)); DownLoadFileTeachingPlan(drClass, "classDocument", "class", strProductPublicUrl, strFileSyncExecRecord_id, "教案class"); DownLoadFileTeachingPlan(drClass, "classDocument", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "教案class"); //微课class+thm DataRow[] drMicroClass = dtFilePlan.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.class类型微课件)); DownLoadFileTeachingPlan(drMicroClass, "microClassDocument", "class", strProductPublicUrl, strFileSyncExecRecord_id, "微课class"); DownLoadFileTeachingPlan(drMicroClass, "microClassDocument", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "微课class"); //教案预览图片文件相关数据 DataTable dtFilePlanView = GetDtFilePlanView(); //教案SW+预览图片 DataRow[] drSWdscView = dtFilePlanView.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.ScienceWord类型文件)); DownLoadFileTeachingPlan(drSWdscView, "swView", "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "教案SW预览图片"); //教案Class+预览图片 DataRow[] drClassView = dtFilePlanView.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.class类型文件)); DownLoadFileTeachingPlan(drClassView, "classView", "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "教案Class预览图片"); //微课Class+预览图片 DataRow[] drMicroClassView = dtFilePlanView.Select(string.Format(" Resource_Type='{0}'", Resource_TypeConst.class类型微课件)); DownLoadFileTeachingPlan(drMicroClassView, "microClassView", "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "微课Class预览图片"); #endregion #region 记录同步结束信息并保存数据 model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "1"; bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); #endregion } catch (Exception ex) { model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "2"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "同步失败:" + ex.Message.ToString(); bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); } }