/** * Função que lê dados já cadastrados anteriormente na relação fisioterapeuta. */ public static List <Fisioterapeuta> Read() { DataBase banco = new DataBase(); using (banco.conn = new SqliteConnection(GlobalController.instance.path)) { banco.conn.Open(); banco.cmd = banco.conn.CreateCommand(); banco.sqlQuery = "SELECT * " + "FROM FISIOTERAPEUTA"; banco.cmd.CommandText = banco.sqlQuery; IDataReader reader = banco.cmd.ExecuteReader(); List <Fisioterapeuta> physiotherapeuts = new List <Fisioterapeuta>(); while (reader.Read()) { int idFisioterapeutaTemp = 0; int idPessoaTemp = 0; string loginTemp = "null"; string senhaTemp = "null"; string regiaoTemp = "null"; string crefitoTemp = "null"; if (!reader.IsDBNull(0)) { idFisioterapeutaTemp = reader.GetInt32(0); } if (!reader.IsDBNull(1)) { idPessoaTemp = reader.GetInt32(1); } if (!reader.IsDBNull(2)) { loginTemp = reader.GetString(2); } if (!reader.IsDBNull(3)) { senhaTemp = reader.GetString(3); } if (!reader.IsDBNull(4)) { regiaoTemp = reader.GetString(4); } if (!reader.IsDBNull(5)) { crefitoTemp = reader.GetString(5); } Fisioterapeuta physiotherapeut = new Fisioterapeuta(idFisioterapeutaTemp, idPessoaTemp, loginTemp, senhaTemp, regiaoTemp, crefitoTemp); physiotherapeuts.Add(physiotherapeut); } reader.Close(); reader = null; banco.cmd.Dispose(); banco.cmd = null; banco.conn.Close(); banco.conn = null; return(physiotherapeuts); } }
public static Fisioterapeuta ReadValue(int id) { DataBase banco = new DataBase(); using (banco.conn = new SqliteConnection(GlobalController.instance.path)) { banco.conn.Open(); banco.cmd = banco.conn.CreateCommand(); banco.sqlQuery = "SELECT * " + string.Format("FROM \"{0}\" WHERE \"{1}\" = \"{2}\";", TablesManager.Tables[tableId].tableName, TablesManager.Tables[tableId].colName[0], id); banco.cmd.CommandText = banco.sqlQuery; IDataReader reader = banco.cmd.ExecuteReader(); reader.Read(); int idFisioterapeutaTemp = 0; int idPessoaTemp = 0; string loginTemp = "null"; string senhaTemp = "null"; string regiaoTemp = "null"; string crefitoTemp = "null"; if (!reader.IsDBNull(0)) { idFisioterapeutaTemp = reader.GetInt32(0); } if (!reader.IsDBNull(1)) { idPessoaTemp = reader.GetInt32(1); } if (!reader.IsDBNull(2)) { loginTemp = reader.GetString(2); } if (!reader.IsDBNull(3)) { senhaTemp = reader.GetString(3); } if (!reader.IsDBNull(4)) { regiaoTemp = reader.GetString(4); } if (!reader.IsDBNull(5)) { crefitoTemp = reader.GetString(5); } Fisioterapeuta physiotherapeut = new Fisioterapeuta(idFisioterapeutaTemp, idPessoaTemp, loginTemp, senhaTemp, regiaoTemp, crefitoTemp); reader.Close(); reader = null; banco.cmd.Dispose(); banco.cmd = null; banco.conn.Close(); banco.conn = null; return(physiotherapeut); } }
public static Fisioterapeuta GetLast() { Object[] columns = new Object[] { 0, 0, "", "", "", "" }; Fisioterapeuta physiotherapeut = DataBase.GetLast <Fisioterapeuta>(TablesManager.Tables[tableId].tableName, TablesManager.Tables[tableId].colName[0], columns); return(physiotherapeut); }
public static Fisioterapeuta ReadValue(int id) { Object[] columns = new Object[] { 0, 0, "", "", "", "" }; Fisioterapeuta physiotherapeut = DataBase.ReadValue <Fisioterapeuta>(TablesManager.Tables[tableId].tableName, TablesManager.Tables[tableId].colName[0], id, columns); return(physiotherapeut); }