Example #1
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.dgvCts.CurrentRow != null)
                {
                    if (Util.ConfirmationMessage("¿Desea eliminar el registro seleccionado?") == false)
                    {
                        return;
                    }

                    var uiAdelato = (BE.UI.CTS) this.dgvCts.CurrentRow.DataBoundItem;

                    int  idCts = uiAdelato.Id;
                    bool rpta  = new LN.CTS().Eliminar(idCts);

                    if (rpta == true)
                    {
                        Util.InformationMessage("Se eliminó el registro seleccionado");
                        this.CargarListadoCts();
                    }
                }
            }
            catch (Exception ex)
            {
                Util.ErrorMessage(ex.Message);
            }
        }
Example #2
0
        public void CargarListadoCts()
        {
            try
            {
                var lstUiCts = new LN.CTS().Listar();

                var sorted = new SortableBindingList <BE.UI.CTS>(lstUiCts);

                this.dgvCts.DataSource = sorted;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
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.txtEmpleadoCodigo.Text.Trim().Length == 0)
                {
                    this.cboEmpleado.Focus();
                    throw new Exception("Seleccione un empleado");
                }

                if (this.txtDepositoMonto.Text.Trim().Length == 0)
                {
                    this.txtDepositoMonto.Focus();
                    throw new Exception("Ingrese el monto del cts");
                }

                if (double.Parse(this.txtDepositoMonto.Text) == 0.0)
                {
                    this.txtDepositoMonto.Focus();
                    throw new Exception("Ingrese el monto del cts");
                }
                #endregion

                #region Guardar

                //falta

                bool   rpta  = false;
                string msg   = "";
                var    lnCts = new LN.CTS();
                if (this.uiCts.Id == 0) //Nuevo
                {
                    rpta = lnCts.Insertar(ref this.uiCts);
                    if (true)
                    {
                        msg = "Se registro la CTS";
                    }
                }
                else  //Actualizar
                {
                    rpta = lnCts.Actualizar(this.uiCts);
                    if (true)
                    {
                        msg = "Se actualizo la CTS";
                    }
                }

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

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