Example #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtTitle.Text))
            {
                MessageBox.Show("Title cannot be empty!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            var title = txtTitle.Text;
            var query = $"INSERT INTO LibraryType (LibraryTypeTitle," +
                        $" LibraryTypeSKU," +
                        $" LibraryTypePrice," +
                        $" LibraryTypeQuantity," +
                        $" LibraryTypeISBNCode," +
                        $" LibraryTypePublishDate," +
                        $" LibraryTypePublisherID," +
                        $" LibraryTypeEditionID," +
                        $" LibraryTypeEditorID," +
                        $" LibraryTypeFormatID," +
                        $" LibraryTypeLanguageID," +
                        $" LibraryTypeCategoryID," +
                        $" LibraryTypeCopyrightID," +
                        $" LibraryTypeAuthorID) VALUES ('{title}', '{txtSKU.Text}', '{txtPrice.Text}', " +
                        $"'{txtQuantity.Text}', '{txtISBNCode.Text}', TO_DATE('{dtpPublishDate.Value.ToString(formatDateTime)}', '{formatDateTime}'), " +
                        $" '{cbxPublisher.SelectedValue}', '{cbxEdition.SelectedValue}', '{cbxEditor.SelectedValue}', " +
                        $" '{cbxFormat.SelectedValue}', '{cbxLanguage.SelectedValue}', '{cbxCategory.SelectedValue}', " +
                        $" '{cbxCopyright.SelectedValue}', '{cbxAuthor.SelectedValue}')";

            HandlingDataHelper.AddData(null, null, title, "Library Type Title", query, "LibraryType", false);

            // Load Search tab to search the created book by the created Title
            LoadSearchTab(title);
        }
Example #2
0
        private void btnAddAuthor_Click(object sender, EventArgs e)
        {
            var query = $"INSERT INTO LibraryTypeAuthor (LibraryTypeAuthorName, LibraryTypeAuthorEmail, LibraryTypeAuthorCountry) VALUES ('{txtAuthorName.Text}', '{txtAuthorEmail.Text}', '{txtAuthorCountry.Text}')";

            HandlingDataHelper.AddData(dgvAuthor, DataGridViewHeader.listOfColumnsAuthor, txtAuthorName.Text, "Author Name", query, "LibraryTypeAuthor");
        }
Example #3
0
        private void btnAddCopyright_Click(object sender, EventArgs e)
        {
            var query = $"INSERT INTO LibraryTypeCopyright (LibraryTypeCopyrightName) VALUES ('{txtCopyrightName.Text}')";

            HandlingDataHelper.AddData(dgvCopyright, DataGridViewHeader.listOfColumnsCopyright, txtCopyrightName.Text, "Copyright Name", query, "LibraryTypeCopyright");
        }
Example #4
0
        private void btnAddCategory_Click(object sender, EventArgs e)
        {
            var query = $"INSERT INTO LibraryTypeCategory (LibraryTypeCategoryName) VALUES ('{txtCategoryName.Text}')";

            HandlingDataHelper.AddData(dgvCategory, DataGridViewHeader.listOfColumnsCategory, txtCategoryName.Text, "Language Name", query, "LibraryTypeCategory");
        }
Example #5
0
        private void btnAddLanguage_Click(object sender, EventArgs e)
        {
            var query = $"INSERT INTO LibraryTypeLanguage (LibraryTypeLanguageShortCode, LibraryTypeLanguageLongCode) VALUES ('{txtLanguageShortCode.Text}', '{txtLanguageLongCode.Text}')";

            HandlingDataHelper.AddData(dgvLanguage, DataGridViewHeader.listOfColumnsLanguage, txtLanguageShortCode.Text, "Language Short Code", query, "LibraryTypeLanguage");
        }
Example #6
0
        private void btnAddFormat_Click(object sender, EventArgs e)
        {
            var query = $"INSERT INTO LibraryTypeFormat (LibraryTypeFormatType) VALUES ('{txtFormatType.Text}')";

            HandlingDataHelper.AddData(dgvFormat, DataGridViewHeader.listOfColumnsFormat, txtFormatType.Text, "Format Name", query, "LibraryTypeFormat");
        }
Example #7
0
        private void btnAddEditor_Click(object sender, EventArgs e)
        {
            var query = $"INSERT INTO LibraryTypeEditor (LibraryTypeEditorName, LibraryTypeEditorEmail, LibraryTypeEditorLocation) VALUES ('{txtEditorName.Text}', '{txtEditorEmail.Text}', '{txtEditorLocation.Text}')";

            HandlingDataHelper.AddData(dgvEditor, DataGridViewHeader.listOfColumnsEditor, txtEditorName.Text, "Editor Name", query, "LibraryTypeEditor");
        }
Example #8
0
        private void btnAddEdition_Click(object sender, EventArgs e)
        {
            var query = $"INSERT INTO LibraryTypeEdition (LibraryTypeEditionNumber, LibraryTypeEditionDate) VALUES ('{txtEditionNumber.Text}', TO_DATE('{dtpEditionDate.Value.ToString(formatDateTime)}', '{formatDateTime}'))";

            HandlingDataHelper.AddData(dgvEdition, DataGridViewHeader.listOfColumnsEdition, txtEditionNumber.Text, "Edition Name", query, "LibraryTypeEdition");
        }
Example #9
0
        private void btnAddPublisher_Click(object sender, EventArgs e)
        {
            var query = $"INSERT INTO LibraryTypePublisher (LibraryTypePublisherName, LibraryTypePublisherLocation) VALUES ('{txtPublisherName.Text}', '{txtPublisherLocation.Text}')";

            HandlingDataHelper.AddData(dgvPublisher, DataGridViewHeader.listOfColumnsPublisher, txtPublisherName.Text, "Publisher Name", query, "LibraryTypePublisher");
        }