/// <summary>Called when [ok button clicked].</summary>
        /// <param name="sender">The source of the event</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        private void OnOKButton_Clicked(object sender, EventArgs e)
        {
            var coll = new BookDataCollection();

            BookListPathsProperties.AuthorsNameCurrent = lblAuthor.Text;
            var clsComb = new CombinePathsClass();

            var filePath = clsComb.CombineDirectoryPathWithFileName(BookListPathsProperties.PathAuthorsDirectory,
                                                                    BookListPathsProperties.AuthorsNameCurrent);

            var valid  = new ValidationClass();
            var msgBox = new MyMessageBoxClass();

            if (!valid.ValidateStringHasLength(filePath))
            {
                msgBox.Msg = "Unable to complete the operation.";
                msgBox.ShowErrorMessageBox();
                return;
            }

            BookListPathsProperties.PathOfCurrentWorkingFile = filePath;

            coll.ClearCollection();
            Close();
        }
Exemplo n.º 2
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.");
            }
        }
Exemplo n.º 3
0
        /// <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.");
            }
        }
        /// <summary>
        ///     Called when [show all titles for author button clicked].
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        private void OnShowAllTitlesSingleAuthorButton_Clicked(object sender, EventArgs e)
        {
            this._msgBox.NameOfMethod = MethodBase.GetCurrentMethod().Name;

            var dirAuthors = BookListPathsProperties.PathAuthorsDirectory;

            var cls1     = new CombinePathsClass();
            var filePath =
                cls1.CombineDirectoryPathWithFileName(dirAuthors, BookListPathsProperties.CurrentWorkingFileName);

            var cls2 = new BookDataCollection();

            cls2.ClearCollection();

            var cls3 = new InputClass();

            cls3.ReadTitlesFromFileLoop(filePath);

            var cls4 = new AuthorOperationsClass();

            cls4.ShowAllBookTitlesBySingleAuthorLoop();

            this.lstTiltes.Items.Clear();
        }