private void btnDelete_Click(object sender, RoutedEventArgs e) { if (data.Id != 0) { if (!BLL.UserAccount.AllowDelete(FormName)) { MessageBox.Show(string.Format(Message.PL.DenyDelete, FormName)); } else { if (MessageBox.Show("Do you want to Delete this record?", "DELETE", MessageBoxButton.YesNo) != MessageBoxResult.No) { if (data.Delete() == true) { MessageBox.Show("Deleted"); data.Clear(); } ; } } } else { MessageBox.Show("No Records to Delete"); } }
public ActionResult CUD(Products newProduct, string CreateBtn, string UpdateBtn, string DeleteBtn) { Products Producto; //var Proxy = new Proxy(); var Proxy = new BLL.Product(); ActionResult Result = View(); if (CreateBtn != null) { Producto = Proxy.Create(newProduct); if (Producto != null) { Result = RedirectToAction("CUD", new { id = Producto.ProductID }); } } else if (UpdateBtn != null) //modificacion de producto { var IsUpdate = Proxy.Update(newProduct); if (IsUpdate) { Result = Content("El producto se ha actualizado"); } } else if (DeleteBtn != null) //eliminar producto { var DeletedProduct = Proxy.Delete(newProduct.ProductID); if (DeletedProduct) { Result = Content("El producto se ha eliminado"); } } return(Result); }
private void onClientEvents() { BLL.FMCGHubClient.FMCGHub.On <BLL.Product>("Product_Save", (prod) => { this.Dispatcher.Invoke(() => { prod.Save(true); }); }); BLL.FMCGHubClient.FMCGHub.On("Product_Delete", (Action <int>)((pk) => { this.Dispatcher.Invoke((Action)(() => { BLL.Product prod = new BLL.Product(); prod.Find((int)pk); prod.Delete((bool)true); })); })); }