private void buttonHapus_Click(object sender, EventArgs e)
        {
            DialogResult confirm = MessageBox.Show("Data Pelanggan Akan Dihapus. Anda Yakin ?", "Konfirmasi", MessageBoxButtons.YesNo);

            if (confirm == DialogResult.Yes)
            {
                Pelanggan pelanggan = new Pelanggan(
                    textBoxKodePelanggan.Text,
                    textBoxNamaPelanggan.Text,
                    textBoxAlamat.Text,
                    textBoxTelepon.Text);

                string hapus = pelanggan.Delete();

                if (hapus == "1")
                {
                    MessageBox.Show("Data Pelanggan Telah Dihapus", "Info");
                    FormDaftarPelanggan frm = (FormDaftarPelanggan)Owner;
                    frm.FormDaftarPelanggan_Load(buttonHapus, e);

                    buttonKosongi_Click(buttonHapus, e);
                }
                else
                {
                    MessageBox.Show("Gagal Menghapus Data Pelanggan, Error : " + hapus);
                }
            }
        }
Esempio n. 2
0
        public Task <bool> Delete(int id)
        {
            var data = new Pelanggan(id);

            return(data.Delete());
        }