private void buttonSimpan_Click(object sender, EventArgs e) { try { Supplier supplier = new Supplier(textBoxKodeSupplier.Text, textBoxNamaSupplier.Text, textBoxAlamat.Text); supplier.Update(); MessageBox.Show("Data Supplier Berhasil Diubah", "Info"); FormDaftarSupplier frm = (FormDaftarSupplier)Owner; frm.FormDaftarSupplier_Load(buttonSimpan, e); buttonKosongi_Click(buttonSimpan, e); textBoxKodeSupplier.Focus(); } catch (Exception error) { MessageBox.Show("Data Gagal Disimpan, Error : " + error.Message, "Warning"); } }
private void buttonSimpan_Click(object sender, EventArgs e) { try { Supplier supplier = new Supplier(textBoxKodeSupplier.Text, textBoxNamaSupplier.Text, textBoxAlamat.Text); supplier.Insert(); MessageBox.Show("Data Supplier Berhasil Ditambahkan", "Info"); FormDaftarSupplier frm = (FormDaftarSupplier)Owner; frm.FormDaftarSupplier_Load(buttonSimpan, e); textBoxKodeSupplier.Text = supplier.GeneratePrimaryKey(); buttonKosongi_Click(buttonSimpan, e); } catch (Exception error) { MessageBox.Show("Gagal Menambahkan Data Supplier, Error : " + error.Message, "Warning"); } }
private void buttonHapus_Click(object sender, EventArgs e) { DialogResult confirm = MessageBox.Show("Data Supplier Akan Dihapus. Anda Yakin ?", "Konfirmasi", MessageBoxButtons.YesNo); if (confirm == DialogResult.Yes) { Supplier supplier = new Supplier(textBoxKodeSupplier.Text, textBoxNamaSupplier.Text, textBoxAlamat.Text); string hapus = supplier.Delete(); if (hapus == "1") { MessageBox.Show("Data Supplier Berhasil Dihapus", "Info"); FormDaftarSupplier frm = (FormDaftarSupplier)Owner; frm.FormDaftarSupplier_Load(buttonHapus, e); buttonKosongi_Click(buttonHapus, e); } else { MessageBox.Show("Data Supplier Gagal Dihapus, Error : " + hapus, "Warning"); } } }