/// <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 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); } }