Exemplo n.º 1
0
        public List <GenericObject> GenericObjects(int cityID)
        {
            SqlCommand command;

            List <GenericObject> l = new List <GenericObject>();
            GenericObject        i;

            SqlParameter p1 = new SqlParameter("@IDCidade", SqlDbType.Int);

            p1.Value = cityID;

            command             = new SqlCommand("ObjectosCidade", this.connection);
            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(p1);

            this.reader = command.ExecuteReader();

            while (this.reader.Read())
            {
                i = new GenericObject();

                i.id       = Int32.Parse(reader["IDObjecto"].ToString());
                i.position = new Vector3D(Double.Parse(reader["X"].ToString()), Double.Parse(reader["Y"].ToString()), Double.Parse(reader["Z"].ToString()));
                i.type     = reader["ShortCode"].ToString();

                l.Add(i);
            }

            this.reader.Close();

            return(l);
        }
Exemplo n.º 2
0
        public List<GenericObject> GenericObjects(int cityID)
        {
            SqlCommand command;

            List<GenericObject> l = new List<GenericObject>();
            GenericObject i;

            SqlParameter p1 = new SqlParameter("@IDCidade", SqlDbType.Int);
            p1.Value = cityID;

            command = new SqlCommand("ObjectosCidade", this.connection);
            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(p1);

            this.reader = command.ExecuteReader();

            while (this.reader.Read())
            {
                i = new GenericObject();

                i.id = Int32.Parse(reader["IDObjecto"].ToString());
                i.position = new Vector3D(Double.Parse(reader["X"].ToString()), Double.Parse(reader["Y"].ToString()), Double.Parse(reader["Z"].ToString()));
                i.type = reader["ShortCode"].ToString();

                l.Add(i);
            }

            this.reader.Close();

            return l;
        }