Exemple #1
0
        private void btnChange_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Are you Sure update category details?", "Veryfy", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                /*catch update details into databaseColumn*/
                DatabaseColumn updateDatabaseColumn = new DatabaseColumn();
                updateDatabaseColumn.category_id   = txtCategoryId.Text.ToString();
                updateDatabaseColumn.category_name = txtCategoryName.Text.ToString();


                Connector connector = new MYSQLDatabaseConnection();
                connector.establish();
                connector.SetData(updateDatabaseColumn);

                if (connector.ChangeCategory() == true)
                {
                    MessageBox.Show("Update compliete");

                    /*refresh main data grid view and show update company deteils*/
                    redioBtnCategoryId.Checked = true;
                    txtSearch.Text             = txtCategoryId.Text;
                    btnSearch.PerformClick();
                }
                else
                {
                    MessageBox.Show("Try again");
                }
            }
        }