Exemplo n.º 1
0
        /// <summary>
        /// Gets the user by their serviceKey
        /// </summary>
        /// <param name="serviceKey">The service key.</param>
        /// <returns></returns>
        public User RetrieveUserByServiceKey(Guid serviceKey)
        {
            SqlParameter[] parameters =
            {
                _database.MakeParameter("@ServiceKey", SqlDbType.UniqueIdentifier, 16, serviceKey)
            };

            SqlDataReader reader = _database.Reader("User_SelectByServiceKey", parameters);
            User          user   = Populate(reader);

            return(user);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get the gallery by it's Id
        /// </summary>
        /// <param name="galleryId">The gallery id.</param>
        /// <returns></returns>
        public Gallery RetrieveGalleryByGalleryId(int galleryId)
        {
            SqlParameter[] parameters =
            {
                _database.MakeParameter("@GalleryId", SqlDbType.Int, 4, galleryId)
            };

            GalleryItem   items   = GetItemUserId;
            SqlDataReader reader  = _database.Reader("Gallery_SelectByPrimaryKey", parameters);
            Gallery       gallery = Populate(reader, items);

            return(gallery);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Retrieves a random photo from a specified gallery
        /// </summary>
        /// <param name="galleryId">The gallery id.</param>
        /// <returns></returns>
        public Photo RetrieveRandomPhotoByGalleryId(int galleryId)
        {
            Photo photo = new Photo();

            SqlParameter[] parameters =
            {
                _database.MakeParameter("@GalleryId", SqlDbType.Int, 4, galleryId)
            };

            SqlDataReader reader = _database.Reader("Photo_RetreiveRandomPhotoByGalleryId", parameters);
            List <Photo>  photos = PopulatePhotos(reader);

            if (photos.Count > 0)
            {
                photo = photos[0];
            }

            return(photo);
        }