Exemplo n.º 1
0
        /// <summary>
        /// 采用循环
        /// </summary>
        /// <param name="db"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GetcataidListbyXH(ModMetaEntities db, int id)
        {
            sbcata.Append(id);
            List <tb_Code_Knowledge> CataAllids = CacheHelper.Get("CataIds") as List <tb_Code_Knowledge>;

            int[] Secondcatas = CataAllids.Where(w => w.ParentID == id).Select(s => s.ID).ToArray();
            foreach (int scata in Secondcatas)
            {
                if (sbcata != null)
                {
                    sbcata.Append(",");
                }
                sbcata.Append(scata);
                int[] lcatas = CataAllids.Where(w => w.ParentID == scata).Select(s => s.ID).ToArray();
                foreach (int lcata in lcatas)
                {
                    if (sbcata != null)
                    {
                        sbcata.Append(",");
                    }
                    sbcata.Append(lcata);
                }
            }
            return(sbcata.ToString());
        }
Exemplo n.º 2
0
 public MicroCourseModel GetMicroCourseInfo(int subjectId, int stageId)
 {
     using (var metadb = new ModMetaEntities()) {
         MicroCourseModel   micrcomodel = new MicroCourseModel();
         tb_Code_ListTable2 subject     = metadb.tb_Code_ListTable2.Where(w => w.ID == subjectId && w.Deleted == 0).FirstOrDefault();
         micrcomodel.subjectID     = subject.ID;
         micrcomodel.subjectName   = subject.CodeName;
         micrcomodel.knowledgeList = new List <KnowledgeModel>();
         List <tb_Code_Knowledge> knowlist = metadb.tb_Code_Knowledge.Where(w => w.SubjectID == subjectId && w.StageID == stageId && w.Deleted == 0 && w.ParentID == 0).OrderBy(o => o.Seq).ToList();
         foreach (tb_Code_Knowledge konwledge in knowlist)
         {
             KnowledgeModel knowledgemodel = new KnowledgeModel();
             knowledgemodel.ID       = konwledge.ID;
             knowledgemodel.stage    = konwledge.StageID;
             knowledgemodel.subject  = konwledge.SubjectID;
             knowledgemodel.CodeName = konwledge.CodeName;
             knowledgemodel.Children = GetKnowlegeList(metadb, knowledgemodel.ID);
             micrcomodel.knowledgeList.Add(knowledgemodel);
         }
         if (CacheHelper.Get("CataIds") == null)
         {
             List <tb_Code_Knowledge> listcatas = metadb.tb_Code_Knowledge.Where(w => w.Deleted == 0 && w.SubjectID == subjectId && w.StageID == stageId).OrderBy(o => o.Seq).ToList();
             CacheHelper.Insert("CataIds", listcatas);
         }
         return(micrcomodel);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 获取学段
 /// </summary>
 /// <returns></returns>
 public static List <StageModel> GetStage()
 {
     using (var db = new ModMetaEntities())
     {
         using (var dbres = new MODResourceEntities())
         {
             int[]             stage     = dbres.tb_Course.Select(s => s.SchoolStage != null?(int)s.SchoolStage:2).Distinct().ToArray();
             List <StageModel> stageList = db.tb_Code_SchoolStage.Where(w => w.Deleted == 0 && stage.Contains(w.ID)).Select(s => new StageModel
             {
                 stageID   = s.ID,
                 stageName = s.CodeName,
                 IsCurrent = false
             }).ToList();
             if (string.IsNullOrEmpty(CookieHelper.GetCookieValue("StageID")))
             {
                 CookieHelper.SetCookie("StageID", "2");
             }
             int stageID = int.Parse(CookieHelper.GetCookieValue("StageID"));
             foreach (StageModel smodel in stageList)
             {
                 if (smodel.stageID == stageID)
                 {
                     smodel.IsCurrent = true;
                 }
             }
             return(stageList);
         }
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 获取目录的子集目录
        /// </summary>
        /// <param name="cataID"></param>
        /// <returns></returns>
        public static string GetChildCataByCataID(int bookID, int cataID)
        {
            string cataIDs = cataID.ToString();

            using (var db = new ModMetaEntities())
            {
                List <tb_StandardCatalog> list     = new List <tb_StandardCatalog>();
                List <StandBookCata>      treeList = new List <StandBookCata>();
                list = db.tb_StandardCatalog.Where(m => m.BookID == bookID && m.Deleted == 0).ToList();
                foreach (var item in list)
                {
                    if (item.ParentID == cataID)
                    {
                        StandBookCata model = new StandBookCata();
                        model.ID        = item.ID;
                        model.BookID    = item.BookID;
                        model.CataName  = item.FolderName;
                        model.ParentID  = item.ParentID;
                        model.PageStart = item.PageStart;
                        model.PageStart = item.PageStart;
                        treeList.Add(model);
                        ///递归获取目录子集列表///
                        LoopToAppendChildrenForCata(list, model);
                    }
                }
                if (treeList.Count != 0)
                {
                    cataIDs += GetCataID(treeList);
                }
            }
            return(cataIDs);
        }
Exemplo n.º 5
0
 /// <summary>
 /// 获取教材通过版本
 /// </summary>
 /// <param name="ediID"></param>
 /// <param name="subjectId"></param>
 /// <param name="stageId"></param>
 /// <returns></returns>
 public List <CourseModel> GetBookListByEditionID(int ediID, int subjectId, int stageId)
 {
     using (var db = new ModMetaEntities())
     {
         using (var dbres = new MODResourceEntities())
         {
             List <CourseModel>     courseModelList = new List <CourseModel>();
             IQueryable <tb_Course> tempCourse      = dbres.tb_Course.Where(w => w.Subject == subjectId.ToString() && w.SchoolStage == stageId);
             courseModelList = tempCourse.Where(w => w.EditionID == ediID && w.Coursetype != "movie").OrderBy(o => o.CoursePath).Select(s => new CourseModel
             {
                 CourseName = s.CourseName,
                 EditionID  = s.EditionID,
                 GradeID    = s.Grade,
                 ID         = s.ID,
                 ImageUrl   = AppSetting.ReslibUrl + "/DigitalClass/" + s.CoursePath + "/Course.gif",
                 IsOwnApply = ((s.Coursetype != "course") ? false : true)
             }).ToList();
             foreach (CourseModel course in courseModelList)
             {
                 if (!course.IsOwnApply)
                 {
                     tb_Course       tempcourse = dbres.tb_Course.Find(course.ID);
                     int             grade      = int.Parse(tempcourse.Grade);
                     int             subject    = int.Parse(tempcourse.Subject);
                     tb_StandardBook book       = db.tb_StandardBook.Where(w => w.Edition == course.EditionID && w.Subject == subject && w.Grade == grade && w.Booklet == tempcourse.BookReel).FirstOrDefault();
                     course.ID = book.ID;
                 }
             }
             return(courseModelList);
         }
     }
 }
Exemplo n.º 6
0
 public string GetKnowledgeIDs(int id)
 {
     using (var metadb = new ModMetaEntities())
     {
         string tempcataids = id.ToString();
         tempcataids += ",";
         tempcataids += GetcataidListbyXH(metadb, id);
         return(tempcataids);
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// 云课堂电影课
 /// </summary>
 /// <param name="subjectID"></param>
 /// <param name="stageID"></param>
 /// <returns></returns>
 public ApplyModel GetCourseAndMovice(string subjectID, int stageID)
 {
     using (var db = new ModMetaEntities())
     {
         using (var dbres = new MODResourceEntities())
         {
             ApplyModel appModel = new ApplyModel();
             appModel.CourseAllList = new CourseAllModel();
             // string[] grades = db.tb_Code_ListTable1_Relationship.Where(w => w.End_ID == stageID).Select(s => s.Start_ID.ToString()).ToArray();
             IQueryable <tb_Course> tempCourse = dbres.tb_Course.Where(w => w.Subject == subjectID && w.SchoolStage == stageID);
             int[] edi = tempCourse.Where(w => w.Coursetype != "movie").Select(s => s.EditionID).Distinct().ToArray();
             appModel.CourseAllList.EditionList = db.tb_Code_ListTable3.Where(w => edi.Contains(w.ID)).OrderBy(o => o.Seq).Select(s => new Edition
             {
                 EditionID   = s.ID,
                 EditionName = s.CodeName
             }).ToList();
             if (appModel.CourseAllList.EditionList != null && appModel.CourseAllList.EditionList.Count > 0)
             {
                 int ediID = appModel.CourseAllList.EditionList[0].EditionID;
                 appModel.CourseAllList.CourseList = tempCourse.Where(w => w.EditionID == ediID && w.Coursetype != "movie").OrderBy(o => o.CoursePath).Select(s => new CourseModel
                 {
                     CourseName = s.CourseName,
                     EditionID  = s.EditionID,
                     GradeID    = s.Grade,
                     ID         = s.ID,
                     ImageUrl   = AppSetting.ReslibUrl + "/DigitalClass/" + s.CoursePath + "/Course.gif",
                     IsOwnApply = ((s.Coursetype != "course") ?false:true)
                 }).ToList();
                 foreach (CourseModel course in appModel.CourseAllList.CourseList)
                 {
                     if (!course.IsOwnApply)
                     {
                         tb_Course       tempcourse = dbres.tb_Course.Find(course.ID);
                         int             grade      = int.Parse(tempcourse.Grade);
                         int             subject    = int.Parse(tempcourse.Subject);
                         tb_StandardBook book       = db.tb_StandardBook.Where(w => w.Edition == course.EditionID && w.Subject == subject && w.Grade == grade && w.Booklet == tempcourse.BookReel && w.Deleted == 0).FirstOrDefault();
                         course.ID = book.ID;
                     }
                 }
             }
             appModel.MoviceList = tempCourse.Where(w => w.Coursetype == "movie").OrderBy(o => o.Grade).Select(s => new MovieModel
             {
                 MoviceName = s.CourseName,
                 ID         = s.ID,
                 Url        = AppSetting.ReslibUrl + "/MovieListen/" + s.CoursePath + "/Start.htm",
                 ImageUrl   = AppSetting.ReslibUrl + "/MovieListen/" + s.CoursePath + "/Course.gif",
                 SubjectID  = s.Subject
             }).ToList();
             CacheHelper.Remove("CataIds");
             return(appModel);
         }
     }
 }
Exemplo n.º 8
0
 private void comboSubject_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     using (var db = new ModMetaEntities())
     {
         int[] edis = db.tb_Code_ListTable3_Relationship.Where(w => w.End_ID == (int)comboSubject.SelectedValue).Select(s => s.Start_ID).ToArray();
         List <tb_Code_ListTable3> editionList = db.tb_Code_ListTable3.Where(w => w.Deleted == 0 && edis.Contains(w.ID)).OrderBy(o => o.Seq).ToList();
         comboEdition.ItemsSource       = editionList;
         comboEdition.SelectedValuePath = "ID";
         comboEdition.DisplayMemberPath = "CodeName";
     }
     TotalResource();
 }
Exemplo n.º 9
0
 /// <summary>
 /// 采用递归
 /// </summary>
 /// <param name="db"></param>
 /// <param name="id"></param>
 /// <returns></returns>
 public string GetcataidListbyDG(ModMetaEntities db, int id)
 {
     int[] catas = db.tb_Code_Knowledge.Where(w => w.Deleted == 0 && w.ParentID == id).Select(s => s.ID).ToArray();
     foreach (int cata in catas)
     {
         if (!string.IsNullOrEmpty(scatalist))
         {
             scatalist += ",";
         }
         scatalist += cata;
         scatalist  = GetcataidListbyDG(db, cata);
     }
     return(scatalist);
 }
Exemplo n.º 10
0
 private void comboStage_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     using (var db = new ModMetaEntities())
     {
         int[] grades = db.tb_Code_ListTable1_Relationship.Where(w => w.End_ID == (int)comboStage.SelectedValue).Select(s => s.Start_ID).ToArray();
         List <tb_Code_ListTable1> gradeList = db.tb_Code_ListTable1.Where(w => w.Deleted == 0 && grades.Contains(w.ID)).OrderBy(o => o.Seq).ToList();
         gradeList.Insert(0, new tb_Code_ListTable1 {
             ID = 0, CodeName = "--全部--"
         });
         comboGrade.ItemsSource       = gradeList;
         comboGrade.SelectedValuePath = "ID";
         comboGrade.DisplayMemberPath = "CodeName";
     }
     TotalResource();
 }
Exemplo n.º 11
0
 /// <summary>
 /// 根据学段id取出已有教材从而动态获取到学段所有学科
 /// </summary>
 /// <param name="stageid">学段id</param>
 /// <returns></returns>
 public List <SubjectModel> GetSubjectByStage(int stageid)
 {
     using (var db = new ModMetaEntities())
     {
         using (var dbres = new MODResourceEntities())
         {
             string[]            subIdlist = dbres.tb_Course.Where(w => w.SchoolStage == stageid).Select(s => s.Subject).Distinct().ToArray();
             List <SubjectModel> subModel  = db.tb_Code_ListTable2.Where(w => subIdlist.Contains(w.ID.ToString())).OrderBy(o => o.Seq).Select(s => new SubjectModel
             {
                 SubjectID   = s.ID,
                 SubjectName = s.CodeName
             }).ToList();
             return(subModel);
         }
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// 递归目录节点
        /// </summary>
        /// <param name="db"></param>
        /// <param name="parentId"></param>
        /// <returns></returns>
        private List <KnowledgeModel> GetKnowlegeList(ModMetaEntities db, int parentId)
        {
            List <KnowledgeModel>    knowledgeList     = new List <KnowledgeModel>();
            List <tb_Code_Knowledge> tempkonwledgeList = db.tb_Code_Knowledge.Where(w => w.Deleted == 0 && w.ParentID == parentId).OrderBy(o => o.Seq).ToList();

            foreach (tb_Code_Knowledge konwledge in tempkonwledgeList)
            {
                KnowledgeModel knowledgemodel = new KnowledgeModel();
                knowledgemodel.ID       = konwledge.ID;
                knowledgemodel.stage    = konwledge.StageID;
                knowledgemodel.subject  = konwledge.SubjectID;
                knowledgemodel.CodeName = konwledge.CodeName;
                knowledgemodel.Children = null;
                knowledgeList.Add(knowledgemodel);
            }
            return(knowledgeList);
        }
Exemplo n.º 13
0
 public MainWindow()
 {
     InitializeComponent();
     using (var db = new ModMetaEntities())
     {
         List <tb_Code_ListTable2> subjectList = db.tb_Code_ListTable2.Where(w => w.Deleted == 0).OrderBy(o => o.Seq).ToList();
         comboSubject.ItemsSource       = subjectList;
         comboSubject.SelectedValuePath = "ID";
         comboSubject.DisplayMemberPath = "CodeName";
         List <tb_Code_SchoolStage> stageList = db.tb_Code_SchoolStage.Where(w => w.Deleted == 0).OrderBy(o => o.Seq).ToList();
         comboStage.ItemsSource       = stageList;
         comboStage.SelectedValuePath = "ID";
         comboStage.DisplayMemberPath = "CodeName";
         List <tb_Code_BookReel> breelList = db.tb_Code_BookReel.Where(w => w.Deleted == 0).OrderBy(o => o.Seq).ToList();
         breelList.Insert(0, new tb_Code_BookReel {
             ID = 0, CodeName = "--全部--"
         });
         comboBrlee.ItemsSource       = breelList;
         comboBrlee.SelectedValuePath = "ID";
         comboBrlee.DisplayMemberPath = "CodeName";
     }
 }
Exemplo n.º 14
0
 private void UploadDataBase_Click(object sender, EventArgs e)
 {
     using (var db = new ModMetaEntities())
     {
         using (var dbres = new MODResourceEntities())
         {
             using (var dbfile = new MODkingfilesEntities())
             {
                 /////////////先增加文件信息//////////////
                 foreach (tb_Files file in filelist)
                 {
                     tb_Files tempfile = dbfile.tb_Files.Find(file.ID);
                     if (tempfile == null)
                     {
                         dbfile.tb_Files.Add(file);
                     }
                 }
                 dbfile.SaveChanges();
                 /////////////再增加资源信息//////////////
                 foreach (tb_Resource resource in resourcelist)
                 {
                     tb_Resource tempresource = dbres.tb_Resource.Find(resource.ID);
                     if (tempresource == null)
                     {
                         if (resource.Edition == 66 && resource.Grade == 3 && resource.BookReel == 2 && resource.Subject == 1)
                         {
                             ViewMod_Trunt_Branch tbmodel = db.ViewMod_Trunt_Branch.Where(w => w.tID == resource.Catalog).FirstOrDefault();
                             resource.Catalog = tbmodel.bID;
                         }
                         resource.ResourceClass = 1;
                         dbres.tb_Resource.Add(resource);
                     }
                 }
                 dbres.SaveChanges();
                 MessageBox.Show("操作成功");
             }
         }
     }
 }
Exemplo n.º 15
0
        /// <summary>
        /// 获取云课堂子应用
        /// </summary>
        /// <param name="subjectID"></param>
        /// <param name="ediID"></param>
        /// <param name="gradeID"></param>
        /// <param name="BookletID"></param>
        /// <returns></returns>
        public ApplyPartModel GetCourseAppList(int CourseID)
        {
            using (var db = new ModMetaEntities())
            {
                using (var dbres = new MODResourceEntities())
                {
                    ApplyPartModel applyModel = new ApplyPartModel();
                    applyModel.appList = new List <AppPartModel>();
                    tb_Course       course = dbres.tb_Course.Find(CourseID);
                    tb_StandardBook book   = db.tb_StandardBook.Where(w => w.Edition == course.EditionID && w.Subject.ToString() == course.Subject && w.Grade.ToString() == course.Grade && w.Booklet == course.BookReel && w.Deleted == 0).FirstOrDefault();
                    applyModel.ImageUrl = AppSetting.ReslibUrl + "/DigitalClass/" + course.CoursePath + "/Course.gif";
                    applyModel.BookUrl  = AppSetting.ReslibUrl + "/DigitalClass/" + course.CoursePath + "/Start.htm";
                    applyModel.appList  = dbres.tb_CourseApp.Where(w => w.CourseID == CourseID).Select(apps => new AppPartModel
                    {
                        AppName = apps.AppName,
                        AppType = apps.AppType,
                        Url     = apps.AppType == 0? (apps.Folder + "?BookID=" + book.ID): (AppSetting.ReslibUrl + "/DigitalClass/" + course.CoursePath + "/" + apps.Folder + "/Start.htm")
                    }).ToList();

                    return(applyModel);
                }
            }
        }
Exemplo n.º 16
0
 /// <summary>
 /// 获取资源类型列表
 /// </summary>
 public static List <ResourceType> GetResourceTypeList()
 {
     using (var db = new ModMetaEntities())
     {
         List <tb_Code_TreeTable2> list     = new List <tb_Code_TreeTable2>();
         List <ResourceType>       treeList = new List <ResourceType>();
         list = db.tb_Code_TreeTable2.Where(m => m.Deleted == 0).ToList();
         foreach (var item in list)
         {
             if (item.ParentID == 0)
             {
                 ResourceType model = new ResourceType();
                 model.ID       = item.ID;
                 model.CodeName = item.CodeName;
                 model.ParentID = item.ParentID;
                 model.Child    = new List <ResourceType>();
                 treeList.Add(model);
                 ///递归获取子集列表///
                 LoopToAppendChildrenForResourceType(list, model);
             }
         }
         return(treeList);
     }
 }
Exemplo n.º 17
0
        public static StandBook GetStandBookByID(int bookID)
        {
            StandBook book = new StandBook();

            using (var db = new ModMetaEntities())
            {
                var list = db.tb_StandardBook.Where(m => m.ID == bookID && m.Deleted == 0).ToList();
                book.ID       = list[0].ID;
                book.BookName = list[0].BooKName;

                book.SubjectID = list[0].Subject;
                var subject = db.tb_Code_ListTable2.Where(m => m.ID == book.SubjectID && m.Deleted == 0).ToList();
                book.SubjectName = subject[0].CodeName;

                book.StageID = list[0].Stage;
                var stage = db.tb_Code_SchoolStage.Where(m => m.ID == book.StageID && m.Deleted == 0).ToList();
                book.StageName = stage[0].CodeName;

                book.EditionID = list[0].Edition;
                var edition = db.tb_Code_ListTable3.Where(m => m.ID == book.EditionID && m.Deleted == 0).ToList();
                book.EditionName = edition[0].CodeName;
            }
            return(book);
        }