Пример #1
0
        protected void btnOn_Click(object sender, EventArgs e)
        {
            try
            {
                BLL_FileSyncRecordFail fsrfbll = new BLL_FileSyncRecordFail();
                fsrfbll.DeleteClass(" Resource_Type='df94a052-8cdb-4e49-ae1d-635fe129c89a'");
                List <Rc.Model.Resources.Model_ResourceToResourceFolder> rtrflist = new List <Model_ResourceToResourceFolder>();
                string StrWhere   = string.Empty;
                string StartTime  = txtStartTime.Text;
                string EndTime    = txtEndTiem.Text;
                string uploadPath = "\\Upload\\Resource\\";
                string filePath   = string.Empty;
                string imgPath    = string.Empty;
                string savePath   = string.Empty;
                string StrText    = string.Empty;
                StrWhere = " Resource_Class='" + Resource_ClassConst.云资源 + "'  ";
                if (!string.IsNullOrEmpty(StartTime))
                {
                    StrWhere += " and  CreateTime >= '" + StartTime.Filter() + "'";
                }
                if (!string.IsNullOrEmpty(EndTime))
                {
                    StrWhere += " and CreateTime <= '" + EndTime.Filter() + "'";
                }
                if (!string.IsNullOrEmpty(hidtxtBook.Value))
                {
                    StrWhere += " and Book_ID='" + hidtxtBook.Value + "'";
                }
                StrWhere += " and Resource_Type='df94a052-8cdb-4e49-ae1d-635fe129c89a'";

                BLL_ResourceToResourceFolder rtrfbll = new BLL_ResourceToResourceFolder();
                rtrflist = rtrfbll.GetModelList(StrWhere);

                if (rtrflist != null)
                {
                    string SqlTemp = "delete from FileSyncRecordFail where Resource_Type='df94a052-8cdb-4e49-ae1d-635fe129c89a'";
                    Rc.Common.DBUtility.DbHelperSQL.ExecuteSql(SqlTemp);
                    foreach (var item in rtrflist)
                    {
                        savePath = string.Format("{0}\\{1}\\{2}\\{3}\\", item.ParticularYear, item.GradeTerm,
                                                 item.Resource_Version, item.Subject);
                        #region 试卷

                        BLL_TestQuestions          tqbll  = new BLL_TestQuestions();
                        List <Model_TestQuestions> tqlist = new List <Model_TestQuestions>();
                        tqlist = tqbll.GetModelList("ResourceToResourceFolder_Id='" + item.ResourceToResourceFolder_Id + "'");
                        if (tqlist != null)
                        {
                            foreach (var tqitem in tqlist)
                            {
                                #region 题干testQuestionBody
                                if (!File.Exists(Server.MapPath(uploadPath + "testQuestionBody\\" + savePath + tqitem.TestQuestions_Id + ".htm")))
                                {
                                    InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "testQuestionBody\\" + savePath + tqitem.TestQuestions_Id + ".htm"), item.Resource_Type, "题干htm");
                                }
                                if (!File.Exists(Server.MapPath(uploadPath + "testQuestionBody\\" + savePath + tqitem.TestQuestions_Id + ".txt")))
                                {
                                    InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "testQuestionBody\\" + savePath + tqitem.TestQuestions_Id + ".txt"), item.Resource_Type, "题干txt");
                                }
                                #endregion

                                #region 分值表
                                BLL_TestQuestions_Score tqsbll = new BLL_TestQuestions_Score();
                                DataTable tqsdt = tqsbll.GetList("TestQuestions_Id='" + tqitem.TestQuestions_Id + "'").Tables[0];
                                if (tqsdt.Rows.Count > 0)
                                {
                                    for (int k = 0; k < tqsdt.Rows.Count; k++)
                                    {
                                        #region  项testQuestionOption
                                        if ((tqsdt.Rows[k]["TestType"].ToString() == "selection" || tqsdt.Rows[k]["TestType"].ToString() == "clozeTest") && !File.Exists(Server.MapPath(uploadPath + "testQuestionOption\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt")))
                                        {
                                            InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "testQuestionOption\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"), item.Resource_Type, "选项txt");
                                        }
                                        #endregion
                                        #region 答案testQuestionCurrent
                                        if ((tqsdt.Rows[k]["TestType"].ToString() == "fill" || tqsdt.Rows[k]["TestType"].ToString() == "answers") && !File.Exists(Server.MapPath(uploadPath + "testQuestionCurrent\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt")))
                                        {
                                            InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "testQuestionCurrent\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"), item.Resource_Type, "答案txt");
                                        }
                                        #endregion
                                        #region 解析AnalyzeData/AnalyzeHtml
                                        if (!string.IsNullOrEmpty(tqsdt.Rows[k]["AnalyzeHyperlinkData"].ToString()) && !File.Exists(Server.MapPath(uploadPath + "AnalyzeData\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt")))
                                        {
                                            InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "AnalyzeData\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"), item.Resource_Type, "解析txt");
                                        }
                                        if (!string.IsNullOrEmpty(tqsdt.Rows[k]["AnalyzeHyperlinkData"].ToString()) && !File.Exists(Server.MapPath(uploadPath + "AnalyzeHtml\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".htm")))
                                        {
                                            InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "AnalyzeHtml\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".htm"), item.Resource_Type, "解析htm");
                                        }
                                        #endregion
                                        #region 强化训练TrainData/TrainHtml
                                        if (!string.IsNullOrEmpty(tqsdt.Rows[k]["TrainHyperlinkData"].ToString()) && !File.Exists(Server.MapPath(uploadPath + "TrainData\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt")))
                                        {
                                            InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "TrainData\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"), item.Resource_Type, "强化训练txt");
                                        }
                                        if (!string.IsNullOrEmpty(tqsdt.Rows[k]["TrainHyperlinkData"].ToString()) && !File.Exists(Server.MapPath(uploadPath + "TrainHtml\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".htm")))
                                        {
                                            InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "TrainHtml\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".htm"), item.Resource_Type, "强化训练htm");
                                        }
                                        #endregion
                                    }
                                }
                                #endregion
                            }
                        }
                    }
                    #endregion
                }

                Response.Redirect(Request.Url.ToString());
            }
            catch (Exception ex)
            {
                new BLL_clsAuth().AddLogErrorFromBS("检测同步完成情况失败:", string.Format("类:{0},方法{1},错误信息:{2}", ex.TargetSite.DeclaringType.ToString()
                                                                                 , ex.TargetSite.Name.ToString(), ex.Message));
                Response.Redirect(Request.Url.ToString());
            }
        }
Пример #2
0
        protected void btnOn_Click(object sender, EventArgs e)
        {
            try
            {
                //删除
                BLL_FileSyncRecordFail fsrfbll = new BLL_FileSyncRecordFail();
                fsrfbll.DeleteClass(" Resource_Type in ('b8ea8767-4ae6-4b90-883f-93415a14e461','f1d1db22-c427-47e6-a8af-13d516d90633','e3a3e85e-2903-4ae6-ba17-f7f2ad9d7e0d')");
                List <Rc.Model.Resources.Model_ResourceToResourceFolder> rtrflist = new List <Model_ResourceToResourceFolder>();
                string StrWhere   = string.Empty;
                string StartTime  = txtStartTime.Text;
                string EndTime    = txtEndTiem.Text;
                string uploadPath = "\\Upload\\Resource\\";
                string filePath   = string.Empty;
                string imgPath    = string.Empty;
                string savePath   = string.Empty;
                string StrText    = string.Empty;
                StrWhere = " Resource_Class='" + Resource_ClassConst.云资源 + "'  ";
                if (!string.IsNullOrEmpty(StartTime))
                {
                    StrWhere += " and  CreateTime >= '" + StartTime.Filter() + "'";
                }
                if (!string.IsNullOrEmpty(EndTime))
                {
                    StrWhere += " and CreateTime <= '" + EndTime.Filter() + "'";
                }
                if (!string.IsNullOrEmpty(hidtxtBook.Value))
                {
                    StrWhere += " and Book_ID='" + hidtxtBook.Value + "'";
                }
                StrWhere += " and (Resource_Type in ('b8ea8767-4ae6-4b90-883f-93415a14e461','f1d1db22-c427-47e6-a8af-13d516d90633','e3a3e85e-2903-4ae6-ba17-f7f2ad9d7e0d'))";

                BLL_ResourceToResourceFolder rtrfbll = new BLL_ResourceToResourceFolder();
                rtrflist = rtrfbll.GetModelList(StrWhere);

                if (rtrflist != null)
                {
                    string SqlTemp = "delete from FileSyncRecordFail where Resource_Type in ('b8ea8767-4ae6-4b90-883f-93415a14e461','f1d1db22-c427-47e6-a8af-13d516d90633','e3a3e85e-2903-4ae6-ba17-f7f2ad9d7e0d')";
                    Rc.Common.DBUtility.DbHelperSQL.ExecuteSql(SqlTemp);
                    foreach (var item in rtrflist)
                    {
                        savePath = string.Format("{0}\\{1}\\{2}\\{3}\\", item.ParticularYear, item.GradeTerm,
                                                 item.Resource_Version, item.Subject);

                        #region 教案
                        if ("1" == "1")
                        {
                            switch (item.Resource_Type)
                            {
                            case Resource_TypeConst.ScienceWord类型文件:
                                filePath = "swDocument\\";
                                imgPath  = "swView\\";
                                StrText  = "ScienceWord类型文件";
                                break;

                            case Resource_TypeConst.class类型微课件:
                                filePath = "microClassDocument\\";
                                imgPath  = "microClassView\\";
                                StrText  = "class类型微课件";
                                break;

                            case Resource_TypeConst.class类型文件:
                                filePath = "classDocument\\";
                                imgPath  = "classView\\";
                                StrText  = "class类型文件";
                                break;
                            }
                            #region 判断源文件 和html文件
                            if (!File.Exists(Server.MapPath(uploadPath + filePath + savePath + item.ResourceToResourceFolder_Id + "." + item.File_Suffix)))
                            {
                                InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + filePath + savePath + item.ResourceToResourceFolder_Id + "." + item.File_Suffix), item.Resource_Type, StrText);
                            }
                            if (!File.Exists(Server.MapPath(uploadPath + filePath + savePath + item.ResourceToResourceFolder_Id + ".htm")))
                            {
                                InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + filePath + savePath + item.ResourceToResourceFolder_Id + ".htm"), item.Resource_Type, StrText);
                            }
                            #endregion
                            #region 判断图片
                            BLL_ResourceToResourceFolder_img rtrfimgbll = new BLL_ResourceToResourceFolder_img();
                            DataTable dt = rtrfimgbll.GetList(" ResourceToResourceFolder_id='" + item.ResourceToResourceFolder_Id + "'").Tables[0];
                            if (dt.Rows.Count > 0)
                            {
                                for (int i = 0; i < dt.Rows.Count; i++)
                                {
                                    if (!File.Exists(Server.MapPath(uploadPath + imgPath + savePath + dt.Rows[i]["ResourceToResourceFolder_img_id"] + ".jpg")))
                                    {
                                        InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + imgPath + savePath + dt.Rows[i]["ResourceToResourceFolder_img_id"] + ".jpg"), item.Resource_Type, StrText + "jpg");
                                    }
                                }
                            }
                            #endregion
                        }
                        #endregion
                        #region 试卷
                        else
                        {
                            BLL_TestQuestions          tqbll  = new BLL_TestQuestions();
                            List <Model_TestQuestions> tqlist = new List <Model_TestQuestions>();
                            tqlist = tqbll.GetModelList("ResourceToResourceFolder_Id='" + item.ResourceToResourceFolder_Id + "'");
                            if (tqlist != null)
                            {
                                foreach (var tqitem in tqlist)
                                {
                                    #region 题干testQuestionBody
                                    if (!File.Exists(Server.MapPath(uploadPath + "testQuestionBody\\" + savePath + tqitem.TestQuestions_Id + ".htm")))
                                    {
                                        InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "testQuestionBody\\" + savePath + tqitem.TestQuestions_Id + ".htm"), item.Resource_Type, "题干htm");
                                    }
                                    if (!File.Exists(Server.MapPath(uploadPath + "testQuestionBody\\" + savePath + tqitem.TestQuestions_Id + ".txt")))
                                    {
                                        InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "testQuestionBody\\" + savePath + tqitem.TestQuestions_Id + ".txt"), item.Resource_Type, "题干txt");
                                    }
                                    #endregion

                                    #region 分值表
                                    BLL_TestQuestions_Score tqsbll = new BLL_TestQuestions_Score();
                                    DataTable tqsdt = tqsbll.GetList("TestQuestions_Id='" + tqitem.TestQuestions_Id + "'").Tables[0];
                                    if (tqsdt.Rows.Count > 0)
                                    {
                                        for (int k = 0; k < tqsdt.Rows.Count; k++)
                                        {
                                            #region  项testQuestionOption
                                            if (!File.Exists(Server.MapPath(uploadPath + "testQuestionOption\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt")))
                                            {
                                                InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "testQuestionOption\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"), item.Resource_Type, "选项txt");
                                            }
                                            #endregion
                                            #region 答案testQuestionCurrent
                                            if (!File.Exists(Server.MapPath(uploadPath + "testQuestionCurrent\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt")))
                                            {
                                                InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "testQuestionCurrent\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"), item.Resource_Type, "答案txt");
                                            }
                                            #endregion
                                            #region 解析AnalyzeData/AnalyzeHtml
                                            if (!File.Exists(Server.MapPath(uploadPath + "AnalyzeData\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt")))
                                            {
                                                InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "AnalyzeData\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"), item.Resource_Type, "解析txt");
                                            }
                                            if (!File.Exists(Server.MapPath(uploadPath + "AnalyzeHtml\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".htm")))
                                            {
                                                InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "AnalyzeHtml\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".htm"), item.Resource_Type, "解析htm");
                                            }
                                            #endregion
                                            #region 强化训练TrainData/TrainHtml
                                            if (!File.Exists(Server.MapPath(uploadPath + "TrainData\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt")))
                                            {
                                                InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "TrainData\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".txt"), item.Resource_Type, "强化训练txt");
                                            }
                                            if (!File.Exists(Server.MapPath(uploadPath + "TrainHtml\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".htm")))
                                            {
                                                InsertFail(item.ResourceToResourceFolder_Id, item.Book_ID, (uploadPath + "TrainHtml\\" + savePath + tqsdt.Rows[k]["TestQuestions_Score_ID"] + ".htm"), item.Resource_Type, "强化训练htm");
                                            }
                                            #endregion
                                        }
                                    }
                                    #endregion
                                }
                            }
                        }
                        #endregion
                    }
                }
                Response.Redirect(Request.Url.ToString());
            }
            catch (Exception ex)
            {
                new BLL_clsAuth().AddLogErrorFromBS("检测同步完成情况失败:", string.Format("类:{0},方法{1},错误信息:{2}", ex.TargetSite.DeclaringType.ToString()
                                                                                 , ex.TargetSite.Name.ToString(), ex.Message));
                Response.Redirect(Request.Url.ToString());
            }
        }