Exemplo n.º 1
0
        private void CargarDatos()
        {
            try
            {
                PagadoraLineaBE IEntity = new PagadoraLineaBE();
                IEntity.OPCION = 6;
                DataSet dsSector = new PagadoraLineaBL().ProcesarPagadoraLinea(IEntity);
                dgvSector.DataSource = dsSector.Tables[0];

                decimal AcImporte   = 0;
                decimal AcUtilizado = 0;
                decimal AcSaldo     = 0;

                foreach (DataGridViewRow row in dgvSector.Rows)
                {
                    AcImporte   = AcImporte + (!string.IsNullOrEmpty(row.Cells["Linea"].Value.ToString()) ? Convert.ToDecimal(row.Cells["Linea"].Value) : 0);
                    AcUtilizado = AcUtilizado + (!string.IsNullOrEmpty(row.Cells["Utilizado"].Value.ToString()) ? Convert.ToDecimal(row.Cells["Utilizado"].Value) : 0);
                    AcSaldo     = AcSaldo + (!string.IsNullOrEmpty(row.Cells["Saldo"].Value.ToString()) ? Convert.ToDecimal(row.Cells["Saldo"].Value) : 0);
                }

                lblTotalImporte.Text   = AcImporte.ToString("N0");
                lblTotalUtilizado.Text = AcUtilizado.ToString("N0");
                lblTotalSaldo.Text     = AcSaldo.ToString("N0");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        private void CargarDatos()
        {
            try
            {
                DataSet         dsPagadoraLinea = new DataSet();
                PagadoraLineaBE PagadoraLineaBE = new PagadoraLineaBE()
                {
                    OPCION     = 1,
                    USUARIO    = General.General.GetCodigoUsuario,
                    IdPagadora = IdPagadora
                };

                dsPagadoraLinea = PagadoraLineaBL.ProcesarPagadoraLinea(PagadoraLineaBE);

                if (dsPagadoraLinea.Tables[0].Rows.Count > 0)
                {
                    cboIdMoneda_tt.SelectedValue = dsPagadoraLinea.Tables[0].Rows[0]["IdMoneda_tt"];
                    txtnLinea.Text      = Convert.ToDecimal(dsPagadoraLinea.Tables[0].Rows[0]["nLinea"]).ToString("N2");
                    txtnNuevaLinea.Text = Convert.ToDecimal(dsPagadoraLinea.Tables[0].Rows[0]["nLinea"]).ToString("N2");
                    cboIdNivelAutonomia_tt.SelectedValue = dsPagadoraLinea.Tables[0].Rows[0]["IdNivelAutonomia_tt"];
                    dtFechaAprobacion.Value     = Convert.ToDateTime(dsPagadoraLinea.Tables[0].Rows[0]["dtFechaAprobacion"]);
                    cboIdMedio_tt.SelectedValue = dsPagadoraLinea.Tables[0].Rows[0]["IdMedio_tt"];
                    txtiPlazo.Text           = dsPagadoraLinea.Tables[0].Rows[0]["iPlazo"].ToString();
                    txtvcObservaciones.Text  = dsPagadoraLinea.Tables[0].Rows[0]["vcObservaciones"].ToString();
                    dtFechaVencimiento.Value = Convert.ToDateTime(dsPagadoraLinea.Tables[0].Rows[0]["dtFechaVencimiento"]);
                    txtTipoCambio.Text       = Convert.ToDecimal(dsPagadoraLinea.Tables[0].Rows[0]["nTipoCambio"]).ToString("0.00");
                    cboIdMoneda_tt_SelectedIndexChanged(new object(), new EventArgs());
                }
                else
                {
                    //Obtener el tipo de cambio del dia
                    DataSet     dsTC        = new DataSet();
                    TableBaseBE TableBaseBE = new TableBaseBE()
                    {
                        OPCION  = 6,
                        USUARIO = General.General.GetUsuario,
                    };
                    dsTC = TableBaseBL.ProcesarTableBase(TableBaseBE);

                    if (dsTC.Tables[0].Rows.Count > 0)
                    {
                        txtTipoCambio.Text = Convert.ToDecimal(dsTC.Tables[0].Rows[0]["nTipoCambio"]).ToString("0.00");
                    }
                }
                txtiPlazo.Text = "365";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 3
0
        public DataSet ProcesarPagadoraLinea(PagadoraLineaBE BE)
        {
            DataSet dsResult;

            try
            {
                cmd = db.GetStoredProcCommand("PagadoraLinea_Mnt");
                db.AddInParameter(cmd, "OPCION", DbType.Int32, BE.OPCION);
                db.AddInParameter(cmd, "USUARIO", DbType.String, BE.USUARIO);
                db.AddInParameter(cmd, "IdPagadora", DbType.String, BE.IdPagadora);
                db.AddInParameter(cmd, "IdMoneda_tt", DbType.String, BE.IdMoneda_tt);
                db.AddInParameter(cmd, "nLinea", DbType.Decimal, BE.nLinea);
                db.AddInParameter(cmd, "nUtilizado", DbType.Decimal, BE.nUtilizado);
                db.AddInParameter(cmd, "IdNivelAutonomia_tt", DbType.String, BE.IdNivelAutonomia_tt);
                if (BE.dtFechaAprobacion != DateTime.MinValue)
                {
                    db.AddInParameter(cmd, "dtFechaAprobacion", DbType.DateTime, BE.dtFechaAprobacion);
                }
                db.AddInParameter(cmd, "IdMedio_tt", DbType.String, BE.IdMedio_tt);
                db.AddInParameter(cmd, "IdAnalistaCredito_tt", DbType.String, BE.IdAnalistaCredito_tt);
                db.AddInParameter(cmd, "iPlazo", DbType.Int32, BE.iPlazo);
                if (BE.dtFechaVencimiento != DateTime.MinValue)
                {
                    db.AddInParameter(cmd, "dtFechaVencimiento", DbType.DateTime, BE.dtFechaVencimiento);
                }
                db.AddInParameter(cmd, "vcObservaciones", DbType.String, BE.vcObservaciones);
                db.AddInParameter(cmd, "nTipoCambio", DbType.Decimal, BE.nTipoCambio);
                if (BE.dtTipoCambio != DateTime.MinValue)
                {
                    db.AddInParameter(cmd, "dtTipoCambio", DbType.DateTime, BE.dtTipoCambio);
                }
                db.AddInParameter(cmd, "IdEstadoLinea_tt", DbType.String, BE.IdEstadoLinea_tt);
                dsResult = db.ExecuteDataSet(cmd);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(dsResult);
        }
        private void BuscarLinea()
        {
            try
            {
                DataSet         dsPagadoraLinea = new DataSet();
                PagadoraLineaBE PagadoraLineaBE = new PagadoraLineaBE()
                {
                    OPCION     = 1,
                    USUARIO    = General.General.GetCodigoUsuario,
                    IdPagadora = IdPagadora
                };

                dsPagadoraLinea = PagadoraLineaBL.ProcesarPagadoraLinea(PagadoraLineaBE);

                if (dsPagadoraLinea.Tables[0].Rows.Count > 0)
                {
                    txtLineaActual.Text = Convert.ToDecimal(dsPagadoraLinea.Tables[0].Rows[0]["nLinea"]).ToString("N2");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 5
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtnLinea.Text.Trim()))
                {
                    MessageBox.Show("Debe Ingresar una Línea de Crédito", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txtnLinea.Focus();
                    return;
                }

                if (string.IsNullOrEmpty(cboIdNivelAutonomia_tt.SelectedValue.ToString()))
                {
                    MessageBox.Show("Debe Seleccionar una Nivel de Autonomía", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    cboIdNivelAutonomia_tt.Focus();
                    return;
                }

                if (cboIdMoneda_tt.SelectedIndex == -1)
                {
                    MessageBox.Show("Debe Seleccionar una Moneda", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    cboIdMoneda_tt.Focus();
                    return;
                }

                if (decimal.Parse(txtnLineaImporte.Text.Trim()) == 0)
                {
                    MessageBox.Show("El Importe debe ser mayor a 0", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txtnLineaImporte.Focus();
                    return;
                }

                DataSet     dsTableBase = new DataSet();
                TableBaseBE TableBaseBE = new TableBaseBE()
                {
                    OPCION   = 1,
                    USUARIO  = General.General.GetCodigoUsuario,
                    Table_Id = cboIdNivelAutonomia_tt.SelectedValue.ToString()
                };

                dsTableBase = TableBaseBL.ProcesarTableBase(TableBaseBE);

                if (dsTableBase.Tables[0].Rows.Count > 0)
                {
                    decimal Valor = Convert.ToDecimal(dsTableBase.Tables[0].Rows[0]["Table_Value"]);
                    if (Valor > 0)
                    {
                        if (cboIdMoneda_tt.SelectedValue.ToString().Equals("1") || cboIdMoneda_tt.SelectedValue.ToString().Equals("00036"))
                        {
                            if (decimal.Parse(txtnNuevaLinea.Text.Trim()) > Valor)
                            {
                                MessageBox.Show("El Nivel de Autonomía debe ser de acuerdo a la Nueva Línea", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                txtnLineaImporte.Focus();
                                return;
                            }
                        }
                        else //Dolares
                        {
                            if ((decimal.Parse(txtnNuevaLinea.Text.Trim()) * decimal.Parse(txtTipoCambio.Text.Trim())) > Valor)
                            {
                                MessageBox.Show("El Nivel de Autonomía debe ser de acuerdo a la Nueva Línea", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                txtnLineaImporte.Focus();
                                return;
                            }
                        }
                    }
                }
                else
                {
                    return;
                }

                if (TipoOperacion.ToString().Equals("R"))
                {
                    if (decimal.Parse(txtnNuevaLinea.Text.Trim()) < 0)
                    {
                        MessageBox.Show("La nuva Línea no puede ser menor a 0", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        txtnLineaImporte.Focus();
                        return;
                    }
                }

                PagadoraLineaBE PagadoraLineaBE = new PagadoraLineaBE()
                {
                    OPCION               = 2,
                    USUARIO              = General.General.GetCodigoUsuario,
                    IdPagadora           = IdPagadora,
                    IdMoneda_tt          = cboIdMoneda_tt.SelectedValue.ToString(),
                    nLinea               = decimal.Parse(txtnNuevaLinea.Text),
                    nUtilizado           = 0,
                    IdNivelAutonomia_tt  = cboIdNivelAutonomia_tt.SelectedValue.ToString(),
                    dtFechaAprobacion    = dtFechaAprobacion.Value,
                    IdMedio_tt           = cboIdMedio_tt.SelectedValue.ToString(),
                    IdAnalistaCredito_tt = cboIdAnalistaCredito_tt.SelectedValue.ToString(),
                    iPlazo               = !String.Empty.Equals(txtiPlazo.Text.Trim()) ? int.Parse(txtiPlazo.Text.Trim()) : 0,
                    dtFechaVencimiento   = dtFechaVencimiento.Value,
                    vcObservaciones      = txtvcObservaciones.Text.Trim(),
                    dtTipoCambio         = General.General.gFechaOp,
                    nTipoCambio          = Convert.ToDecimal(txtTipoCambio.Text),
                    IdEstadoLinea_tt     = "00031"
                };

                PagadoraLineaBL.ProcesarPagadoraLinea(PagadoraLineaBE);
                MessageBox.Show("Se Proceso Correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 6
0
 public DataSet ProcesarPagadoraLinea(PagadoraLineaBE BE)
 {
     return(PagadoraLineaDA.ProcesarPagadoraLinea(BE));
 }