コード例 #1
0
ファイル: SyncData.aspx.cs プロジェクト: a157591984/jiguang
        private void SynchronousDataReExec()
        {
            string strFileSyncExecRecord_id = hidId.Value;

            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 = bll_FileSyncExecRecord.GetModel(strFileSyncExecRecord_id);
            model_FileSyncExecRecord.FileSyncExecRecord_id        = strFileSyncExecRecord_id;
            model_FileSyncExecRecord.FileSyncExecRecord_Type      = "自动同步数据";
            model_FileSyncExecRecord.FileSyncExecRecord_TimeStart = DateTime.Now;
            model_FileSyncExecRecord.FileSyncExecRecord_Remark    = "同步进行中...";
            model_FileSyncExecRecord.FileSyncExecRecord_Status    = "0";
            model_FileSyncExecRecord.createUser = "";
            try
            {
                //记录同步之前的信息
                bll_FileSyncExecRecord.Update(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);
                //Rc.Model.Resources.Model_SystemLogFileSync model = new Rc.Model.Resources.Model_SystemLogFileSync();
                //Rc.BLL.Resources.BLL_SystemLogFileSync bll = new Rc.BLL.Resources.BLL_SystemLogFileSync();
                //model.SystemLogFileSyncID = Guid.NewGuid().ToString();
                ////model.FileSize = ls;
                //// model.SyncUrl = strFilePath;
                //model.MsgType = "SynDataError";
                //model.ErrorMark = ex.Message.ToString();
                //model.CreateTime = DateTime.Now;
                //bll.Add(model);
            }
        }
コード例 #2
0
        private void SynchronousDataReExec()
        {
            //生产环境web站点存放文件的主目录
            string strProductPublicUrl      = ConfigurationManager.AppSettings["ProductPublicUrl"].ToString();
            string strFileSyncExecRecord_id = hidId.Value;

            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 = bll_FileSyncExecRecord.GetModel(strFileSyncExecRecord_id);
            bool   isCover      = false;
            string strCondition = model_FileSyncExecRecord.FileSyncExecRecord_Condition;

            txtSDate.Value   = strCondition.Substring(strCondition.IndexOf("【") + 1, strCondition.IndexOf("】") - strCondition.IndexOf("【") - 1);
            strCondition     = strCondition.Substring(strCondition.IndexOf("】") + 1);
            txtBOOK.Value    = strCondition.Substring(strCondition.IndexOf("【") + 1, strCondition.IndexOf("】") - strCondition.IndexOf("【") - 1);
            strCondition     = strCondition.Substring(strCondition.IndexOf("】") + 1);
            hidtxtBOOK.Value = strCondition.Substring(strCondition.IndexOf("【") + 1, strCondition.IndexOf("】") - strCondition.IndexOf("【") - 1);
            strCondition     = strCondition.Substring(strCondition.IndexOf("】") + 1);
            string strCover = strCondition.Substring(strCondition.IndexOf("【") + 1, strCondition.IndexOf("】") - strCondition.IndexOf("【") - 1);

            bool.TryParse(strCover, out isCover);
            chbCover.Checked = isCover;

            strCondition = string.Format("日期【{0}】;书本【{1}】【{2}】;是覆盖:【{3}】", txtSDate.Value, txtBOOK.Value, hidtxtBOOK.Value, chbCover.Checked);
            #region 记录同步开始信息
            model_FileSyncExecRecord.FileSyncExecRecord_id        = strFileSyncExecRecord_id;
            model_FileSyncExecRecord.FileSyncExecRecord_Type      = "同步教案";
            model_FileSyncExecRecord.FileSyncExecRecord_Remark    = "正在同步...";
            model_FileSyncExecRecord.FileSyncExecRecord_TimeStart = DateTime.Now;
            model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd   = null;
            model_FileSyncExecRecord.FileSyncExecRecord_Status    = "0";
            model_FileSyncExecRecord.createUser = SysUser_ID;
            model_FileSyncExecRecord.FileSyncExecRecord_Condition = strCondition;

            #endregion
            try
            {
                Rc.Common.DBUtility.DbHelperSQL.ExecuteSql("delete from FileSyncExecRecordDetail where FileSyncExecRecord_id='" + hidId.Value + "' ");
                bll_FileSyncExecRecord.Update(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);
            }
        }
コード例 #3
0
        public void SynchronousDataReExec()
        {
            //生产环境web站点存放文件的主目录
            string strProductPublicUrl      = ConfigurationManager.AppSettings["ProductPublicUrl"].ToString();
            string strFileSyncExecRecord_id = hidId.Value;

            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 = bll_FileSyncExecRecord.GetModel(strFileSyncExecRecord_id);
            bool   isCover      = false;
            string strCondition = model_FileSyncExecRecord.FileSyncExecRecord_Condition;

            txtSDate.Value   = strCondition.Substring(strCondition.IndexOf("【") + 1, strCondition.IndexOf("】") - strCondition.IndexOf("【") - 1);
            strCondition     = strCondition.Substring(strCondition.IndexOf("】") + 1);
            txtBOOK.Value    = strCondition.Substring(strCondition.IndexOf("【") + 1, strCondition.IndexOf("】") - strCondition.IndexOf("【") - 1);
            strCondition     = strCondition.Substring(strCondition.IndexOf("】") + 1);
            hidtxtBOOK.Value = strCondition.Substring(strCondition.IndexOf("【") + 1, strCondition.IndexOf("】") - strCondition.IndexOf("【") - 1);
            strCondition     = strCondition.Substring(strCondition.IndexOf("】") + 1);
            string strCover = strCondition.Substring(strCondition.IndexOf("【") + 1, strCondition.IndexOf("】") - strCondition.IndexOf("【") - 1);

            bool.TryParse(strCover, out isCover);
            chbCover.Checked = isCover;

            strCondition = string.Format("日期【{0}】;书本【{1}】【{2}】;是覆盖:【{3}】", txtSDate.Value, txtBOOK.Value, hidtxtBOOK.Value, chbCover.Checked);
            #region 记录同步开始信息

            model_FileSyncExecRecord.FileSyncExecRecord_id        = strFileSyncExecRecord_id;
            model_FileSyncExecRecord.FileSyncExecRecord_Type      = "同步试卷";
            model_FileSyncExecRecord.FileSyncExecRecord_Remark    = "同步进行中...";
            model_FileSyncExecRecord.FileSyncExecRecord_TimeStart = DateTime.Now;
            model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd   = null;
            model_FileSyncExecRecord.FileSyncExecRecord_Status    = "0";
            model_FileSyncExecRecord.FileSyncExecRecord_Condition = strCondition;
            model_FileSyncExecRecord.createUser = SysUser_ID;

            #endregion
            try
            {
                Rc.Common.DBUtility.DbHelperSQL.ExecuteSql("delete from FileSyncExecRecordDetail where FileSyncExecRecord_id='" + hidId.Value + "' ");
                bll_FileSyncExecRecord.Update(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);
            }
        }