public List<Model.TarjetaCreditoModel> buscarTodasLasTarjetas()
        {
            List<Model.TarjetaCreditoModel> tarjetasCredito = new List<Model.TarjetaCreditoModel>();
            SqlConnection myConnection = null;
            try
            {
                myConnection = new SqlConnection(stringConexion);
                myConnection.Open();
                SqlCommand command = null;
                var query = "SELECT tarjeta_credito_id, tarjeta_credito_descripcion FROM MONDONGO.TARJETA_CREDITO ";
                command = new SqlCommand(query, myConnection);
                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        Model.TarjetaCreditoModel tc = new Model.TarjetaCreditoModel();
                        tc.id = (int)(double)reader.GetDecimal(0);
                        tc.descripcion = reader.GetString(1);

                        tarjetasCredito.Add(tc);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERROR" + ex.Message);
            }
            finally
            {
                myConnection.Close();
            }
            return tarjetasCredito;
        }
Beispiel #2
0
 private void cbTarjetas_SelectedIndexChanged(object sender, EventArgs e)
 {
     tarjetaSeleccionada = cbTarjetas.SelectedItem as Model.TarjetaCreditoModel;
     cbCuotas.DataSource = tarjetaCreditoController.buscarBeneficiosDeLaTarjeta(tarjetaSeleccionada.id);
     cbCuotas.DisplayMember = "cuotas";
 }