/// <summary> /// elimina un registro seleccionado /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnEliminar_Click(object sender, EventArgs e) { if (metroGrid1.SelectedRows.Count > 0) { int idCat = GetId(); Entities.Categoria categoria = bll.GetById(idCat); try { DialogResult confirmation = new Notifications.FrmQuestion(Language.SearchValue("preguntaEliminar")).ShowDialog(); if (confirmation == DialogResult.OK) { bll.Delete(idCat); InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Delete, 1, this.GetType().FullName, MethodInfo.GetCurrentMethod().Name, "Categoria: " + categoria.categoria, "", "")); RefrescarTabla(); Notifications.FrmSuccess.SuccessForm(Language.SearchValue("eliminadoOK")); } } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.DeleteError, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Categoria: " + categoria.categoria, ex.StackTrace, ex.Message)); RefrescarTabla(); Notifications.FrmError.ErrorForm(Language.SearchValue("eliminadoError") + "\n" + ex.Message); } } else { Notifications.FrmInformation.InformationForm(Language.SearchValue("XinfoSelecEliminar")); } }
private void BtnAnular_Click(object sender, EventArgs e) { if (metroGrid1.SelectedRows.Count > 0) { int?idEntity = GetId(); Entities.Doc_cabecera_egreso entity = bllCabecera.GetById(Convert.ToInt32(idEntity)); entity.listDetalle = bllDetalle.ListDetallesByCabecera(entity.id); try { DialogResult confirmation = new Notifications.FrmQuestion(Helps.Language.SearchValue("preguntaEliminar")).ShowDialog(); if (confirmation == DialogResult.OK) { bllCabecera.Anular(entity); InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Delete, 1, this.GetType().FullName, MethodInfo.GetCurrentMethod().Name, "Ingreso anulado: " + entity.factura, "", "")); 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, "Ingreso anulado: " + entity.factura, ex.StackTrace, ex.Message)); RefrescarTabla(); Notifications.FrmError.ErrorForm(Helps.Language.SearchValue("eliminadoError") + "\n" + ex.Message); } RefrescarTabla(); } else { Notifications.FrmInformation.InformationForm(Helps.Language.info["infoSelecEliminar"]); } }
private void BtnEliminar_Click(object sender, EventArgs e) { if (metroGrid1.SelectedRows.Count > 0) { string idEntity = GetId(); Entities.UFP.Usuario entity = BLL.UFP.Usuario.GetAdapted(idEntity); try { DialogResult confirmation = new Notifications.FrmQuestion(Helps.Language.SearchValue("preguntaEliminar")).ShowDialog(); if (confirmation == DialogResult.OK) { //bll.Delete(Convert.ToInt32(idEntity)); BLL.UFP.Usuario.Delete(entity); InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Delete, 1, this.GetType().FullName, MethodInfo.GetCurrentMethod().Name, "Usuario: " + 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, "Usuario: " + 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")); } }