Esempio n. 1
0
        /// <summary>
        /// Gets the image link.
        /// </summary>
        /// <param name="upload">The upload.</param>
        /// <returns></returns>
        public static string RenderRecentUploadHtml(RecentUploads upload)
        {
            string val = string.Empty;

            if (upload != null)
            {
                MediaFile    thumbnail  = upload.GetImageByPhotoType(PhotoType.Thumbnail);
                MediaFile    webSize    = upload.GetImageByPhotoType(PhotoType.Websize);
                const string linkFormat = @"<tr>
                                                <td><span class=""imagecontainer"" ><a rel=""{0}"" href=""{7}"" class=""showimage lightbox"" title=""{1}""><img src=""{2}"" alt=""{3}"" /></a></span></td>
                                                <td>
                                                    <ul class=""albummetadata"" >
                                                        <li><label class=""albumtitle"" ><span>{4}</span></label></li>
                                                        <li><abbr class=""timeago"" title=""{5}"">{6}</abbr></li>  
                                                    </ul>              
                                                </td>
                                            </tr>";
                val = string.Format(linkFormat,
                                    _urlService.CreateImageUrl(upload.Owner.Username, webSize.FilePath),
                                    upload.Title,
                                    _urlService.UserUrl(upload.Owner.Username, "services/grayscale/" + thumbnail.MediaId),
                                    upload.Title,
                                    upload.Title,
                                    upload.CreateDate.ToString("o"),
                                    upload.CreateDate.ToLongDateString(),
                                    _urlService.UserUrl(upload.Owner.Username, "photos/show/#/photo/" + upload.MediaId));
            }
            return(val);
        }
Esempio n. 2
0
        /// <summary>
        ///     Reads the JSON representation of the object.
        /// </summary>
        /// <param name="reader">The <see cref="T:Newtonsoft.Json.JsonReader" /> to read from.</param>
        /// <param name="objectType">Type of the object.</param>
        /// <param name="existingValue">The existing value of object being read.</param>
        /// <param name="serializer">The calling serializer.</param>
        /// <returns>The object value.</returns>
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
                                        JsonSerializer serializer)
        {
            var     result = new RecentUploads();
            JObject json   = JObject.Load(reader);

            serializer.Converters.Add(new EmdRowSetCollectionJsonConverter <RecentUploads.RecentUploadsEntry>());
            result.Uploads =
                serializer.Deserialize <EmdRowCollection <RecentUploads.RecentUploadsEntry> >(
                    json["rowset"].CreateReader());

            return(result);
        }
Esempio n. 3
0
 /// <summary>
 /// Gets the recent uploads by photo age.
 /// </summary>
 /// <param name="age">The age.</param>
 /// <returns></returns>
 public List <RecentUploads> GetRecentUploadsByPhotoAge(PhotoAge age)
 {
     return(RecentUploads.Where(o => o.Age == age).ToList());
 }