Пример #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            var title = txtTitleUpdate.Text;

            if (string.IsNullOrEmpty(txtID.Text) || string.IsNullOrEmpty(title))
            {
                MessageBox.Show("ID or Title cannot be empty!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            var query = $"UPDATE {TableConstants.LibraryType} SET {TableConstants.LibraryTypeTitleStr} = '{title}'," +
                        $" {TableConstants.LibraryTypeSKUStr} = '{txtSKUUpdate.Text}'," +
                        $" {TableConstants.LibraryTypePriceStr} = '{txtPriceUpdate.Text}'," +
                        $" {TableConstants.LibraryTypeQuantityStr} = '{txtQuantityUpdate.Text}'," +
                        $" {TableConstants.LibraryTypeQuantityBrokenStr} = '{txtQuantityBrokenUpdate.Text}'," +
                        $" {TableConstants.LibraryTypeISBNCodeStr} = '{txtISBNCodeUpdate.Text}'," +
                        $" {TableConstants.LibraryTypePublishDateStr} = TO_DATE('{dtpPublishDateUpdate.Value.ToString(formatDateTime)}', '{formatDateTime}')," +
                        $" {TableConstants.LibraryTypePublisherIDStr} = '{cbxPublisherUpdate.SelectedValue}'," +
                        $" {TableConstants.LibraryTypeEditionIDStr} = '{cbxEditionUpdate.SelectedValue}'," +
                        $" {TableConstants.LibraryTypeEditorIDStr} = '{cbxEditorUpdate.SelectedValue}'," +
                        $" {TableConstants.LibraryTypeFormatIDStr} = '{cbxFormatUpdate.SelectedValue}'," +
                        $" {TableConstants.LibraryTypeLanguageIDStr} = '{cbxLanguageUpdate.SelectedValue}'," +
                        $" {TableConstants.LibraryTypeCategoryIDStr} = '{cbxCategoryUpdate.SelectedValue}'," +
                        $" {TableConstants.LibraryTypeCopyrightIDStr} = '{cbxCopyrightUpdate.SelectedValue}'," +
                        $" {TableConstants.LibraryTypeAuthorIDStr} = '{cbxAuthorUpdate.SelectedValue}', " +
                        $" {TableConstants.LibraryTypeStatusIDStr} = '{cbxStatusUpdate.SelectedValue}' " +
                        $" WHERE {TableConstants.LibraryTypeIDStr} = '{txtID.Text}'";

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

            // Load Search tab to search the update book by the updated Title
            LoadSearchTab(title);
        }
Пример #2
0
        private void btnUpdateAuthor_Click(object sender, EventArgs e)
        {
            var query = $"UPDATE LibraryTypeAuthor SET LibraryTypeAuthorName = '{txtAuthorNameUpdate.Text}', LibraryTypeAuthorEmail = '{txtAuthorEmailUpdate.Text}', LibraryTypeAuthorCountry = '{txtAuthorCountryUpdate.Text}' WHERE LibraryTypeAuthorID = {txtAuthorID.Text}";

            HandlingDataHelper.UpdateData(dgvAuthor, DataGridViewHeader.listOfColumnsAuthor, txtAuthorID.Text, "Author ID", query, "LibraryTypeAuthor");
        }
Пример #3
0
        private void btnUpdateCopyright_Click(object sender, EventArgs e)
        {
            var query = $"UPDATE LibraryTypeCopyright SET LibraryTypeCopyrightName = '{txtCopyrightNameUpdate.Text}' WHERE LibraryTypeCopyrightID = {txtCopyrightID.Text}";

            HandlingDataHelper.UpdateData(dgvCopyright, DataGridViewHeader.listOfColumnsCopyright, txtCopyrightID.Text, "Copyright ID", query, "LibraryTypeCopyright");
        }
Пример #4
0
        private void btnUpdateCategory_Click(object sender, EventArgs e)
        {
            var query = $"UPDATE LibraryTypeCategory SET LibraryTypeCategoryName = '{txtCategoryNameUpdate.Text}' WHERE LibraryTypeCategoryID = {txtCategoryID.Text}";

            HandlingDataHelper.UpdateData(dgvCategory, DataGridViewHeader.listOfColumnsCategory, txtCategoryID.Text, "Language ID", query, "LibraryTypeCategory");
        }
Пример #5
0
        private void btnUpdateLanguage_Click(object sender, EventArgs e)
        {
            var query = $"UPDATE LibraryTypeLanguage SET LibraryTypeLanguageShortCode = '{txtLanguageShortCodeUpdate.Text}', LibraryTypeLanguageLongCode = '{txtLanguageLongCodeUpdate.Text}' WHERE LibraryTypeLanguageID = {txtLanguageID.Text}";

            HandlingDataHelper.UpdateData(dgvLanguage, DataGridViewHeader.listOfColumnsLanguage, txtLanguageID.Text, "Language ID", query, "LibraryTypeLanguage");
        }
Пример #6
0
        private void btnUpdateFormat_Click(object sender, EventArgs e)
        {
            var query = $"UPDATE LibraryTypeFormat SET LibraryTypeFormatType = '{txtFormatTypeUpdate.Text}' WHERE LibraryTypeFormatID = {txtFormatID.Text}";

            HandlingDataHelper.UpdateData(dgvFormat, DataGridViewHeader.listOfColumnsFormat, txtFormatID.Text, "Format ID", query, "LibraryTypeFormat");
        }
Пример #7
0
        private void btnUpdateEditor_Click(object sender, EventArgs e)
        {
            var query = $"UPDATE LibraryTypeEditor SET LibraryTypeEditorName = '{txtEditorNameUpdate.Text}', LibraryTypeEditorEmail = '{txtEditorEmailUpdate.Text}', LibraryTypeEditorLocation = '{txtEditorLocationUpdate.Text}' WHERE LibraryTypeEditorID = {txtEditorID.Text}";

            HandlingDataHelper.UpdateData(dgvEditor, DataGridViewHeader.listOfColumnsEditor, txtEditorID.Text, "Editor ID", query, "LibraryTypeEditor");
        }
Пример #8
0
        private void btnUpdateEdition_Click(object sender, EventArgs e)
        {
            var query = $"UPDATE LibraryTypeEdition SET LibraryTypeEditionNumber = '{txtEditionNumberUpdate.Text}', LibraryTypeEditionDate = TO_DATE('{dtpEditionDateUpdate.Value.ToString(formatDateTime)}', '{formatDateTime}') WHERE LibraryTypeEditionID = {txtEditionID.Text}";

            HandlingDataHelper.UpdateData(dgvEdition, DataGridViewHeader.listOfColumnsEdition, txtEditionID.Text, "Edition ID", query, "LibraryTypeEdition");
        }
Пример #9
0
        private void btnUpdatePublisher_Click(object sender, EventArgs e)
        {
            var query = $"UPDATE LibraryTypePublisher SET LibraryTypePublisherName = '{txtPublisherNameUpdate.Text}', LibraryTypePublisherLocation = '{txtPublisherLocationUpdate.Text}' WHERE LibraryTypePublisherID = {txtPublisherID.Text}";

            HandlingDataHelper.UpdateData(dgvPublisher, DataGridViewHeader.listOfColumnsPublisher, txtPublisherID.Text, "Publisher ID", query, "LibraryTypePublisher");
        }