Beispiel #1
0
 private void btnHapus_Click(object sender, EventArgs e)
 {
     using (var dao = new BarangDAO(sqlString))
     {
         dao.DeleteBarang(brg.Kode);
     }
     MessageBox.Show("Barang sudah terhapus", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
     this.Close();
 }
Beispiel #2
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (this.dgvDataBarang.SelectedRows.Count > 0 && MessageBox.Show("Hapus Item Data Terpilih ?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         try
         {
             using (var dao = new BarangDAO(Setting.GetConnectionString()))
             {
                 if (dao.DeleteBarang(this.dgvDataBarang.SelectedRows[0].Cells[0].Value.ToString().Trim()) > 0)
                 {
                     FrmAdminInterface_Load(null, null);
                 }
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }