Beispiel #1
0
        /// <summary>
        /// The OnSaveRecordButton_Clicked
        /// </summary>
        /// <param name="sender">The sender<see cref="object"/>The source of the event.</param>
        /// <param name="e">The e<see cref="EventArgs"/>Instance containing the event data.</param>
        private void OnSaveRecordButton_Clicked(object sender, EventArgs e)
        {
            // TODO: need to put multiple autors to gether before creating author names.
            // TODO: need to check file does not exist then after creating file does exist.

            var dirAuthors = AuthorsDirectoryFilesClass.GetPathToAuthorsDirectory();

            var fileName = this.CreateAuthorsFileName();

            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }
            if (!Directory.Exists(dirAuthors))
            {
                return;
            }

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirAuthors, fileName);

            if (!File.Exists(filePath))
            {
                File.Create(filePath).Dispose();
            }
        }
Beispiel #2
0
        /// <summary>
        /// The OnSaveRecordButton_Clicked
        /// </summary>
        /// <param name="sender">The sender<see cref="object"/>The source of the event.</param>
        /// <param name="e">The e<see cref="EventArgs"/>Instance containing the event data.</param>
        private void OnSaveRecordButton_Clicked(object sender, EventArgs e)
        {
            var dirAuthors = AuthorsDirectoryFilesClass.GetPathToAuthorsDirectory();

            var authorOp = new AuthorsTextOperations();
            var fileName = string.Empty;

            if (this.rbtnOneAuthor.Checked)
            {
                fileName = authorOp.BookAuthorName(this.txtFirstAuthor.Text);
            }
            else if (this.rbtnTwoAuthors.Checked)
            {
                fileName = authorOp.BookAuthorName(this.txtFirstAuthor.Text, this.txtSecondAuthor.Text);
            }
            else if (this.rbtnThreeAuthors.Checked)
            {
                fileName = authorOp.BookAuthorName(this.txtFirstAuthor.Text, this.txtSecondAuthor.Text, this
                                                   .txtThirdAuthor.Text);
            }

            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }
            if (!Directory.Exists(dirAuthors))
            {
                return;
            }

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirAuthors, fileName);

            DirectoryFileOperationsClass.CreateNewFile(filePath);
        }
        private void GetUnformattedDataFrom()
        {
            // TODO: Check to see if any unformatted data for the selected author
            // TODO: Only show unformatted data for author selected.
            // TODO; Instead of list box use next previous first last.

            var dirPath = BookListPropertiesClass.PathToAuthorsDirectory;

            if (!AuthorsFileNamesCollection.ContainsItem(BookListPropertiesClass.AuthorsNameCurrent))
            {
                return;
            }

            var index = AuthorsFileNamesCollection.GetItemIndex(BookListPropertiesClass.AuthorsNameCurrent);

            var fileName = AuthorsFileNamesCollection.GetItemAt(index);

            Debug.Assert(dirPath != null, nameof(dirPath) + " != null");
            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirPath, fileName);

            this.GetAuthorsName(fileName);

            if (!DataStorageOperationsClass.AddToBackUpList(filePath))
            {
                return;
            }
        }
        private void OnTitleSearchButtonClicked(object sender, EventArgs e)
        {
            var dirAuthors = AuthorsDirectoryFilesClass.GetPathToAuthorsDirectory();

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirAuthors,
                                                                                         BookListPropertiesClass.CurrentWorkingFileName);
        }
        private static void GetRawDataFromFile()
        {
            var dirPath = BookListPropertiesClass.PathToAuthorsDirectory;

            var fileName = AuthorsFileNamesCollection.GetItemAt(0);

            Debug.Assert(dirPath != null, nameof(dirPath) + " != null");
            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirPath, fileName);

            if (!DataStorageOperationsClass.AddRawDataReadFromFileToRawDataCollection(filePath)) return;
        }
Beispiel #6
0
        private static void GetRawDataFromFile()
        {
            var datStore = new DataStorageOperationsClass();
            var dirpath  = BookListPropertiesClass.PathToAuthorsDirectory;
            var fileName = AuthorsFileNamesCollection.GetItemAt(0);
            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirpath, fileName);

            if (!datStore.AddRawDataReadFromFileToRawDataCollection(filePath))
            {
                return;
            }
        }
        /// <summary>
        /// The OnSaveRecordButton_Clicked
        /// </summary>
        /// <param name="sender">The sender<see cref="object"/>The source of the event.</param>
        /// <param name="e">The e<see cref="EventArgs"/>Instance containing the event data.</param>
        private void OnSaveRecordButton_Clicked(object sender, EventArgs e)
        {
            var dirAuthors = AuthorsDirectoryFilesClass.GetPathToAuthorsDirectory();

            var fileName = this.CreateAuthorsFileName();

            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirAuthors, fileName);
        }
Beispiel #8
0
        private void SearchBookTitlesAllAuthors()
        {
            AuthorsDirectoryFilesClass.GetAllAuthorFilePathsContainedInAuthorDirectory();

            for (var i = 0; i < AuthorsFileNamesCollection.ItemsCount(); i++)
            {
                var fileName   = AuthorsFileNamesCollection.GetItemAt(i);
                var dirAuthors = AuthorsDirectoryFilesClass.GetPathToAuthorsDirectory();
                var filePath   = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirAuthors,
                                                                                               fileName);
                this.txtAuthorName.Text = fileName;
            }
        }
        private void GetUnformattedDataFrom()
        {
            var dirPath = BookListPropertiesClass.PathToAuthorsDirectory;

            if (!AuthorsFileNamesCollection.ContainsItem(BookListPropertiesClass.AuthorsNameCurrent)) return;

            var index = AuthorsFileNamesCollection.GetItemIndex(BookListPropertiesClass.AuthorsNameCurrent);

            var fileName = AuthorsFileNamesCollection.GetItemAt(index);

            Debug.Assert(dirPath != null, nameof(dirPath) + " != null");
            this.filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirPath, fileName);

            this.GetAuthorsName(fileName);
        }
        private void SearchBookTitlesBySingleAuthor()
        {
            var dirAuthors = AuthorsDirectoryFilesClass.GetPathToAuthorsDirectory();

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirAuthors,
                                                                                         BookListPropertiesClass.CurrentWorkingFileName);

            TitleNamesCollection.ClearCollection();

            FileInputClass.ReadTitlesFromFile(filePath);

            this.FindTitlesInString();

            if (this.lstTiltes.Items.Count < 1)
            {
                this.lstTiltes.Items.Add("No titles with this search criteria were found.");
            }
        }
        private void OnTitleSearchButtonClicked(object sender, EventArgs e)
        {
            var dirAuthors = AuthorsDirectoryFilesClass.GetPathToAuthorsDirectory();

            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirAuthors,
                BookListPropertiesClass.CurrentWorkingFileName);

            TitleNamesCollection.ClearCollection();

            FileInputClass.ReadTitlesFromFile(filePath);

            this.FindTitlesInString();

            if (this.lstTiltes.Items.Count < 1)
            {
                this.lstTiltes.Items.Add( "No titles wit
            }
        }
        private void SearchBookTitlesAllAuthors()
        {
            AuthorsDirectoryFilesClass.GetAllAuthorFilePathsContainedInAuthorDirectory();

            TitleNamesCollection.ClearCollection();
            this.lstTiltes.

            for (var i = 0; i < AuthorsFileNamesCollection.ItemsCount(); i++)
            {
                var fileName   = AuthorsFileNamesCollection.GetItemAt(i);
                var dirAuthors = AuthorsDirectoryFilesClass.GetPathToAuthorsDirectory();
                var filePath   = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirAuthors,
                                                                                               fileName);
                this.txtAuthorName.Text = fileName;

                FileInputClass.ReadTitlesFromFile(filePath);
                this.FindTitlesInString();
            }
        }
        private string GetUnformattedDataFrom()
        {
            // TODO: Check to see if any unformatted data for the selected author
            // TODO: Only show unformatted data for author selected.

            var dirPath = BookListPropertiesClass.PathToAuthorsDirectory;

            if (!AuthorsFileNamesCollection.ContainsItem(BookListPropertiesClass.AuthorsNameCurrent))
            {
                return(string.Empty);
            }

            var index = AuthorsFileNamesCollection.GetItemIndex(BookListPropertiesClass.AuthorsNameCurrent);

            var fileName = AuthorsFileNamesCollection.GetItemAt(index);

            Debug.Assert(dirPath != null, nameof(dirPath) + " != null");
            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirPath, fileName);

            this.GetAuthorsName(fileName);

            return(filePath);
        }
        private void GetRawDataFromFile()
        {
            var dirPath = BookListPropertiesClass.PathToAuthorsDirectory;

            if (!AuthorsFileNamesCollection.ContainsItem(BookListPropertiesClass.AuthorsNameCurrent))
            {
                return;
            }

            var index = AuthorsFileNamesCollection.GetItemIndex(BookListPropertiesClass.AuthorsNameCurrent);

            var fileName = AuthorsFileNamesCollection.GetItemAt(index);

            Debug.Assert(dirPath != null, nameof(dirPath) + " != null");
            var filePath = DirectoryFileOperationsClass.CombineDirectoryPathWithFileName(dirPath, fileName);

            this.GetAuthorsName(fileName);

            if (!DataStorageOperationsClass.AddRawDataReadFromFileToRawDataCollection(filePath))
            {
                return;
            }
        }