public static Affecter findByNumero(string numero) { Affecter affecter = null; OdbcCommand cmd = new OdbcCommand("select * from affecter where Numero=?", AccesBd.getConnection()); cmd.Parameters.Add("@numero", OdbcType.VarChar).Value = numero; OdbcDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { affecter = new Affecter { Id = dr.GetInt32(0), Numero = dr.GetString(1), DateDebut = dr.GetDateTime(2), DateFin = dr.GetDateTime(3), ligne = LigneDao.findByNumero(dr.GetString(4)), bus = BusDao.findByNumero(dr.GetString(5)) }; } cmd.Dispose(); return(affecter); }
public static Attribuer find(int Id) { Attribuer attribuer = null; OdbcCommand cmd = new OdbcCommand("select * from attribuer where Id=?", AccesBd.getConnection()); cmd.Parameters.Add("@id", OdbcType.Int).Value = Id; OdbcDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { attribuer = new Attribuer { Id = dr.GetInt32(0), Numero = dr.GetString(1), DateDebut = dr.GetDateTime(2), DateFin = dr.GetDateTime(3), bus = BusDao.findByNumero(dr.GetString(4)), chauffeur = ChauffeurDao.findByNumero(dr.GetString(5)) }; } cmd.Dispose(); return(attribuer); }