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 }); }
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); } } }
public DataPreparer( IDisciplineStorage disciplineStorage, ICurriculumStorage curriculumStorage, ILmsService lmsService) { this.disciplineStorage = disciplineStorage; this.curriculumStorage = curriculumStorage; this.courseService = lmsService.FindService <ICourseService>(); this.userService = lmsService.FindService <IUserService>(); }
public DataPreparer( IDisciplineStorage disciplineStorage, ICurriculumStorage curriculumStorage, ILmsService lmsService) { this.disciplineStorage = disciplineStorage; this.curriculumStorage = curriculumStorage; this.courseService = lmsService.FindService<ICourseService>(); this.userService = lmsService.FindService<IUserService>(); }
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>(); }
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); }
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); }
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); }
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)); }
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); } } }
public DisciplineService(IDisciplineStorage disciplineStorage) { this.disciplineStorage = disciplineStorage; }
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); } } } }
public QuestionService(IDataContext context) { disciplineStorage = context.DisciplineStorage; questionStorage = context.QuestionStorage; answerStorage = context.AnswerStorage; }
public CachedDisciplineStorage(IDisciplineStorage storage, ICacheProvider cachePrvoider) { this.storage = storage; this.cacheProvider = cachePrvoider; }
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 }; }
/// <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); }
public PublicationService(IDataContext dataContext) { articleStorage = dataContext.ArticleStorage; disciplineStorage = dataContext.DisciplineStorage; commentStorage = dataContext.CommentStorage; }
public DisciplineLogic(IDisciplineStorage disciplineStorage) { _disciplineStorage = disciplineStorage; }
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); } } } }
public Validator(IDisciplineStorage storage) { this._storage = storage; }
public DisciplineLogic(IDisciplineStorage disciplineStorage, IUserStorage userStorage) { this.disciplineStorage = disciplineStorage; this.userStorage = userStorage; }
public TopicController(IDisciplineStorage disciplineStorage) : base(disciplineStorage) { }
public ChapterController(IDisciplineStorage disciplineStorage) : base(disciplineStorage) { }
public NotificationService(IDataContext context) { this.context = context; disciplineStorage = context.DisciplineStorage; userStorage = context.UserStorage; }