private void SynchronousData() { string strFileSyncExecRecord_id = Guid.NewGuid().ToString(); 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 = "同步数据new"; model_FileSyncExecRecord.FileSyncExecRecord_TimeStart = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "同步进行中..."; model_FileSyncExecRecord.FileSyncExecRecord_Status = "0"; model_FileSyncExecRecord.createUser = ""; try { //记录同步之前的信息 bll_FileSyncExecRecord.Add(model_FileSyncExecRecord); ExecSyncData(strFileSyncExecRecord_id); model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "1"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "同步已完成"; //记录同步完成后的信息 bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); } catch (Exception ex) { model_FileSyncExecRecord.FileSyncExecRecord_Status = "2"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "同步失败:" + ex.Message.ToString(); //记录同步完成后的信息 bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); } }
public void ResSynResource() { string strFileSyncExecRecord_id = Guid.NewGuid().ToString(); startTime = DateTime.Now; string strbookId = hid_bookId.Value.Filter(); string strrtrfId = hid_rtrfId.Value.Filter(); string strrType = hid_rType.Value.Filter(); if (string.IsNullOrEmpty(strrType)) // 同步所有 { ResSynResourceTestPaper(strFileSyncExecRecord_id, strbookId, strrtrfId); ResSynResourcePlan(strFileSyncExecRecord_id, strbookId, strrtrfId); } else if (strrType == Resource_TypeConst.testPaper类型文件)// 只同步习题集 { ResSynResourceTestPaper(strFileSyncExecRecord_id, strbookId, strrtrfId); } else // 只同步教案 { ResSynResourcePlan(strFileSyncExecRecord_id, strbookId, strrtrfId); } #region 执行完同步后系统自动更新一下待同步图书数量 string strFileSyncExecRecord_id_exec = Guid.NewGuid().ToString(); 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_exec; model_FileSyncExecRecord.FileSyncExecRecord_Type = "更新待同步图书数量"; model_FileSyncExecRecord.FileSyncExecRecord_TimeStart = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "执行进行中..."; model_FileSyncExecRecord.FileSyncExecRecord_Status = "0"; model_FileSyncExecRecord.createUser = SysUser_ID; try { //记录同步之前的信息 bll_FileSyncExecRecord.Add(model_FileSyncExecRecord); Rc.Common.DBUtility.DbHelperSQL.ExecuteSqlByTime("exec P_GenerateSyncFileToSchoolData '" + SysUser_ID + "' ", 3600); model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "1"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "执行已完成"; //记录同步完成后的信息 bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); } catch (Exception ex) { model_FileSyncExecRecord.FileSyncExecRecord_Status = "2"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "执行失败:" + ex.Message.ToString(); //记录同步完成后的信息 bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); } #endregion }
private void VerifyUrl() { string operateIP = Rc.Cloud.Web.Common.pfunction.GetRealIP(); string strFileSyncExecRecord_id = Guid.NewGuid().ToString(); #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 = operateIP + "正在检测..."; model_FileSyncExecRecord.FileSyncExecRecord_TimeStart = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Status = "0"; bll_FileSyncExecRecord.Add(model_FileSyncExecRecord); #endregion try { string basicUrl = "/AuthApi/Auto_SubmitStuAnswers.aspx?strFileSyncExecRecord_id=" + strFileSyncExecRecord_id; #region 检测 习题集服务器 string strTestWebSiteUrl = Rc.Common.ConfigHelper.GetConfigString("TestWebSiteUrl"); string getResult = Rc.Common.RemotWeb.PostDataToServer(strTestWebSiteUrl + basicUrl, "", System.Text.Encoding.UTF8, "GET"); #endregion #region 检测 学校服务器 List <Model_ConfigSchool> list = new List <Model_ConfigSchool>(); list = new BLL_ConfigSchool().GetModelList(""); foreach (var item in list) { if (!string.IsNullOrEmpty(item.D_PublicValue)) { getResult = Rc.Common.RemotWeb.PostDataToServer(item.D_PublicValue + basicUrl + "&SchoolId=" + item.School_ID, "", System.Text.Encoding.UTF8, "GET"); } } #endregion #region 记录同步结束信息并保存数据 model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Remark = operateIP + "检测成功完成"; 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 = operateIP + "检测失败:" + 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 = "同步教案"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "正在同步..."; 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_Remark = "同步成功完成"; 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 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 = "同步试卷"; 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; } }
private void VerifyUrl() { string strFileSyncExecRecord_id = Guid.NewGuid().ToString(); #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"; bll_FileSyncExecRecord.Add(model_FileSyncExecRecord); #endregion try { Model_SendMessageTemplate model = new BLL_SendMessageTemplate().GetModelBySType(Rc.Model.Resources.SMSPAYTemplateEnum.SMS.ToString()); #region 检测 主web服务器,教案服务器,习题集服务器 string strName = string.Empty; string strStudentAnswerWebSiteUrl = Rc.Common.ConfigHelper.GetConfigString("StudentAnswerWebSiteUrl"); string strTeachingPlanWebSiteUrl = Rc.Common.ConfigHelper.GetConfigString("TeachingPlanWebSiteUrl"); string strTestWebSiteUrl = Rc.Common.ConfigHelper.GetConfigString("TestWebSiteUrl"); if (hostPath != strStudentAnswerWebSiteUrl) { #region 检测 主web服务器 strName = "主web服务器"; string getResult = Rc.Common.RemotWeb.PostDataToServer(strStudentAnswerWebSiteUrl + "AuthApi/?key=onlinecheck", "", System.Text.Encoding.UTF8, "GET"); string schoolUrl = strStudentAnswerWebSiteUrl.Replace("http://", "").TrimEnd('/'); string strWhere = string.Empty; #region 给运营平台发送短信 if (string.IsNullOrEmpty(getResult)) // 无法访问 { strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' and datediff(MI,ctime,getdate())<180 order by CTime desc " , model.Mobile, strName); DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0]; if (dt.Rows.Count == 0 || (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() != "false")) { // 180分钟内未发送短信 或 最新短信不是无法访问 Dictionary <string, string> Para = new Dictionary <string, string>(); Para.Add("template_id", "10580"); Para.Add("template_para_schoolname", strName); Para.Add("template_para_schoolurl", schoolUrl); string msg = (strName + schoolUrl + "无法访问"); Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "false", ""); } } else { strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' order by CTime desc " , model.Mobile, strName); DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0]; if (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() == "false") { Dictionary <string, string> Para = new Dictionary <string, string>(); Para.Add("template_id", "10581"); Para.Add("template_para_schoolname", strName); Para.Add("template_para_schoolurl", schoolUrl); string msg = (strName + schoolUrl + "已恢复正常"); Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "true", ""); } } #endregion #endregion } if (strTeachingPlanWebSiteUrl != strStudentAnswerWebSiteUrl && strTeachingPlanWebSiteUrl != hostPath) { #region 检测 教案服务器 strName = "教案服务器"; string getResult = Rc.Common.RemotWeb.PostDataToServer(strTeachingPlanWebSiteUrl + "AuthApi/?key=onlinecheck", "", System.Text.Encoding.UTF8, "GET"); string schoolUrl = strTeachingPlanWebSiteUrl.Replace("http://", "").TrimEnd('/'); string strWhere = string.Empty; #region 给运营平台发送短信 if (string.IsNullOrEmpty(getResult)) // 无法访问 { strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' and datediff(MI,ctime,getdate())<180 order by CTime desc " , model.Mobile, strName); DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0]; if (dt.Rows.Count == 0 || (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() != "false")) { // 180分钟内未发送短信 或 最新短信不是无法访问 Dictionary <string, string> Para = new Dictionary <string, string>(); Para.Add("template_id", "10580"); Para.Add("template_para_schoolname", strName); Para.Add("template_para_schoolurl", schoolUrl); string msg = (strName + schoolUrl + "无法访问"); Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "false", ""); } } else { strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' order by CTime desc " , model.Mobile, strName); DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0]; if (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() == "false") { Dictionary <string, string> Para = new Dictionary <string, string>(); Para.Add("template_id", "10581"); Para.Add("template_para_schoolname", strName); Para.Add("template_para_schoolurl", schoolUrl); string msg = (strName + schoolUrl + "已恢复正常"); Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "true", ""); } } #endregion #endregion } if (strTestWebSiteUrl != strStudentAnswerWebSiteUrl && strTestWebSiteUrl != strTeachingPlanWebSiteUrl && strTestWebSiteUrl != hostPath) { #region 检测 习题集服务器 strName = "习题集服务器"; string getResult = Rc.Common.RemotWeb.PostDataToServer(strTeachingPlanWebSiteUrl + "AuthApi/?key=onlinecheck", "", System.Text.Encoding.UTF8, "GET"); string schoolUrl = strTeachingPlanWebSiteUrl.Replace("http://", "").TrimEnd('/'); string strWhere = string.Empty; #region 给运营平台发送短信 if (string.IsNullOrEmpty(getResult)) // 无法访问 { strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' and datediff(MI,ctime,getdate())<180 order by CTime desc " , model.Mobile, strName); DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0]; if (dt.Rows.Count == 0 || (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() != "false")) { // 180分钟内未发送短信 或 最新短信不是无法访问 Dictionary <string, string> Para = new Dictionary <string, string>(); Para.Add("template_id", "10580"); Para.Add("template_para_schoolname", strName); Para.Add("template_para_schoolurl", schoolUrl); string msg = (strName + schoolUrl + "无法访问"); Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "false", ""); } } else { strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' order by CTime desc " , model.Mobile, strName); DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0]; if (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() == "false") { Dictionary <string, string> Para = new Dictionary <string, string>(); Para.Add("template_id", "10581"); Para.Add("template_para_schoolname", strName); Para.Add("template_para_schoolurl", schoolUrl); string msg = (strName + schoolUrl + "已恢复正常"); Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "true", ""); } } #endregion #endregion } #endregion List <Model_ConfigSchool> list = new List <Model_ConfigSchool>(); list = new BLL_ConfigSchool().GetModelList(""); string Sql = string.Format(@" select cs.School_Id,cs.School_Name,ssp.PhoneNum from ConfigSchool cs inner join [dbo].[SchoolSMS_Person] ssp on ssp.School_Id=cs.School_Id "); DataTable dtPerson = Rc.Common.DBUtility.DbHelperSQL.Query(Sql).Tables[0]; foreach (var item in list) { if (!string.IsNullOrEmpty(model.Mobile) && !string.IsNullOrEmpty(item.D_PublicValue)) { string getResult = Rc.Common.RemotWeb.PostDataToServer(item.D_PublicValue + "AuthApi/?key=onlinecheck", "", System.Text.Encoding.UTF8, "GET"); string schoolUrl = item.D_PublicValue.Replace("http://", "").TrimEnd('/'); string strWhere = string.Empty; #region 给运营平台发送短信 if (string.IsNullOrEmpty(getResult)) // 无法访问 { strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' and datediff(MI,ctime,getdate())<180 order by CTime desc " , model.Mobile, item.School_Name); DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0]; if (dt.Rows.Count == 0 || (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() != "false")) { // 180分钟内未发送短信 或 最新短信不是无法访问 Dictionary <string, string> Para = new Dictionary <string, string>(); Para.Add("template_id", "10580"); Para.Add("template_para_schoolname", item.School_Name); Para.Add("template_para_schoolurl", schoolUrl); string msg = (item.School_Name + schoolUrl + "无法访问"); Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "false", item.School_ID); } } else { strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' order by CTime desc " , model.Mobile, item.School_Name); DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0]; if (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() == "false") { Dictionary <string, string> Para = new Dictionary <string, string>(); Para.Add("template_id", "10581"); Para.Add("template_para_schoolname", item.School_Name); Para.Add("template_para_schoolurl", schoolUrl); string msg = (item.School_Name + schoolUrl + "已恢复正常"); Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "true", item.School_ID); } } #endregion #region 给学校群发短信 if (dtPerson.Rows.Count > 0) { SendMsgSchoolPerson(dtPerson, item.School_ID, model.Mobile, item.D_PublicValue, getResult, schoolUrl); } #endregion } } #region 记录检测结束信息并保存数据 model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "检测成功完成"; 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 ResSynResourcePlan(string strFileSyncExecRecord_id, string strbookId, string strrtrfId) { //生产环境web站点存放文件的主目录 string strProductPublicUrl = ConfigurationManager.AppSettings["ProductPublicUrl"].ToString(); string strCondition = string.Empty; bool isCover = true;//是否覆盖 #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 = startTime; model_FileSyncExecRecord.FileSyncExecRecord_Status = "0"; model_FileSyncExecRecord.FileSyncExecRecord_Condition = strCondition; model_FileSyncExecRecord.createUser = SysUser_ID; #endregion try { if (bll_FileSyncExecRecord.GetRecordCount("FileSyncExecRecord_id='" + strFileSyncExecRecord_id + "'") > 0) { bll_FileSyncExecRecord.Update(model_FileSyncExecRecord); } else { bll_FileSyncExecRecord.Add(model_FileSyncExecRecord); } //教案文件,htm文件相关数据 DataTable dtFilePlan = GetDtFilePlan(strbookId, strrtrfId); //教案预览图片文件相关数据 DataTable dtFilePlanView = GetDtFilePlanView(strbookId, strrtrfId); DataView dataView = dtFilePlan.DefaultView; // 资源数据 DataTable dtRTRF = new DataTable(); if (dtFilePlan.Rows.Count > 0) { dtRTRF = dataView.ToTable(true, "ResourceToResourceFolder_Id"); } foreach (DataRow item in dtRTRF.Rows) { #region 教案件下载 //教案SW+thm DataRow[] drSWdsc = dtFilePlan.Select(string.Format("ResourceToResourceFolder_id='{0}' and Resource_Type='{1}'" , item["ResourceToResourceFolder_id"] , 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("ResourceToResourceFolder_id='{0}' and Resource_Type='{1}'" , item["ResourceToResourceFolder_id"] , 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("ResourceToResourceFolder_id='{0}' and Resource_Type='{1}'" , item["ResourceToResourceFolder_id"] , Resource_TypeConst.class类型微课件)); DownLoadFile(drMicroClass, "microClassDocument", "class", strProductPublicUrl, strFileSyncExecRecord_id, "微课class", isCover); DownLoadFile(drMicroClass, "microClassDocument", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "微课class", isCover); DataRow[] drSWdscView = dtFilePlanView.Select(string.Format("ResourceToResourceFolder_id='{0}' and Resource_Type='{1}'" , item["ResourceToResourceFolder_id"] , Resource_TypeConst.ScienceWord类型文件)); DownLoadFile(drSWdscView, "swView", "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "教案SW预览图片", isCover); //教案Class+预览图片 DataRow[] drClassView = dtFilePlanView.Select(string.Format("ResourceToResourceFolder_id='{0}' and Resource_Type='{1}'" , item["ResourceToResourceFolder_id"] , Resource_TypeConst.class类型文件)); DownLoadFile(drClassView, "classView", "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "教案Class预览图片", isCover); //微课Class+预览图片 DataRow[] drMicroClassView = dtFilePlanView.Select(string.Format("ResourceToResourceFolder_id='{0}' and Resource_Type='{1}'" , item["ResourceToResourceFolder_id"] , Resource_TypeConst.class类型微课件)); DownLoadFile(drMicroClassView, "microClassView", "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "微课Class预览图片", isCover); #endregion #region 成功 写入同步文件到学校记录表数据 string strSyncFileToSchool_Id = Guid.NewGuid().ToString(); string sql = string.Format(@" insert into SyncFileToSchool select '{0}','{1}','{2}','{3}','{4}',getdate() ; " , strSyncFileToSchool_Id , SchoolId , item["ResourceToResourceFolder_id"].ToString() , "" , SysUser_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 ResSynResourceTestPaper(string strFileSyncExecRecord_id, string strbookId, string strrtrfId) { //生产环境web站点存放文件的主目录 string strProductPublicUrl = ConfigurationManager.AppSettings["ProductPublicUrl"].ToString(); string strCondition = string.Empty; bool isCover = true;//是否覆盖 #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 = startTime; 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(strbookId, strrtrfId); //试题相关数据 DataTable dtFileTestPaperScore = GetDtFileTestPaperTestQuestions_Score(strbookId, strrtrfId); DataView dataView = dtFileTestPaper.DefaultView; // 资源数据 DataTable dtRTRF = new DataTable(); if (dtFileTestPaper.Rows.Count > 0) { dtRTRF = dataView.ToTable(true, "ResourceToResourceFolder_Id"); } foreach (DataRow item in dtRTRF.Rows) { #region 载文件 试卷类型 //试卷文件相关数据 DataRow[] dvFileTestPaper = dtFileTestPaper.Select("ResourceToResourceFolder_id='" + item["ResourceToResourceFolder_id"] + "' "); //题干 BASE64内容,存储目录:testQuestionBody/属性层次目录/试题标识.txt DownLoadFile(dvFileTestPaper, "testQuestionBody", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "题干txt", isCover); //题干 HTML内容,存储目录:testQuestionBody/属性层次目录/试题标识.htm DownLoadFile(dvFileTestPaper, "testQuestionBody", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "题干htm", isCover); //题的选项等 DataRow[] dvFileTestPaperScore = dtFileTestPaperScore.Select("ResourceToResourceFolder_id='" + item["ResourceToResourceFolder_id"] + "' "); // 选择题的选项(数组对象)存储目录: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 成功 写入同步文件到学校记录表数据 string strSyncFileToSchool_Id = Guid.NewGuid().ToString(); string sql = string.Format(@" insert into SyncFileToSchool select '{0}','{1}','{2}','{3}','{4}',getdate() ; " , strSyncFileToSchool_Id , SchoolId , item["ResourceToResourceFolder_id"].ToString() , "" , SysUser_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> /// 同步教案new /// </summary> public void ResSynchroTeachingPlan() { //生产环境web站点存放文件的主目录 string strProductPublicUrl = ConfigurationManager.AppSettings["ProductPublicUrl"].ToString(); string strFileSyncExecRecord_id = Guid.NewGuid().ToString(); bool isCover = true;//是否覆盖 string strCondition = string.Format("日期【】;是覆盖:【{0}】", isCover); string strbookId = hid_bookId.Value.Filter(); string strrtrfId = hid_rtrfId.Value.Filter(); if (!string.IsNullOrEmpty(strbookId)) { Model_ResourceFolder modelRF = new BLL_ResourceFolder().GetModel(strbookId); if (modelRF != null) { strCondition += string.Format(";书本【{0}】【{1}】", modelRF.ResourceFolder_Name, modelRF.ResourceFolder_Id); } } if (!string.IsNullOrEmpty(strrtrfId)) { Model_ResourceToResourceFolder modelRTRF = new BLL_ResourceToResourceFolder().GetModel(strrtrfId); if (modelRTRF != null) { strCondition += string.Format(";资源【{0}】【{1}】", modelRTRF.Resource_Name, modelRTRF.ResourceToResourceFolder_Id); } } #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 = "同步教案new"; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "正在同步..."; 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 { //教案文件,htm文件相关数据 DataTable dtFilePlan = GetDtFilePlan(strbookId, strrtrfId); //教案预览图片文件相关数据 DataTable dtFilePlanView = GetDtFilePlanView(strbookId, strrtrfId); DataView dataView = dtFilePlan.DefaultView; // 资源数据 DataTable dtRTRF = new DataTable(); if (dtFilePlan.Rows.Count > 0) { dtRTRF = dataView.ToTable(true, "Book_Id", "ResourceToResourceFolder_Id"); } foreach (DataRow item in dtRTRF.Rows) { #region 载文件 //教案SW+thm DataRow[] drSWdsc = dtFilePlan.Select(string.Format(" Resource_Type='{0}' and ResourceToResourceFolder_Id='{1}' " , Resource_TypeConst.ScienceWord类型文件, item["ResourceToResourceFolder_Id"])); 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}' and ResourceToResourceFolder_Id='{1}' " , Resource_TypeConst.class类型文件, item["ResourceToResourceFolder_Id"])); 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}' and ResourceToResourceFolder_Id='{1}' " , Resource_TypeConst.class类型微课件, item["ResourceToResourceFolder_Id"])); DownLoadFile(drMicroClass, "microClassDocument", "class", strProductPublicUrl, strFileSyncExecRecord_id, "微课class", isCover); DownLoadFile(drMicroClass, "microClassDocument", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "微课class", isCover); //教案SW+预览图片 DataRow[] drSWdscView = dtFilePlanView.Select(string.Format(" Resource_Type='{0}' and ResourceToResourceFolder_Id='{1}' " , Resource_TypeConst.ScienceWord类型文件, item["ResourceToResourceFolder_Id"])); DownLoadFile(drSWdscView, "swView", "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "教案SW预览图片", isCover); //教案Class+预览图片 DataRow[] drClassView = dtFilePlanView.Select(string.Format(" Resource_Type='{0}' and ResourceToResourceFolder_Id='{1}' " , Resource_TypeConst.class类型文件, item["ResourceToResourceFolder_Id"])); DownLoadFile(drClassView, "classView", "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "教案Class预览图片", isCover); //微课Class+预览图片 DataRow[] drMicroClassView = dtFilePlanView.Select(string.Format(" Resource_Type='{0}' and ResourceToResourceFolder_Id='{1}' " , Resource_TypeConst.class类型微课件, item["ResourceToResourceFolder_Id"])); DownLoadFile(drMicroClassView, "microClassView", "jpg", strProductPublicUrl, strFileSyncExecRecord_id, "微课Class预览图片", isCover); #endregion #region 更新SyncData string strSqlSyncData = string.Format(@"update SyncData set SyncStatus='3' where TableName='ResourceFolder' and SyncStatus<>'3' and DataId='{0}'; update SyncData set SyncStatus='3' where TableName='ResourceToResourceFolder' and SyncStatus<>'3' and DataId='{1}'; " , item["Book_Id"], item["ResourceToResourceFolder_Id"]); Rc.Common.DBUtility.DbHelperSQL.ExecuteSqlByTime(strSqlSyncData, 60); #endregion } #region 记录同步结束信息并保存数据 model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now; model_FileSyncExecRecord.FileSyncExecRecord_Remark = "同步成功完成"; 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 ResSynchroTeachingPlan() { //生产环境web站点存放文件的主目录 string strProductPublicUrl = ConfigurationManager.AppSettings["ProductPublicUrl"].ToString(); string strFileSyncExecRecord_id = Guid.NewGuid().ToString(); bool isCover = true;//是否覆盖 string strCondition = string.Format("日期【】;是覆盖:【{0}】", isCover); string strbookId = hid_bookId.Value.Filter(); string strrtrfId = hid_rtrfId.Value.Filter(); if (!string.IsNullOrEmpty(strbookId)) { Model_ResourceFolder modelRF = new BLL_ResourceFolder().GetModel(strbookId); if (modelRF != null) { strCondition += string.Format(";书本【{0}】【{1}】", modelRF.ResourceFolder_Name, modelRF.ResourceFolder_Id); } } if (!string.IsNullOrEmpty(strrtrfId)) { Model_ResourceToResourceFolder modelRTRF = new BLL_ResourceToResourceFolder().GetModel(strrtrfId); if (modelRTRF != null) { strCondition += string.Format(";资源【{0}】【{1}】", modelRTRF.Resource_Name, modelRTRF.ResourceToResourceFolder_Id); } } #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 = "同步试卷new"; 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; bll_FileSyncExecRecord.Add(model_FileSyncExecRecord); #endregion try { //试卷文件相关数据 DataTable dtFileTestPaper = GetDtFileTestPaperTestQuestion(strbookId, strrtrfId); //试题相关数据 DataTable dtFileTestPaperScore = GetDtFileTestPaperTestQuestions_Score(strbookId, strrtrfId); DataView dataView = dtFileTestPaper.DefaultView; // 资源数据 DataTable dtRTRF = new DataTable(); if (dtFileTestPaper.Rows.Count > 0) { dtRTRF = dataView.ToTable(true, "Book_Id", "ResourceToResourceFolder_Id"); } foreach (DataRow item in dtRTRF.Rows) { #region 载文件 DataRow[] dvFileTestPaper = dtFileTestPaper.Select(string.Format(" ResourceToResourceFolder_Id='{0}' ", item["ResourceToResourceFolder_Id"])); //题干 BASE64内容,存储目录:testQuestionBody/属性层次目录/试题标识.txt DownLoadFile(dvFileTestPaper, "testQuestionBody", "txt", strProductPublicUrl, strFileSyncExecRecord_id, "题干txt", isCover); //题干 HTML内容,存储目录:testQuestionBody/属性层次目录/试题标识.htm DownLoadFile(dvFileTestPaper, "testQuestionBody", "htm", strProductPublicUrl, strFileSyncExecRecord_id, "题干htm", isCover); DataRow[] dvFileTestPaperScore = dtFileTestPaperScore.Select(string.Format(" ResourceToResourceFolder_Id='{0}' ", item["ResourceToResourceFolder_Id"])); // 选择题的选项(数组对象)存储目录: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 更新SyncData string strSqlSyncData = string.Format(@"update SyncData set SyncStatus='3' where TableName='ResourceFolder' and SyncStatus<>'3' and DataId='{0}'; update SyncData set SyncStatus='3' where TableName='ResourceToResourceFolder' and SyncStatus<>'3' and DataId='{1}'; " , item["Book_Id"], item["ResourceToResourceFolder_Id"]); Rc.Common.DBUtility.DbHelperSQL.ExecuteSqlByTime(strSqlSyncData, 60); #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; } }