public ArrayList ObtenerDescuentosUsuario(int idioma, int usuario) { ArrayList arrayDescuentos = new ArrayList(); MySql.Data.MySqlClient.MySqlDataReader mySQLReader; String sqlString = "CALL Select_all_descuento_plato_usuario(" + idioma.ToString() + ", " + usuario.ToString() + ");"; MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(sqlString, conexion); try { mySQLReader = cmd.ExecuteReader(); while (mySQLReader.Read()) { Descuento_Plato p = LeerDescuento(mySQLReader); arrayDescuentos.Add(p); } } catch (Exception) { Console.WriteLine("Error al hacer la consulta"); } return(arrayDescuentos); }
public Descuento_Plato LeerDescuento(MySql.Data.MySqlClient.MySqlDataReader mySQLReader) { Descuento_Plato p = new Descuento_Plato(); p.id_descuento = mySQLReader.GetInt32(0); p.nombre_descuento = mySQLReader.GetString(1); p.descripcion_descuento = mySQLReader.GetString(2); p.codigo_descuento = mySQLReader.GetString(3); p.precio_descuento = mySQLReader.GetInt32(4); p.precio_final_descuento = mySQLReader.GetDouble(5); p.id_plato = mySQLReader.GetInt32(6); p.nombre_plato = mySQLReader.GetString(7); p.imagen_plato = mySQLReader.GetString(8); p.precio_plato = mySQLReader.GetDouble(9); p.id_familia_plato = mySQLReader.GetInt32(10); return(p); }