public Tour TourForTourist(String username, String password, int tourID)
        {
            Tour tour = new Tour();            

            //if (Membership.ValidateUser(username, password))
            //{
                //Guid guid = (Guid)Membership.GetUser(username).ProviderUserKey;
            Guid guid = new Guid("12345678-9012-3456-7890-123456789013");
                Database database = new Database();
                database.connect();
                    tour = database.Query.TourByTourist(guid, tourID);
                    tour.toVisit = database.Query.PointsOfInterestToVisit(tourID);
                database.disconnect();

                tour.authenticated = true;
            //}

            return tour;
        }
Example #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        ///
        /// TODO: Practicamente igual à TourListByTourist.
        public Tour TourByTourist(Guid touristID, int tourID)
        {
            Tour t = new Tour();

            SqlCommand command;
            SqlParameter paramTouristID = new SqlParameter("@IDUtilizador", SqlDbType.UniqueIdentifier);
            SqlParameter paramTourID = new SqlParameter("@IDPercurso", SqlDbType.Int);

            command = new SqlCommand("InfoPercurso", this.connection);
            command.CommandType = CommandType.StoredProcedure;

            paramTourID.Value = tourID;
            paramTouristID.Value = touristID;

            command.Parameters.Add(paramTouristID);
            command.Parameters.Add(paramTourID);
            
            this.reader = command.ExecuteReader();

            while (this.reader.Read())
            {
                t.tourID = Int32.Parse(reader["ID"].ToString());
                t.cityID = Int32.Parse(reader["IDCidade"].ToString());
                t.cityName = reader["NOME"].ToString();
                t.begin = DateTime.Parse(reader["DATA_HORA_INICIO"].ToString());                
            }

            this.reader.Close();

            return t;
        }