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

            if (dialogResult == DialogResult.Yes)
            {
                /*catch update details into databaseColumn*/
                DatabaseColumn updateDatabaseColumn = new DatabaseColumn();
                updateDatabaseColumn.company_id       = txtCompanyId.Text.ToString();
                updateDatabaseColumn.company_name     = txtCompanyName.Text.ToString();
                updateDatabaseColumn.company_address  = txtCompanyAddress.Text.ToString();
                updateDatabaseColumn.company_phone_no = txtCompanyPhoneNumber.Text.ToString();



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

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

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