Example #1
0
        /// <summary>
        /// Called when [series button click]. Set the is series property to
        /// <see langword="true"/> for series or <see langword="false"/> for not
        /// a series.
        /// </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 OnSeriesButton_Click(object sender, EventArgs e)
        {
            var validate = new ValidationClass();

            var len = txtSeries.SelectionLength;

            if (len <= 0)
            {
                return;
            }

            GetSelectedSeriesText();

            if (string.IsNullOrEmpty(BookDataProperties.NameOfBookSeries))
            {
                return;
            }

            txtSeries.Enabled = true;
            txtSeries.Text    = BookDataProperties.NameOfBookSeries;

            // If the title and series name match then exit operation.
            if (validate.ValidateTitleSeriesTextDoesNotMatch())
            {
                var msgBox = new MyMessageBoxClass();

                msgBox.Msg = "The book title name can not be the same as the book series name.";
                msgBox.ShowErrorMessageBox();
                return;
            }

            lblInfo.Text      = "SelectVolumeNumber";
            btnVolume.Enabled = true;
        }
        /// <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();
        }
Example #3
0
        /// <summary>
        /// Called when [save changes button click]. Save the changes made on
        /// the book information.
        /// </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 OnSaveChangesButton_Click(object sender, EventArgs e)
        {
            var fileOutput = new OutputClass();

            var validate = new ValidationClass();

            var msgBox = new MyMessageBoxClass();


            msgBox.NameOfMethod = MethodBase.GetCurrentMethod().Name;

            var coll = new global::BookList.Collections.BookDataCollection();

            if (coll.GetItemsCount() < 1)
            {
                return;
            }
            if (string.IsNullOrEmpty(txtTitle.Text.Trim()))
            {
                return;
            }

            if (BookDataProperties.BookSeries)
            {
                if (!validate.ValidateBookSeriesIsFormatted(txtBookInfo.Text))
                {
                    return;
                }
                if (!fileOutput.WriteBookTitleSeriesVolumeNamesToAuthorsFile(BookListPathsProperties
                                                                             .PathToCurrentAuthorsFile))
                {
                    msgBox.Msg = "Failed to complete save. Check over data and try again.";

                    msgBox.ShowErrorMessageBox();

                    return;
                }
            }

            if (!validate.ValidateBookNotSeriesIsFormatted(txtBookInfo.Text))
            {
                return;
            }

            if (!fileOutput.WriteAuthorsTitlesToFile(BookListPathsProperties.PathToCurrentAuthorsFile))
            {
                msgBox.Msg = "Failed to complete save. Check over data and try again.";
                msgBox.ShowErrorMessageBox();
                return;
            }

            ControlsStateAfterSuccessfulSave();
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="FormatUnformattedBookData" /> class.
        /// </summary>
        public UnformattedBookDataWin()
        {
            InitializeComponent();
            SetInitialControlState();

            var declaringType = MethodBase.GetCurrentMethod().DeclaringType;

            if (declaringType != null)
            {
                var msgBox = new MyMessageBoxClass();

                msgBox.NameOfClass = declaringType.Name;
            }
        }
Example #5
0
        /// <summary>Called when [volume number button click].
        /// Check that volume test does not match title or series text. Place volume name and or number into text box.</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 OnVolumeNumberButton_Click(object sender, EventArgs e)
        {
            var validate = new ValidationClass();

            var len = txtVolume.SelectionLength;

            if (len <= 0)
            {
                return;
            }

            GetSelectedBookVolumeText();

            if (string.IsNullOrEmpty(BookDataProperties.BookSeriesVolumeNumber))
            {
                return;
            }

            txtVolume.Enabled = true;
            txtVolume.Text    = BookDataProperties.BookSeriesVolumeNumber;

            if (validate.ValidateTitleVolumeTextDoesNotMatch())
            {
                var msgBox = new MyMessageBoxClass();

                msgBox.Msg = "The book title name can not be the same as the book volume.";
                msgBox.ShowErrorMessageBox();
                return;
            }

            if (validate.ValidateSeriesVolumeTextDoesNotMatch())
            {
                var msgBox = new MyMessageBoxClass();
                msgBox.Msg = "The book series name can not be the same as the book volume.";
                msgBox.ShowErrorMessageBox();
                return;
            }

            btnFormat.Enabled = true;
        }