private void btnEliminar_Click(object sender, EventArgs e) { try { if (this.dgvGratificaciones.CurrentRow != null) { if (Util.ConfirmationMessage("¿Desea eliminar la gratificacion seleccionada?") == false) { return; } var uiGratificacion = (BE.UI.Gratificacion) this.dgvGratificaciones.CurrentRow.DataBoundItem; int idGratificacion = uiGratificacion.Id; bool rpta = new LN.Gratificacion().Eliminar(idGratificacion); if (rpta == true) { Util.InformationMessage("Se eliminó la gratificacion"); this.CargarGratificaciones(); } } } catch (Exception ex) { Util.ErrorMessage(ex.Message); } }
public void CargarGratificaciones() { try { var lstUiGratificaciones = new LN.Gratificacion().Listar(false); var sorted = new SortableBindingList <BE.UI.Gratificacion>(lstUiGratificaciones); this.dgvGratificaciones.DataSource = sorted; int cntRegistros = lstUiGratificaciones.Count; double sumTotBruto = lstUiGratificaciones.Sum(x => x.GratificacionBruta); double sumTotNeto = lstUiGratificaciones.Sum(x => x.GratificacionNeta); double sumTotPagar = lstUiGratificaciones.Sum(x => x.GratificacionPago); this.txtNroRegistros.Text = cntRegistros.ToString(); this.txtTotalBruto.Text = sumTotBruto.ToString("N2"); this.txtTotalNeto.Text = sumTotNeto.ToString("N2"); this.txtTotalPagar.Text = sumTotPagar.ToString("N2"); } catch (Exception ex) { throw ex; } }