public SettingsViewModel( Settings settings, OpmlRepository opmlRepository, ChapterRepository chapterRepository, RepoService repoService, ViewService viewService, IEventAggregator eventAggregator, DialogService dialogService ) { this.opmlRepository = opmlRepository; this.chapterRepository = chapterRepository; this.repoService = repoService; this.viewService = viewService; this.dialogService = dialogService; this.Settings = settings; AddChapterCommand = new DelegateCommand(AddChapter); DeleteChapterCommand = new DelegateCommand(DeleteChapter); ExportOpmlCommand = new DelegateCommand(ExportOpml); ImportOpmlCommand = new DelegateCommand(ImportOpml); MoveLeftCommand = new DelegateCommand(MoveLeft); MoveRightCommand = new DelegateCommand(MoveRight); eventAggregator.GetEvent <WindowClosingEvent>().Subscribe(SaveChapterName); }
public GradeController() { this.gradeRepository = new GradeRepository(new GContext()); this.studentRepository = new StudentRepository(new GContext()); this.bookRespository = new BookRepository(new GContext()); this.chapterRepository = new ChapterRepository(new GContext()); }
static void Initialize() { mangaRepository = new MangaRepository(config); chapterRepository = new ChapterRepository(config); pageRepository = new PageRepository(config); tagRepository = new TagRepository(config); }
public UnitOfWork(AppDbContext context) { _context = context; Worlds = new WorldRepository(_context); Books = new BookRepository(_context); Chapters = new ChapterRepository(_context); }
public void OnInitialized(IContainerProvider containerProvider) { var viewService = containerProvider.Resolve <ViewService>(); var chapterRepository = new ChapterRepository(); var chapters = chapterRepository.GetOrDefault(); viewService.AddMenuViews(chapters); }
public async Task ImportMembers(Guid currentMemberId, Guid chapterId, CsvFile file) { await AssertMemberIsChapterAdmin(currentMemberId, chapterId); IReadOnlyCollection <ChapterProperty> chapterProperties = await ChapterRepository.GetChapterProperties(chapterId); MemberCsvFileHeaders headers = new MemberCsvFileHeaders(chapterProperties); IDictionary <string, int> headerIndexes = file.GetColumnIndexes(); IDictionary <int, Member> members = new Dictionary <int, Member>(); IDictionary <int, MemberSubscription> membersSubscriptions = new Dictionary <int, MemberSubscription>(); IDictionary <int, IReadOnlyCollection <MemberProperty> > membersProperties = new Dictionary <int, IReadOnlyCollection <MemberProperty> >(); for (int i = 0; i < file.Rows.Count; i++) { CsvRow row = file.Rows.ElementAt(i); members.Add(i, new Member(Guid.Empty, chapterId, row.Value(headerIndexes[MemberCsvFileHeaders.Email]), true, row.Value(headerIndexes[MemberCsvFileHeaders.FirstName]), row.Value(headerIndexes[MemberCsvFileHeaders.LastName]), DateTime.UtcNow, true, false, 0)); if (DateTime.TryParse(row.Value(headerIndexes[MemberCsvFileHeaders.SubscriptionExpiry]), out DateTime subscriptionExpiry)) { membersSubscriptions.Add(i, new MemberSubscription(Guid.Empty, SubscriptionType.Full, subscriptionExpiry)); } membersProperties.Add(i, chapterProperties .Select(x => new MemberProperty(Guid.Empty, Guid.Empty, x.Id, row.Value(headerIndexes[x.Label]))) .ToArray()); } // TODO: validate members for (int i = 0; i < file.Rows.Count; i++) { Guid memberId = await _memberRepository.CreateMember(members[i]); await _memberRepository.UpdateMemberProperties(memberId, membersProperties[i]); if (membersSubscriptions.ContainsKey(i)) { MemberSubscription subscription = new MemberSubscription(memberId, membersSubscriptions[i].Type, membersSubscriptions[i].ExpiryDate); await _memberRepository.UpdateMemberSubscription(subscription); } } }
public ViewSurveyController(IUnitOfWork unitOfWork, MultichoiceQuestionRepository mr, Survey_MultichoiceQuestionRepository smr, Survey_FreeTextQuestionRepository sfr, FreeTextQuestionRepository ftr, ChapterRepository cr, OptionsRepository or, MultichoiceQuestion_OptionsRepository mor, SurveyRepository sr) { _unitOfWork = unitOfWork; _mr = mr; _smr = smr; _sfr = sfr; _ftr = ftr; _cr = cr; _or = or; _mor = mor; _sr = sr; }
public async Task <CsvFile> GetMemberImportFile(Guid currentMemberId, Guid chapterId) { await AssertMemberIsChapterAdmin(currentMemberId, chapterId); IReadOnlyCollection <ChapterProperty> properties = await ChapterRepository.GetChapterProperties(chapterId); MemberCsvFileHeaders headers = new MemberCsvFileHeaders(properties); CsvFile file = new CsvFile(); file.Header.AddValues(headers.ToFields()); return(file); }
public LinksViewModel( ChapterRepository chapterRepository, DialogService dialogService, DetectionService detectionService, IEventAggregator eventAggregator ) { this.chapterRepository = chapterRepository; this.eventAggregator = eventAggregator; this.dialogService = dialogService; AddCommand = new DelegateCommand(async() => await detectionService.SetAddress(Data.Linked)); MoveCommand = new DelegateCommand <Link>(Move); DeleteCommand = new DelegateCommand <Link>(Delete); SelectionCommand = new DelegateCommand <Link>(link => detectionService.Selected(Data.Linked, link)); }
public List <Chapter_Type> BookChapters(string BookName) { List <ChapterType> _books = new ChapterRepository(BookName, UserID, "BookModel", "BookChapters").Books; List <Chapter_Type> books = new List <Chapter_Type>(); foreach (var item in _books) { books.Add(new Chapter_Type { BookName = item.BookName, Chapter = item.Chapter, ChapterName = item.ChapterName, DisplayOrder = item.DisplayOrder, Title = item.Title }); } return(books); }
public void AddChapterTest() { //-- Arrange var random = new Random(); Chapter expected = new Chapter { Id = random.Next(1_000_000, 2_000_000), DiaryId = 1, Name = "TestChapter", Location = "Narnia", Date = new DateTime(2020, 3, 3), Content = "Test Content", CreatedOn = new DateTime(2020, 9, 9) }; var dbContextFactory = new AtwDbContextFactory(); var dbContext = dbContextFactory.CreateDbContext(new string[0]); var chapterRepository = new ChapterRepository(dbContext); //-- Act chapterRepository.Add(expected); chapterRepository.SaveChanges(); var actual = chapterRepository.GetById(expected.Id); //--Assert Assert.AreEqual(expected.Id, actual.Id); Assert.AreEqual(expected.DiaryId, actual.DiaryId); Assert.AreEqual(expected.Name, actual.Name); Assert.AreEqual(expected.Location, actual.Location); Assert.AreEqual(expected.Date, actual.Date); Assert.AreEqual(expected.Content, actual.Content); Assert.AreEqual(expected.CreatedOn, actual.CreatedOn); dbContext.Dispose(); }
public void Should_Fail_When_AddingAChapterWithNegativeDiaryId() { var dbContextFactory = new AtwDbContextFactory(); var dbContext = dbContextFactory.CreateDbContext(new string[0]); try { //-- Arrange var random = new Random(); Chapter expected = new Chapter { Id = random.Next(1_000_000, 2_000_000), DiaryId = -1, Name = "TestChapter", Location = "Narnia", Date = new DateTime(2020, 3, 3), Content = "Test Content", CreatedOn = new DateTime(2020, 9, 9) }; var chapterRepository = new ChapterRepository(dbContext); //-- Act chapterRepository.Add(expected); chapterRepository.SaveChanges(); } finally { dbContext.Dispose(); } //--Assert }
public TheragathaProvider(ChapterRepository chapterRepository) { _chapterRepository = chapterRepository; _sources = new List <SourceFile>(); _sources.Add(new SourceFile { Type = ChapterType.ThagSingleVerse, Location = "thag.01.00x.than.html" }); DirectoryInfo dir = new DirectoryInfo(SITEBASE.ToApplicationPath()); foreach (var file in dir.GetFiles()) { Regex fileMatch = new Regex(@"thag\.(\d+\.\d+)\.than.html"); if (fileMatch.IsMatch(file.Name) && file.Name != "thag.01.00x.than.html") { _sources.Add(new SourceFile { Type = ChapterType.ThagMultipleVerse, Location = file.Name }); } } //_sources.Add(new SourceFile { Type = ChapterType.ThagMultipleVerse, Location = "thag.02.13.than.html"}); //_sources.Add(new SourceFile { Type = ChapterType.ThagMultipleVerse, Location = "thag.02.24.than.html"}); }
public Handler(ChapterRepository repository) { _repository = repository; }
public DhammapadaProvider(ChapterRepository chapterRepository) { this.chapterRepository = chapterRepository; }
public ChapterService() { _chapterRepository = new ChapterRepository(); _subjectChapterService = new SubjectChapterService(); }
public SnippetService() { this.chapterRepository = new ChapterRepository(); this.verseRepository = new VerseRepository(); }
public ChapterController() { this.bookRepository = new BookRepository(new GContext()); this.chapterRepository = new ChapterRepository(new GContext()); }
public Handler(SagaRepository sagaRepository, ChapterRepository chapterRepository) { _sagaRepository = sagaRepository; _chapterRepository = chapterRepository; }