/// <summary> /// /// </summary> /// <param name="cityID"></param> /// <returns></returns> public List <RoadSegment> Segments(int cityID) { SqlCommand command; List <RoadSegment> l = new List <RoadSegment>(); RoadSegment r; SqlParameter p1 = new SqlParameter("@IDCidade", SqlDbType.Int); p1.Value = cityID; command = new SqlCommand("SegmentosCidade", this.connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(p1); this.reader = command.ExecuteReader(); while (this.reader.Read()) { r = new RoadSegment(); r.id = Int32.Parse(reader["ID"].ToString()); r.idIntersectionBegin = Int32.Parse(reader["INTERSECCAO_INICIO"].ToString()); r.idIntersectionEnd = Int32.Parse(reader["INTERSECCAO_FIM"].ToString()); r.name = reader["NOME"].ToString(); l.Add(r); } this.reader.Close(); return(l); }
/// <summary> /// /// </summary> /// <param name="cityID"></param> /// <returns></returns> public List<RoadSegment> Segments(int cityID) { SqlCommand command; List<RoadSegment> l = new List<RoadSegment>(); RoadSegment r; SqlParameter p1 = new SqlParameter("@IDCidade", SqlDbType.Int); p1.Value = cityID; command = new SqlCommand("SegmentosCidade", this.connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(p1); this.reader = command.ExecuteReader(); while (this.reader.Read()) { r = new RoadSegment(); r.id = Int32.Parse(reader["ID"].ToString()); r.idIntersectionBegin = Int32.Parse(reader["INTERSECCAO_INICIO"].ToString()); r.idIntersectionEnd = Int32.Parse(reader["INTERSECCAO_FIM"].ToString()); r.name = reader["NOME"].ToString(); l.Add(r); } this.reader.Close(); return l; }