private async void BtnDelete_Click(object sender, RoutedEventArgs e) { if (!CheckSelectDelete()) { return; } var selectItem = _productSearchData[DgdData.SelectedIndex]; Utility.MyMessageBox("هشدار", "آیا از حذف اطمینان دارید؟ ", "Warning.png", false); if (!Utility.YesNo) { return; } try { var deleteProduct = new DProduct { DId = selectItem.Id }; await Task.Run(() => deleteProduct.Delete()); } catch (Exception exception) { Utility.MyMessageBox("خطا در بانک اطلاعاتی", "خطا در حذف اطلاعات\n" + exception.Message); return; } Window_Loaded(null, null); Utility.Message("پیام", "اطلاعات با موفقیت حذف گردید", "Correct.png"); }
public static string Delete(int id) { DProduct Obj = new DProduct(); Obj.Id = id; return(Obj.Delete(Obj)); }
public void Delete(EProduct eProduct) { dProduct.Delete(eProduct); if (dProduct.ExistsReference()) { Message = string.Format("El Producte '{0}' tiene referencias en el Sistema, no se puede eliminar el registro.", eProduct.CodeProduct); throw new Exception(Message); } eProduct.Audit.TypeEvent = "Delete"; bAudit.Insert(eProduct.Audit); }