/// <summary> /// Shows all book titles by single author loop. /// </summary> public void ShowAllBookTitlesBySingleAuthorLoop() { this._msgBox.NameOfMethod = MethodBase.GetCurrentMethod().Name; var coll1 = new BookDataCollection(); var coll2 = new BookTitlesCollection(); for (var i = 0; i < coll1.GetItemsCount(); i++) { var s1 = coll1.GetItemAt(i); if (!this._valid.ValidateStringIsNotNull(s1)) { return; } s1 = s1.Trim(); if (!this._valid.ValidateStringHasLength(s1)) { return; } coll2.AddItem(s1); } }
/// <summary> /// Books the titles search loop. /// </summary> private void BookTitlesSearchLoop() { this._msgBox.NameOfMethod = MethodBase.GetCurrentMethod().Name; if (!this._valid.ValidateStringIsNotNull(BookDataProperties.SetBookTitleSearchString)) { return; } if (!this._valid.ValidateStringHasLength(BookDataProperties.SetBookTitleSearchString.Trim())) { return; } var searchStr = BookDataProperties.SetBookTitleSearchString.Trim().ToLower(); var coll1 = new BookDataCollection(); var coll2 = new BookTitlesCollection(); for (var i = 0; i < coll1.GetItemsCount(); i++) { var s1 = coll1.GetItemAt(i); s1 = s1.ToLower(); if (s1.Contains(searchStr)) { coll2.AddItem(s1); } } }
/// <summary> /// Searches the book title by single author. /// </summary> public void SearchBookTitleBySingleAuthor() { this._msgBox.NameOfMethod = MethodBase.GetCurrentMethod().Name; var dirAuthors = BookListPathsProperties.PathAuthorsDirectory; var cls1 = new CombinePathsClass(); var filePath = cls1.CombineDirectoryPathWithFileName(dirAuthors, BookListPathsProperties.CurrentWorkingFileName); var coll = new BookDataCollection(); coll.ClearCollection(); var titles = new BookTitlesCollection(); titles.ClearCollection(); var cls2 = new InputClass(); cls2.ReadTitlesFromFileLoop(filePath); this.FindTitlesInString(); if (titles.GetItemsCount() < 1) { titles.AddItem("No titles with this search criteria were found."); } }
/// <summary> /// Searches the book title all authors. /// </summary> public void SearchBookAuthorAllTitles() { this._msgBox.NameOfMethod = MethodBase.GetCurrentMethod().Name; var cls1 = new FileClass(); cls1.GetAllAuthorFilePathsContainedInAuthorDirectory(); var coll1 = new BookDataCollection(); coll1.ClearCollection(); this.AuthorNamesSearchLoop(); var coll2 = new BookTitlesCollection(); if (coll2.GetItemsCount() < 1) { coll2.AddItem("No titles with this search criteria were found."); } }