Exemple #1
0
        /// <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>
        ///     The GetAuthorFileNamesFromAuthorsList.
        /// </summary>
        public void GetAuthorFileNamesFromAuthorsList()
        {
            var coll  = new AuthorNamesCollection();
            var input = new InputClass();

            var authorNames = input.ReadAuthorNamesFromFile(BookListPathsProperties.PathAuthorsNamesListFile);

            coll.ClearCollection();
            foreach (var name in authorNames)
            {
                coll.AddItem(name);
            }
        }
Exemple #3
0
        /// <summary>Fills the Author names list collection with authors names.</summary>
        public void FillListWithAuthorsNames()
        {
            this._msgBox.NameOfMethod = MethodBase.GetCurrentMethod().Name;

            var coll = new AuthorNamesCollection();

            coll.ClearCollection();

            var cls = new InputClass();

            cls.ReadAuthorsNamesFromFile(BookListPathsProperties.PathAuthorsNamesListFile);

            coll.SortCollection();
        }
Exemple #4
0
        /// <summary>
        ///     Authors the names search loop.
        /// </summary>
        private void AuthorNamesSearchLoop()
        {
            this._msgBox.NameOfMethod = MethodBase.GetCurrentMethod().Name;



            var coll1      = new AuthorsFileNamesCollection();
            var totalCount = coll1.GetItemsCount();

            for (var i = 0; i < totalCount; i++)
            {
                var fileName = coll1.GetItemAt(i);

                var dirAuthors = BookListPathsProperties.PathAuthorsDirectory;

                var coll2    = new CombinePathsClass();
                var filePath = coll2.CombineDirectoryPathWithFileName(dirAuthors, fileName);

                var coll3 = new InputClass();
                coll3.ReadTitlesFromFileLoop(filePath);

                this.FindTitlesInString();
            }
        }