Beispiel #1
0
 private void materialFlatButton1_Click(object sender, EventArgs e)
 {
     if (_table == "pegawai")
     {
         Pegawai p         = DbQuery.GetPegawaiById(_id);
         var     msgResult = MessageBox.Show("Data " + p.nama + " Akan Dihapus!!!", "Confirm Delete!!", MessageBoxButtons.YesNo);
         if (msgResult == DialogResult.Yes)
         {
             int    result = DbQuery.DeletePegawai(_id);
             string msg    = "Terjadi Kesalahan Pada Saat Menghapus Data";
             if (result > 0)
             {
                 msg = "Berhasil! Data Telah Terhapus";
             }
             MessageBox.Show(msg);
             if (Application.OpenForms["Form1"] != null)
             {
                 (Application.OpenForms["Form1"] as Form1).RefPegawai();
             }
             this.Close();
         }
     }
 }