示例#1
0
 public static ViewTopicModel ToViewTopicModel(this Topic topic, IDisciplineStorage storage)
 {
     return(new ViewTopicModel
     {
         Id = topic.Id,
         ChapterId = topic.ChapterRef,
         Created = ToString(topic.Created),
         Updated = ToString(topic.Updated),
         TestCourseName =
             topic.TestCourseRef.HasValue && topic.TestCourseRef != Constants.TestWithoutCourseId
                            ? (storage.GetCourse(topic.TestCourseRef.Value) == null
                                   ? Localization.GetMessage("course deleted")
                                   : storage.GetCourse(topic.TestCourseRef.Value).Name)
                            : string.Empty,
         TestTopicType = topic.TestTopicTypeRef.HasValue
                                        ? ToString(
             storage.GetTopicType(topic.TestTopicTypeRef.Value))
                                        : string.Empty,
         TheoryCourseName = topic.TheoryCourseRef.HasValue
                                           ? (storage.GetCourse(topic.TheoryCourseRef.Value) == null
                                                  ? Localization.GetMessage("course deleted")
                                                  : storage.GetCourse(topic.TheoryCourseRef.Value).Name)
                                           : string.Empty,
         TheoryTopicType = topic.TheoryTopicTypeRef.HasValue
                                          ? ToString(
             storage.GetTopicType(topic.TheoryTopicTypeRef.Value))
                                          : string.Empty,
         TopicName = topic.Name
     });
 }
示例#2
0
        public static void GenerateAllDisciplines(IDisciplineStorage storage)
        {
            ImportExportDiscipline importer = new ImportExportDiscipline(storage);

            var path = (new System.Uri(Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath;

            path = path.Replace("IUDICO.LMS/Plugins/IUDICO.DataGenerator.DLL", "IUDICO.DataGenerator/Content/Disciplines/");

            if (Directory.Exists(path))
            {
                var files = Directory.GetFiles(path, "*.zip");

                foreach (var file in files)
                {
                    var name = Path.GetFileNameWithoutExtension(file);

                    if (storage.GetDisciplines().Any(d => d.Name == name && d.Owner == "prof3"))
                    {
                        return;
                    }

                    importer.Import(file);
                }
            }
        }
示例#3
0
 public DataPreparer(
     IDisciplineStorage disciplineStorage, ICurriculumStorage curriculumStorage, ILmsService lmsService)
 {
     this.disciplineStorage = disciplineStorage;
     this.curriculumStorage = curriculumStorage;
     this.courseService     = lmsService.FindService <ICourseService>();
     this.userService       = lmsService.FindService <IUserService>();
 }
示例#4
0
 public DataPreparer(
     IDisciplineStorage disciplineStorage, ICurriculumStorage curriculumStorage, ILmsService lmsService)
 {
     this.disciplineStorage = disciplineStorage;
     this.curriculumStorage = curriculumStorage;
     this.courseService = lmsService.FindService<ICourseService>();
     this.userService = lmsService.FindService<IUserService>();
 }
示例#5
0
        public ImportExportDiscipline(IDisciplineStorage storage)
        {
            this.storage = storage;

            //FieldInfo fld = this.storage.GetType().GetField("storage", BindingFlags.Instance | BindingFlags.NonPublic);
            //var databaseStorage = fld.GetValue(this.storage);
            //FieldInfo field = databaseStorage.GetType().GetField("lmsService", BindingFlags.Instance | BindingFlags.NonPublic);
            //this.courseService = (field.GetValue(databaseStorage) as ILmsService).FindService<ICourseService>();
        }
        public ImportExportDiscipline(IDisciplineStorage storage)
        {
            this.storage = storage;

            //FieldInfo fld = this.storage.GetType().GetField("storage", BindingFlags.Instance | BindingFlags.NonPublic);
            //var databaseStorage = fld.GetValue(this.storage);
            //FieldInfo field = databaseStorage.GetType().GetField("lmsService", BindingFlags.Instance | BindingFlags.NonPublic);
            //this.courseService = (field.GetValue(databaseStorage) as ILmsService).FindService<ICourseService>();
        }
示例#7
0
 private static IEnumerable<Discipline> SelectDisciplines(
     IDisciplineStorage storage)
 {
     yield return storage.Get(2);
     yield return storage.Get(5);
     yield return storage.Get(3);
     yield return storage.Get(8);
     yield return storage.Get(4);
     yield return storage.Get(11);
     yield return storage.Get(14);
 }
示例#8
0
      public static void SeleniumTestingSystemTestDiscipline(IDisciplineStorage storage, string path)
      {
         if (storage.GetDisciplines().Any(d => d.Name == "Testing discipline" && d.Owner == "SeleniumTeacher"))
         {
            return;
         }

         ImportExportDiscipline importer = new ImportExportDiscipline(storage);
         importer.Import(path);

      }
示例#9
0
        public static void SeleniumTestingSystemTestDiscipline(IDisciplineStorage storage, string path)
        {
            if (storage.GetDisciplines().Any(d => d.Name == "Testing discipline" && d.Owner == "SeleniumTeacher"))
            {
                return;
            }

            ImportExportDiscipline importer = new ImportExportDiscipline(storage);

            importer.Import(path);
        }
示例#10
0
        public static void PascalDiscipline(IDisciplineStorage storage, string path)
        {
            if (storage.GetDisciplines().Any(d => d.Name == "Pascal" && d.Owner == "OlehVukladachenko"))
            {
                return;
            }

            ImportExportDiscipline importer = new ImportExportDiscipline(storage);

            importer.Import(path);
        }
示例#11
0
      public static void PascalDiscipline(IDisciplineStorage storage, string path)
		{
			if (storage.GetDisciplines().Any(d => d.Name == "Pascal" && d.Owner == "OlehVukladachenko"))
			{
				return;
			}
			
			ImportExportDiscipline importer = new ImportExportDiscipline(storage);
         importer.Import(path);

		}
示例#12
0
        private static IEnumerable <Discipline> SelectDisciplines(
            IDisciplineStorage storage)
        {
            yield return(storage.Get(2));

            yield return(storage.Get(5));

            yield return(storage.Get(3));

            yield return(storage.Get(8));

            yield return(storage.Get(4));

            yield return(storage.Get(11));

            yield return(storage.Get(14));
        }
示例#13
0
      public static void PascalCurriculum(ICurriculumStorage curriculumStorage, IDisciplineStorage disciplineStorage, IUserStorage userStorage)
      {
         var groups = userStorage.GetGroups();
         var disciplines = disciplineStorage.GetDisciplines();

         var curriculum = new Curriculum
                                       {
                                          UserGroupRef = groups.FirstOrDefault(g => g.Name == "Демонстраційна група").Id,
                                          DisciplineRef = disciplines.FirstOrDefault(d => d.Name == "Pascal" && d.Owner == "OlehVukladachenko").Id,
                                          StartDate = DateTime.Now,
                                          EndDate = DateTime.Now + new TimeSpan(365, 0, 0, 0, 0)
                                       };

         if (curriculumStorage.GetCurriculums().Any(c => c.DisciplineRef == curriculum.DisciplineRef && c.UserGroupRef == curriculum.UserGroupRef))
         {
            return;
         }
         curriculumStorage.AddCurriculum(curriculum);

         foreach (var chapter in curriculumStorage.GetCurriculum(curriculum.Id).CurriculumChapters)
         {
            chapter.StartDate = DateTime.Now;
            chapter.EndDate = DateTime.Now + new TimeSpan(364, 0, 0, 0, 0);
            curriculumStorage.UpdateCurriculumChapter(chapter);

            foreach (var topic in chapter.CurriculumChapterTopics)
            {
               topic.TestStartDate = DateTime.Now;
               topic.TestEndDate = DateTime.Now + new TimeSpan(363, 0, 0, 0, 0);
               topic.TheoryStartDate = DateTime.Now;
               topic.TheoryEndDate = DateTime.Now + new TimeSpan(363, 0, 0, 0, 0);

               curriculumStorage.UpdateCurriculumChapterTopic(topic);
            }
         }
      }
示例#14
0
      public static void GenerateAllDisciplines(IDisciplineStorage storage)
      {
         ImportExportDiscipline importer = new ImportExportDiscipline(storage);

         var path = (new System.Uri(Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath;
         path = path.Replace("IUDICO.LMS/Plugins/IUDICO.DataGenerator.DLL", "IUDICO.DataGenerator/Content/Disciplines/");

         if (Directory.Exists(path))
         {
           var files = Directory.GetFiles(path, "*.zip");

            foreach (var file in files)
            {
               var name = Path.GetFileNameWithoutExtension(file);

               if (storage.GetDisciplines().Any(d => d.Name == name && d.Owner == "prof3"))
               {
                  return;
               }

               importer.Import(file);
            }
         }
      }
示例#15
0
        public static void PascalCurriculum(ICurriculumStorage curriculumStorage, IDisciplineStorage disciplineStorage, IUserStorage userStorage)
        {
            var groups      = userStorage.GetGroups();
            var disciplines = disciplineStorage.GetDisciplines();

            var curriculum = new Curriculum
            {
                UserGroupRef  = groups.FirstOrDefault(g => g.Name == "Демонстраційна група").Id,
                DisciplineRef = disciplines.FirstOrDefault(d => d.Name == "Pascal" && d.Owner == "OlehVukladachenko").Id,
                StartDate     = DateTime.Now,
                EndDate       = DateTime.Now + new TimeSpan(365, 0, 0, 0, 0)
            };

            if (curriculumStorage.GetCurriculums().Any(c => c.DisciplineRef == curriculum.DisciplineRef && c.UserGroupRef == curriculum.UserGroupRef))
            {
                return;
            }
            curriculumStorage.AddCurriculum(curriculum);

            foreach (var chapter in curriculumStorage.GetCurriculum(curriculum.Id).CurriculumChapters)
            {
                chapter.StartDate = DateTime.Now;
                chapter.EndDate   = DateTime.Now + new TimeSpan(364, 0, 0, 0, 0);
                curriculumStorage.UpdateCurriculumChapter(chapter);

                foreach (var topic in chapter.CurriculumChapterTopics)
                {
                    topic.TestStartDate   = DateTime.Now;
                    topic.TestEndDate     = DateTime.Now + new TimeSpan(363, 0, 0, 0, 0);
                    topic.TheoryStartDate = DateTime.Now;
                    topic.TheoryEndDate   = DateTime.Now + new TimeSpan(363, 0, 0, 0, 0);

                    curriculumStorage.UpdateCurriculumChapterTopic(topic);
                }
            }
        }
示例#16
0
 public DisciplineService(IDisciplineStorage disciplineStorage)
 {
     this.disciplineStorage = disciplineStorage;
 }
示例#17
0
 public DisciplineService(IDisciplineStorage disciplineStorage)
 {
     this.disciplineStorage = disciplineStorage;
 }
示例#18
0
        public static void CurriculumForSeleniumTestingSystem(ICurriculumStorage curriculumStorage, IDisciplineStorage disciplineStorage, IUserStorage userStorage)
        {
            var groups      = userStorage.GetGroups();
            var disciplines = disciplineStorage.GetDisciplines();

            var curriculums = new List <Curriculum>
            {
                new Curriculum
                {
                    UserGroupRef =
                        groups.FirstOrDefault(
                            g => g.Name == "Selenium testing system group").Id,
                    DisciplineRef =
                        disciplines.FirstOrDefault(
                            d => d.Name == "Testing discipline" && d.Owner == "SeleniumTeacher").Id,
                    StartDate = DateTime.Now,
                    EndDate   = DateTime.Now + new TimeSpan(365, 0, 0, 0, 0)
                },
                //new Curriculum
                //   {
                //      UserGroupRef =
                //         userStorage.GetGroups().FirstOrDefault(
                //            g => g.Name == "Disc timeline").Id,
                //      DisciplineRef =
                //         disciplineStorage.GetDisciplines().FirstOrDefault(
                //            d => d.Name == "Testing discipline" && d.Owner == "SeleniumTeacher").Id,
                //      StartDate = DateTime.Now,
                //      EndDate = DateTime.Now + new TimeSpan(0, 0, 0, 0, 1)
                //   },
                //new Curriculum
                //   {
                //      UserGroupRef =
                //         userStorage.GetGroups().FirstOrDefault(
                //            g => g.Name == "Chapter timeline").Id,
                //      DisciplineRef =
                //         disciplineStorage.GetDisciplines().FirstOrDefault(
                //            d => d.Name == "Testing discipline" && d.Owner == "SeleniumTeacher").Id,
                //      StartDate = DateTime.Now,
                //      EndDate = DateTime.Now + new TimeSpan(36500, 0, 0, 0, 0)
                //   },
                //new Curriculum
                //   {
                //      UserGroupRef =
                //         userStorage.GetGroups().FirstOrDefault(
                //            g => g.Name == "Topic timeline").Id,
                //      DisciplineRef =
                //         disciplineStorage.GetDisciplines().FirstOrDefault(
                //            d => d.Name == "Testing discipline" && d.Owner == "SeleniumTeacher").Id,
                //      StartDate = DateTime.Now,
                //      EndDate = DateTime.Now + new TimeSpan(36500, 0, 0, 0, 0)
                //   }
            };

            foreach (var curriculum in curriculums)
            {
                if (curriculumStorage.GetCurriculums().Any(c => c.DisciplineRef == curriculum.DisciplineRef && c.UserGroupRef == curriculum.UserGroupRef))
                {
                    continue;
                }
                curriculumStorage.AddCurriculum(curriculum);

                foreach (var chapter in curriculumStorage.GetCurriculum(curriculum.Id).CurriculumChapters)
                {
                    chapter.StartDate = DateTime.Now;
                    chapter.EndDate   = DateTime.Now + new TimeSpan(364, 0, 0, 0, 0);
                    if (userStorage.GetGroup(curriculum.UserGroupRef).Name == "Chapter timeline")
                    {
                        chapter.EndDate = DateTime.Now + new TimeSpan(0, 0, 0, 0, 1);
                    }
                    curriculumStorage.UpdateCurriculumChapter(chapter);

                    foreach (var topic in chapter.CurriculumChapterTopics)
                    {
                        topic.TestStartDate   = DateTime.Now;
                        topic.TestEndDate     = DateTime.Now + new TimeSpan(363, 0, 0, 0, 0);
                        topic.TheoryStartDate = DateTime.Now;
                        topic.TheoryEndDate   = DateTime.Now + new TimeSpan(363, 0, 0, 0, 0);
                        if (userStorage.GetGroup(curriculum.UserGroupRef).Name == "Topic timeline")
                        {
                            topic.TestEndDate   = DateTime.Now + new TimeSpan(0, 0, 0, 0, 1);
                            topic.TheoryEndDate = DateTime.Now + new TimeSpan(0, 0, 0, 0, 1);
                        }
                        curriculumStorage.UpdateCurriculumChapterTopic(topic);
                    }
                }
            }
        }
示例#19
0
 public QuestionService(IDataContext context)
 {
     disciplineStorage = context.DisciplineStorage;
     questionStorage   = context.QuestionStorage;
     answerStorage     = context.AnswerStorage;
 }
示例#20
0
 public CachedDisciplineStorage(IDisciplineStorage storage, ICacheProvider cachePrvoider)
 {
     this.storage = storage;
     this.cacheProvider = cachePrvoider;
 }
示例#21
0
 public static ViewTopicModel ToViewTopicModel(this Topic topic, IDisciplineStorage storage)
 {
     return new ViewTopicModel
                {
                    Id = topic.Id,
                    ChapterId = topic.ChapterRef,
                    Created = ToString(topic.Created),
                    Updated = ToString(topic.Updated),
                    TestCourseName =
                        topic.TestCourseRef.HasValue && topic.TestCourseRef != Constants.TestWithoutCourseId
                            ? (storage.GetCourse(topic.TestCourseRef.Value) == null
                                   ? Localization.GetMessage("course deleted")
                                   : storage.GetCourse(topic.TestCourseRef.Value).Name)
                            : string.Empty,
                    TestTopicType = topic.TestTopicTypeRef.HasValue
                                        ? ToString(
                                            storage.GetTopicType(topic.TestTopicTypeRef.Value))
                                        : string.Empty,
                    TheoryCourseName = topic.TheoryCourseRef.HasValue
                                           ? (storage.GetCourse(topic.TheoryCourseRef.Value) == null
                                                  ? Localization.GetMessage("course deleted")
                                                  : storage.GetCourse(topic.TheoryCourseRef.Value).Name)
                                           : string.Empty,
                    TheoryTopicType = topic.TheoryTopicTypeRef.HasValue
                                          ? ToString(
                                              storage.GetTopicType(topic.TheoryTopicTypeRef.Value))
                                          : string.Empty,
                    TopicName = topic.Name
                };
 }
示例#22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DisciplineBaseController"/> class.
 /// </summary>
 /// <param name="disciplineStorage">The discipline storage.</param>
 public DisciplineBaseController(IDisciplineStorage disciplineStorage)
 {
     this.Storage = disciplineStorage;
     this.Validator = new Validator(this.Storage);
 }
示例#23
0
 public PublicationService(IDataContext dataContext)
 {
     articleStorage    = dataContext.ArticleStorage;
     disciplineStorage = dataContext.DisciplineStorage;
     commentStorage    = dataContext.CommentStorage;
 }
示例#24
0
 public DisciplineLogic(IDisciplineStorage disciplineStorage)
 {
     _disciplineStorage = disciplineStorage;
 }
示例#25
0
      public static void CurriculumForSeleniumTestingSystem(ICurriculumStorage curriculumStorage, IDisciplineStorage disciplineStorage, IUserStorage userStorage)
      {
         var groups = userStorage.GetGroups();
         var disciplines = disciplineStorage.GetDisciplines();

         var curriculums = new List<Curriculum>
                              {
                                 new Curriculum
                                    {
                                       UserGroupRef =
                                          groups.FirstOrDefault(
                                             g => g.Name == "Selenium testing system group").Id,
                                       DisciplineRef =
                                          disciplines.FirstOrDefault(
                                             d => d.Name == "Testing discipline" && d.Owner == "SeleniumTeacher").Id,
                                       StartDate = DateTime.Now,
                                       EndDate = DateTime.Now + new TimeSpan(365, 0, 0, 0, 0)
                                    },
                                 //new Curriculum
                                 //   {
                                 //      UserGroupRef =
                                 //         userStorage.GetGroups().FirstOrDefault(
                                 //            g => g.Name == "Disc timeline").Id,
                                 //      DisciplineRef =
                                 //         disciplineStorage.GetDisciplines().FirstOrDefault(
                                 //            d => d.Name == "Testing discipline" && d.Owner == "SeleniumTeacher").Id,
                                 //      StartDate = DateTime.Now,
                                 //      EndDate = DateTime.Now + new TimeSpan(0, 0, 0, 0, 1)
                                 //   },
                                 //new Curriculum
                                 //   {
                                 //      UserGroupRef =
                                 //         userStorage.GetGroups().FirstOrDefault(
                                 //            g => g.Name == "Chapter timeline").Id,
                                 //      DisciplineRef =
                                 //         disciplineStorage.GetDisciplines().FirstOrDefault(
                                 //            d => d.Name == "Testing discipline" && d.Owner == "SeleniumTeacher").Id,
                                 //      StartDate = DateTime.Now,
                                 //      EndDate = DateTime.Now + new TimeSpan(36500, 0, 0, 0, 0)
                                 //   },
                                 //new Curriculum
                                 //   {
                                 //      UserGroupRef =
                                 //         userStorage.GetGroups().FirstOrDefault(
                                 //            g => g.Name == "Topic timeline").Id,
                                 //      DisciplineRef =
                                 //         disciplineStorage.GetDisciplines().FirstOrDefault(
                                 //            d => d.Name == "Testing discipline" && d.Owner == "SeleniumTeacher").Id,
                                 //      StartDate = DateTime.Now,
                                 //      EndDate = DateTime.Now + new TimeSpan(36500, 0, 0, 0, 0)
                                 //   }
                              };

         foreach (var curriculum in curriculums)
         {

            if (curriculumStorage.GetCurriculums().Any(c => c.DisciplineRef == curriculum.DisciplineRef && c.UserGroupRef == curriculum.UserGroupRef))
            {
               continue;
            }
            curriculumStorage.AddCurriculum(curriculum);

            foreach (var chapter in curriculumStorage.GetCurriculum(curriculum.Id).CurriculumChapters)
            {
               chapter.StartDate = DateTime.Now;
               chapter.EndDate = DateTime.Now + new TimeSpan(364, 0, 0, 0, 0);
               if (userStorage.GetGroup(curriculum.UserGroupRef).Name == "Chapter timeline")
               {
                  chapter.EndDate = DateTime.Now + new TimeSpan(0, 0, 0, 0, 1);
               }
               curriculumStorage.UpdateCurriculumChapter(chapter);

               foreach (var topic in chapter.CurriculumChapterTopics)
               {
                  topic.TestStartDate = DateTime.Now;
                  topic.TestEndDate = DateTime.Now + new TimeSpan(363, 0, 0, 0, 0);
                  topic.TheoryStartDate = DateTime.Now;
                  topic.TheoryEndDate = DateTime.Now + new TimeSpan(363, 0, 0, 0, 0);
                  if (userStorage.GetGroup(curriculum.UserGroupRef).Name == "Topic timeline")
                  {
                     topic.TestEndDate = DateTime.Now + new TimeSpan(0, 0, 0, 0, 1);
                     topic.TheoryEndDate = DateTime.Now + new TimeSpan(0, 0, 0, 0, 1);
                  }
                  curriculumStorage.UpdateCurriculumChapterTopic(topic);
               }
            }
         }
      }
示例#26
0
 public CachedDisciplineStorage(IDisciplineStorage storage, ICacheProvider cachePrvoider)
 {
     this.storage       = storage;
     this.cacheProvider = cachePrvoider;
 }
示例#27
0
 public PublicationService(IDataContext dataContext)
 {
     articleStorage = dataContext.ArticleStorage;
     disciplineStorage = dataContext.DisciplineStorage;
     commentStorage = dataContext.CommentStorage;
 }
示例#28
0
 public Validator(IDisciplineStorage storage)
 {
     this._storage = storage;
 }
示例#29
0
 public DisciplineLogic(IDisciplineStorage disciplineStorage, IUserStorage userStorage)
 {
     this.disciplineStorage = disciplineStorage;
     this.userStorage       = userStorage;
 }
示例#30
0
 public Validator(IDisciplineStorage storage)
 {
     this._storage = storage;
 }
示例#31
0
        public TopicController(IDisciplineStorage disciplineStorage)
            : base(disciplineStorage)
        {

        }
示例#32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DisciplineBaseController"/> class.
 /// </summary>
 /// <param name="disciplineStorage">The discipline storage.</param>
 public DisciplineBaseController(IDisciplineStorage disciplineStorage)
 {
     this.Storage   = disciplineStorage;
     this.Validator = new Validator(this.Storage);
 }
示例#33
0
        public ChapterController(IDisciplineStorage disciplineStorage)
            : base(disciplineStorage)
        {

        }
示例#34
0
 public NotificationService(IDataContext context)
 {
     this.context      = context;
     disciplineStorage = context.DisciplineStorage;
     userStorage       = context.UserStorage;
 }
示例#35
0
 public TopicController(IDisciplineStorage disciplineStorage)
     : base(disciplineStorage)
 {
 }
示例#36
0
 public QuestionService(IDataContext context)
 {
     disciplineStorage = context.DisciplineStorage;
     questionStorage = context.QuestionStorage;
     answerStorage = context.AnswerStorage;
 }
示例#37
0
 public ChapterController(IDisciplineStorage disciplineStorage)
     : base(disciplineStorage)
 {
 }