コード例 #1
0
        }//Funcionando

        //CRUD: Localizar
        public void localizar(List <Quarto> lista)
        {
            if (this.abrirConexao())
            {
                this.comando.CommandText = this.sql;

                try
                {
                    this.cursor = this.comando.ExecuteReader();

                    Quarto quarto = new Quarto();

                    while (this.cursor.Read())
                    {
                        quarto = quarto.clonar(this.cursor.GetString("idQuarto"), this.cursor.GetString("numeroQuarto"), this.cursor.GetString("tipo"), this.cursor.GetString("quantBanheiros"), this.cursor.GetString("quantSalas"), this.cursor.GetString("quantCozinhas"), this.cursor.GetString("precoMensalidade"), this.cursor.GetString("andar"));

                        lista.Add(quarto);
                    }
                }
                catch (MySqlException exception)
                {
                    MessageBox.Show("Houve um problema ao tentar fazer a busca!", "Busca não realizada", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    MessageBox.Show("Dados técnicos: " + exception, "Falha na pesquisa", MessageBoxButtons.OK);
                }

                this.conexao.Close();
            }
        }