コード例 #1
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.dgvLiquidaciones.CurrentRow != null)
                {
                    if (Util.ConfirmationMessage("¿Desea eliminar la liquidacion seleccionada?") == false)
                    {
                        return;
                    }

                    var uiLiquidacion = (BE.UI.Liquidacion) this.dgvLiquidaciones.CurrentRow.DataBoundItem;

                    int  idLiquidacion = uiLiquidacion.IdLiquidacion;
                    bool rpta          = new LN.Liquidacion().Eliminar(idLiquidacion);

                    if (rpta == true)
                    {
                        Util.InformationMessage("Se eliminó la liquidacion");
                        this.CargarListadoLiquidaciones();
                    }
                }
            }
            catch (Exception ex)
            {
                Util.ErrorMessage(ex.Message);
            }
        }
コード例 #2
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                #region Validaciones
                if (this.cboEmpleado.SelectedIndex == 0)
                {
                    this.cboEmpleado.Focus();
                    throw new Exception("Seleccione un empleado");
                }

                if (this.cboMotivoCese.SelectedIndex == 0)
                {
                    this.cboMotivoCese.Focus();
                    throw new Exception("Seleccione un motivo de cese");
                }
                #endregion

                #region Guardar

                //this.beLiquidacion.Fecha = this.dtpFecha.Value;
                //this.beLiquidacion.CodigoEmpleado = this.cboEmpleado.SelectedValue.ToString();
                //this.beLiquidacion.CodigoTipo = this.cboTipos.SelectedValue.ToString();
                //this.beLiquidacion.Numero = this.txtNumero.Text;
                //this.beLiquidacion.Monto = double.Parse(this.txtMonto.Text);
                //this.beLiquidacion.IdBanco = int.Parse(this.cboBancos.SelectedValue.ToString());

                bool   rpta       = false;
                string msg        = "";
                var    lnAdelanto = new LN.Liquidacion();
                if (this.uiLiquidacion.IdLiquidacion == 0) //Nuevo
                {
                    rpta = lnAdelanto.Insertar(ref this.uiLiquidacion);
                    if (true)
                    {
                        msg = "Se registro la nueva liquidación";
                    }
                }
                else  //Actualizar
                {
                    rpta = lnAdelanto.Actualizar(this.uiLiquidacion);
                    if (true)
                    {
                        msg = "Se actualizo la liquidación";
                    }
                }

                if (rpta == true)
                {
                    Util.InformationMessage(msg);
                    this.frmList.CargarListadoLiquidaciones();
                    this.Close();
                }

                #endregion
            }
            catch (Exception ex)
            {
                Util.ErrorMessage(ex.Message);
            }
        }