public List <Aluno> GetAll() { string query = "SELECT * FROM tbAluno"; List <Aluno> listAluno = new List <Aluno>(); try { dbUtils.AbrirConexao(); MySqlDataReader reader = dbUtils.ExecuteDataReader(query); while (reader.Read()) { Aluno aluno = new Aluno(); aluno.CodAluno = int.Parse(reader["codAluno"].ToString()); aluno.Biometria = uint.Parse(reader["biometria"].ToString()); listAluno.Add(aluno); } reader.Close(); dbUtils.FecharConexao(); } catch (Exception ex) { throw new Exception(ex.Message); } finally { dbUtils.FecharConexao(); } return(listAluno); }
public List <Mesa> GetAll() { string query = "SELECT * FROM tbMesa"; List <Mesa> listMesa = new List <Mesa>(); try { dbUtils.AbrirConexao(); MySqlDataReader reader = dbUtils.ExecuteDataReader(query); while (reader.Read()) { Mesa mesa = new Mesa(); mesa.CodMesa = int.Parse(reader["codMesa"].ToString()); mesa.CodMesa = int.Parse(reader["codAluno"].ToString()); mesa.HrRetirada = DateTime.Parse(reader["hrRetirada"].ToString()); mesa.HrEntrega = DateTime.Parse(reader["hrEntrega"].ToString()); listMesa.Add(mesa); } reader.Close(); dbUtils.FecharConexao(); } catch (Exception ex) { throw new Exception(ex.Message); } finally { dbUtils.FecharConexao(); } return(listMesa); }