protected override void Hapus() { var index = this.gridList.SelectedIndex; if (!base.IsSelectedItem(index, this.Text)) { return; } if (MsgHelper.MsgDelete()) { var karyawan = _listOfKaryawan[index]; using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0))) { var result = _bll.Delete(karyawan); if (result > 0) { GridListControlHelper.RemoveObject <Karyawan>(this.gridList, _listOfKaryawan, karyawan); ResetButton(); } else { MsgHelper.MsgDeleteError(); } } } }
public void DeleteTest() { var obj = new Karyawan { karyawan_id = "8b8c9988-e868-40d5-9972-42655cd28618" }; var result = _bll.Delete(obj); Assert.IsTrue(result != 0); var deletedObj = _bll.GetByID(obj.karyawan_id); Assert.IsNull(deletedObj); }