private void BtnEliminar_Click(object sender, EventArgs e) { if (metroGrid1.SelectedRows.Count > 0) { int?idEntity = GetId(); Entities.Proveedor entity = bll.GetById(Convert.ToInt32(idEntity)); try { DialogResult confirmation = new Notifications.FrmQuestion(Helps.Language.SearchValue("preguntaEliminar")).ShowDialog(); if (confirmation == DialogResult.OK) { bll.Delete(Convert.ToInt32(idEntity)); InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Delete, 1, this.GetType().FullName, MethodInfo.GetCurrentMethod().Name, "Proveedor: " + entity.nombre, "", "")); RefrescarTabla(); Notifications.FrmSuccess.SuccessForm(Helps.Language.SearchValue("eliminadoOK")); } } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.DeleteError, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Proveedor: " + entity.nombre, ex.StackTrace, ex.Message)); RefrescarTabla(); Notifications.FrmError.ErrorForm(Helps.Language.SearchValue("eliminadoError") + "\n" + ex.Message); } RefrescarTabla(); } else { Notifications.FrmInformation.InformationForm(Helps.Language.SearchValue("infoSelecEliminar")); } }
public bool Delete(int ID) { ProveedorBLL ProveedorBLL = new ProveedorBLL(); return(ProveedorBLL.Delete(ID)); }