Exemplo n.º 1
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.dgvComisiones.CurrentRow != null)
                {
                    if (Util.ConfirmationMessage("¿Desea eliminar la comision de ONP seleccionada?") == false)
                    {
                        return;
                    }

                    var uiAdelato = (BE.UI.OnpComision) this.dgvComisiones.CurrentRow.DataBoundItem;

                    int  idOnpComision = uiAdelato.IdOnpComision;
                    bool rpta          = new LN.OnpComision().Eliminar(idOnpComision);

                    if (rpta == true)
                    {
                        Util.InformationMessage("Se eliminó la comisión de la ONP");
                        this.CargarListadoComisionesONP();
                    }
                }
            }
            catch (Exception ex)
            {
                Util.ErrorMessage(ex.Message);
            }
        }
Exemplo n.º 2
0
        public void CargarListadoComisionesONP()
        {
            try
            {
                var lstUiComisiones = new LN.OnpComision().Listar();
                this.txtNroRegistros.Text = lstUiComisiones.Count.ToString();

                var sorted = new SortableBindingList <BE.UI.OnpComision>(lstUiComisiones);
                this.dgvComisiones.DataSource = sorted;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txtAportePrc.Text.Trim().Length == 0)
                {
                    this.txtAportePrc.Focus();
                    throw new Exception("Ingrese el monto del aporte");
                }

                if (double.Parse(this.txtAportePrc.Text) == 0.0)
                {
                    this.txtAportePrc.Focus();
                    throw new Exception("Ingrese el monto del aporte");
                }

                int anho = int.Parse(this.cboAnho.SelectedValue.ToString());
                int mes  = int.Parse(this.cboMes.SelectedValue.ToString());

                var lnOnpComision = new LN.OnpComision();
                BE.UI.OnpComision beOnpComision = null;

                beOnpComision = lnOnpComision.Obtener(anho, mes);
                if (beOnpComision != null)
                {
                    throw new Exception("Existe una comisión de ONP para el periodo seleccionado");
                }

                beOnpComision                  = new BE.UI.OnpComision();
                beOnpComision.Anho             = anho;
                beOnpComision.MesNumero        = mes;
                beOnpComision.AportePorcentual = double.Parse(this.txtAportePrc.Text);
                if (lnOnpComision.Insertar(ref beOnpComision))
                {
                    Util.InformationMessage("Se registro la nueva comision de ONP");
                    this.CargarListadoComisionesONP();
                }
            }
            catch (Exception ex)
            {
                Util.ErrorMessage(ex.Message);
            }
        }