Beispiel #1
0
        /*
         * public bool SetFlickrAuthentication(string flickrAuth)
         * {
         *  try
         *  {
         *      flickr.AuthToken = flickrAuth;
         *      return true;
         *  }
         *  catch (Exception ex)
         *  {
         *      return false;
         *  }
         * }
         */

        /// <summary>
        /// this method will populate a generic list of type photograph given a product ID
        /// </summary>
        /// <param name="productType"></param>
        /// <returns>Generic list of type Photograph</returns>
        public List <Photograph> GetFlickrPhotographListByProductType(Utility.SkiChairProduct productType)
        {
            try
            {
                List <Photograph> flickrImageInfoList = new List <Photograph>();

                PhotoSearchOptions searchOptions = new PhotoSearchOptions();
                //searchOptions.GroupId = Utility.FlickrGroupID;
                searchOptions.UserId    = Utility.FlickrUserID;
                searchOptions.Extras    = PhotoSearchExtras.Tags;
                searchOptions.Tags      = productType.ToString();
                searchOptions.SortOrder = PhotoSearchSortOrder.DatePostedDescending;
                PhotoCollection photoCollection = flickr.PhotosSearch(searchOptions);

                foreach (Photo photo in photoCollection)
                {
                    flickrImageInfoList.Add(new Photograph(photo.PhotoId, photo.ThumbnailUrl, photo.MediumUrl, photo.Title));
                }

                return(flickrImageInfoList);
            }
            catch (Exception ex)
            {
                System.IO.StreamWriter sw = System.IO.File.AppendText(ConfigurationManager.AppSettings["ErrorLogPath"].ToString() + "SkiChairErrorLogFile.txt");
                try
                {
                    string logLine = System.String.Format("{0:G}: {1}.", System.DateTime.Now, "Error: " + ex.Message);
                    sw.WriteLine(logLine);
                }
                finally
                {
                    sw.Close();
                }
                return(null);
            }
        }
Beispiel #2
0
 /// <summary>
 /// this method will get all photo information given a product id
 /// </summary>
 /// <param name="productType">ID of the product to select information from</param>
 /// <returns>Name value collection containing image information</returns>
 public List <Photograph> GetPhotoInfoCollectionByProductType(Utility.SkiChairProduct productType)
 {
     return(SkiChairFlickrService.GetFlickrPhotographListByProductType(productType));
 }