예제 #1
0
        private void LlenarCamposDesdeBaseDatosSegunID()
        {
            this.Cursor = Cursors.WaitCursor;

            TasaDeCambioEN oRegistrosEN = new TasaDeCambioEN();
            TasaDeCambioLN oRegistrosLN = new TasaDeCambioLN();

            oRegistrosEN.idTasaDeCambio = ValorLlavePrimariaEntidad;

            if (oRegistrosLN.ListadoPorIdentificador(oRegistrosEN, Program.oDatosDeConexion))
            {
                if (oRegistrosLN.TraerDatos().Rows.Count > 0)
                {
                    //idTasaDeCambio, DesTasaDeCambio, Debitos, Creditos
                    DataRow Fila = oRegistrosLN.TraerDatos().Rows[0];
                    txtCambioOficial.Text = Fila["Cambio"].ToString();
                    dtpkFecha.Value       = Convert.ToDateTime(Fila["Fecha"]);

                    oRegistrosEN = null;
                    oRegistrosLN = null;
                }
                else
                {
                    string Mensaje;
                    Mensaje = string.Format("El registro solicitado de {0} no ha sido encontrado."
                                            + "\n\r-----Causas---- "
                                            + "\n\r1. Este registro pudo haber sido eliminado por otro usuario."
                                            + "\n\r2. El listado no está actualizado.", NombreEntidad);

                    MessageBox.Show(Mensaje, "Listado", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    oRegistrosEN = null;
                    oRegistrosLN = null;

                    this.Close();
                }
            }
            else
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show(oRegistrosLN.Error, "Listado", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                oRegistrosEN = null;
                oRegistrosLN = null;
            }

            this.Cursor = Cursors.Default;
        }
예제 #2
0
        private void LLenarListado()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                TasaDeCambioEN oRegistrosEN = new TasaDeCambioEN();
                TasaDeCambioLN oRegistrosLN = new TasaDeCambioLN();

                oRegistrosEN.Where   = WhereDinamico();
                oRegistrosEN.OrderBy = " Order By Fecha Desc ";

                if (oRegistrosLN.Listado(oRegistrosEN, Program.oDatosDeConexion))
                {
                    dgvLista.Columns.Clear();
                    System.Diagnostics.Debug.Print(oRegistrosLN.TraerDatos().Rows.Count.ToString());

                    if (ActivarFiltros == true)
                    {
                        dgvLista.DataSource = AgregarColumnaSeleccionar(oRegistrosLN.TraerDatos());
                    }
                    else
                    {
                        dgvLista.DataSource = oRegistrosLN.TraerDatos();
                    }

                    FormatearDGV();
                    this.dgvLista.ClearSelection();

                    tsbNoRegistros.Text = "No. Registros: " + oRegistrosLN.TotalRegistros().ToString();
                }
                else
                {
                    throw new ArgumentException(oRegistrosLN.Error);
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Llenar listado de registro en la lista", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }