예제 #1
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Are you Sure delete category?", "Veryfy", MessageBoxButtons.YesNo);

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

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

                if (connector.RemoveCategory() == true)
                {
                    MessageBox.Show("Delete compliete");

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