/// <summary> /// Converts the object into HTML for rendering in browser /// </summary> /// <returns></returns> public string ToHTML() { StringBuilder sbHTML = new StringBuilder(); object[] parameters = new object[5]; parameters[0] = ParallelServer.Get(this.PhotoUrl) + this.PhotoUrl; parameters[1] = this.NickName; parameters[2] = this.DateTimePosted; parameters[3] = this.Text.Replace("\n", "<br/>").Replace("\r", "<br/>"); parameters[4] = this.WebMemberID; sbHTML.AppendFormat(@"<li class='clearfix'><a href='view.aspx?m={4}'> <img src='{0}' width='73' class='commenter_avatar' /></a> <div class='comment_entry'> <p class='commenter'> <cite><a href='view.aspx?m={4}'>{1}</a></cite><br /> <small>{2}</small><br /> </p> <p>{3}</p> </div> </li>" , parameters); //return SafeHTML.FormatForHTML(sbHTML.ToString()); return(sbHTML.ToString()); }
/// <summary> /// Gets all the PhotoComment in the database /// </summary> public static List <AjaxComment> GetPhotoCommentsByGalleryID(int PhotoCollectionID) { Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("HG_GetPhotoCommentsByGalleryID"); db.AddInParameter(dbCommand, "PhotoCollectionID", DbType.Int32, PhotoCollectionID); List <AjaxComment> commentArr = new List <AjaxComment>(); //execute the stored procedure using (IDataReader dr = db.ExecuteReader(dbCommand)) { while (dr.Read()) { AjaxComment ajaxComment = new AjaxComment(); ajaxComment.WebMemberID = (string)dr["WebMemberID"]; ajaxComment.WebPhotoID = (string)dr["WebPhotoID"]; ajaxComment.NickName = (string)dr["NickName"]; ajaxComment.PhotoUrl = ParallelServer.Get((string)dr["PhotoUrl"]) + "user/" + (string)dr["PhotoUrl"]; ajaxComment.Text = (string)dr["Text"]; ajaxComment.DateTimePosted = TimeDistance.TimeAgo((DateTime)dr["DTCreated"]); commentArr.Add(ajaxComment); } dr.Close(); } // Create the object array from the datareader return(commentArr); }
public static string MemberXMLGallery(int MemberID) { Member member = new Member(MemberID); string ThumbPath = "user/" + member.NickName + "/" + "pthmb/"; string LargePath = "user/" + member.NickName + "/" + "plrge/"; List <PhotoCollection> collections = member.PhotoCollection; StringBuilder sb = new StringBuilder(); sb.Append(@"<?xml version=""1.0"" encoding=""UTF-8""?>"); sb.Append(@"<gallery>"); for (int i = 0; i < collections.Count; i++) { Photo[] photos = Photo.GetPhotoByPhotoCollectionIDWithJoin(collections[i].PhotoCollectionID); if (photos.Length > 0) { object[] AlbumParameters = new object[6]; AlbumParameters[0] = collections[i].WebPhotoCollectionID; AlbumParameters[1] = ParallelServer.Get(photos[0].ThumbnailResourceFile.FullyQualifiedURL) + photos[0].ThumbnailResourceFile.FullyQualifiedURL; AlbumParameters[2] = ParallelServer.Get(LargePath) + LargePath; AlbumParameters[3] = ParallelServer.Get(ThumbPath) + ThumbPath; AlbumParameters[4] = collections[i].Name; AlbumParameters[5] = collections[i].Description; //AlbumParameters[6] = collections[i].Description; //gallery title sb.AppendFormat(@" <album id=""{0}"" title=""{4}"" tn=""{1}"" lgPath=""{2}"" tnPath=""{3}"" description=""{5}"" >", AlbumParameters); for (int j = 0; j < photos.Length; j++) { object[] PhotoParameters = new object[2]; PhotoParameters[0] = photos[j].PhotoResourceFile.FileName; PhotoParameters[1] = string.Empty; sb.AppendFormat(@" <img src=""{0}"" caption=""{1}"" />", PhotoParameters); } sb.Append(@" </album>"); } } sb.Append(@"</gallery>"); return(sb.ToString()); }
/// <summary> /// /// </summary> /// <param name="dr"></param> /// <returns></returns> public static AjaxComment[] PopulateAjaxComment(IDataReader dr) { List <AjaxComment> commentArr = new List <AjaxComment>(); AjaxComment ajaxComment; ColumnFieldList list = new ColumnFieldList(dr); while (dr.Read()) { ajaxComment = new AjaxComment(); ajaxComment.WebMemberID = (string)dr["WebMemberID"]; ajaxComment.NickName = (string)dr["NickName"]; ajaxComment.PhotoUrl = ParallelServer.Get((string)dr["PhotoUrl"]) + "user/" + (string)dr["PhotoUrl"]; ajaxComment.Text = (string)dr["Text"]; ajaxComment.SentFromMobile = ((int)dr["SentFromMobile"]) == 1 ? true : false; ajaxComment.DateTimePosted = TimeDistance.TimeAgo((DateTime)dr["DTCreated"]); ajaxComment.DTCreated = (DateTime)dr["DTCreated"]; if (list.IsColumnPresent("WebCommentID")) { ajaxComment.WebCommentID = (string)dr["WebCommentID"]; } if (list.IsColumnPresent("Path")) { ajaxComment.Path = (string)dr["Path"]; ajaxComment.Depth = GetDepth(ajaxComment.Path); } if (list.IsColumnPresent("IsDeleted")) { ajaxComment.IsDeleted = (bool)dr["IsDeleted"]; } commentArr.Add(ajaxComment); } return(commentArr.ToArray()); }
public static string NSpotXMLGallery(int NSpotID) { List <PhotoCollection> collections = new List <PhotoCollection>(); List <Photo> DynamicPhotos = Photo.GetNSpotPhotosByNSpotID(NSpotID); PhotoCollection NewCollection = new PhotoCollection(); int MemberID = -1; int MemberPhotoCount = 0; for (int i = 0; i < DynamicPhotos.Count; i++) { if (DynamicPhotos[i].MemberID != MemberID) { NewCollection = new PhotoCollection(); NewCollection.Name = DynamicPhotos[i].Member.NickName; MemberID = DynamicPhotos[i].MemberID; MemberPhotoCount = 0; } MemberPhotoCount++; NewCollection.Photo.Add(DynamicPhotos[i]); // if the next photo is a differnt member of this is the last loop then add if (i == (DynamicPhotos.Count - 1)) { NewCollection.Description = "Photos " + MemberPhotoCount.ToString(); collections.Add(NewCollection); } else if (DynamicPhotos[i + 1].MemberID != MemberID) { NewCollection.Description = "Photos " + MemberPhotoCount.ToString(); collections.Add(NewCollection); } } StringBuilder sb = new StringBuilder(); sb.Append(@"<?xml version=""1.0"" encoding=""UTF-8""?>"); sb.Append(@"<gallery>"); for (int i = 0; i < collections.Count; i++) { List <Photo> photos = collections[i].Photo; if (photos.Count > 0) { string NickName = photos[0].Member.NickName; string ThumbPath = "user/" + NickName + "/" + "pthmb/"; string LargePath = "user/" + NickName + "/" + "plrge/"; object[] AlbumParameters = new object[6]; AlbumParameters[0] = collections[i].WebPhotoCollectionID; AlbumParameters[1] = ParallelServer.Get(photos[0].ThumbnailResourceFile.FullyQualifiedURL) + photos[0].ThumbnailResourceFile.FullyQualifiedURL; AlbumParameters[2] = LargePath; AlbumParameters[3] = ThumbPath; AlbumParameters[4] = collections[i].Name; AlbumParameters[5] = collections[i].Description; //AlbumParameters[6] = collections[i].Description; //gallery title sb.AppendFormat(@" <album id=""{0}"" title=""{4}"" tn=""{1}"" lgPath=""{2}"" tnPath=""{3}"" description=""{5}"" >", AlbumParameters); for (int j = 0; j < photos.Count; j++) { object[] PhotoParameters = new object[2]; PhotoParameters[0] = photos[j].PhotoResourceFile.FileName; PhotoParameters[1] = string.Empty; sb.AppendFormat(@" <img src=""{0}"" caption=""{1}"" />", PhotoParameters); } sb.Append(@" </album>"); } } sb.Append(@"</gallery>"); return(sb.ToString()); }
public DashboardItem PopulateDashboardItem(DashboardItem DashboardItem, IDataReader dr) { // the Datareader will return the results in the following order //-- 1. Favourites this week //-- 2. Latest Photo Galleries //-- 3. New Friend Requests //-- 4. Pending friend reguests //-- 5. new Friends //-- 6. Profile updates //-- 7. inbox //-- 8. Lowdown entry //-- 9. video Comments //-- 10. photo Comments //-- 11. Proximity Tags //-- 12. Live mobile broadcasts //-- 13. New Blog entry //-- 14. Private AAF Question //-- 15. My AAF Questions //-- 2. Latest Photo Galleries if (DashboardItem.DashboardField == DashboardField.NewFriendPhotoGallery) { bool Empty = true; while (dr.Read()) { DashboardItem.HTML += "<li><a href='ViewGallery.aspx?g=" + (string)dr["WebPhotoCollectionID"] + "'>" + (string)dr["Name"] + "-" + TimeDistance.ShortDateTime((DateTime)dr["DTCreated"]) + "<img style='width:51px;height:51px' src='" + ParallelServer.Get() + "user/" + (string)dr["PhotoURL"] + "'></a></li>"; Empty = false; } if (Empty) { DashboardItem.HTML += "<li>No new Galleries</li>"; } } //-- 3. New Friend Requests if (DashboardItem.DashboardField == DashboardField.FriendRequest) { bool Empty = true; while (dr.Read()) { DashboardItem.HTML += "<li><a href='Friendrequest.aspx'>" + (string)dr["FriendMemberNickName"] + " - <img style='width:51px;height:51px' src='" + ParallelServer.Get() + "user/" + (string)dr["photoURL"] + "'></a></li>"; Empty = false; } if (Empty) { DashboardItem.HTML += "<li>No new Friend requests</li>"; } } //-- 4. Pending friend reguests if (DashboardItem.DashboardField == DashboardField.FriendRequestOutstanding) { bool Empty = true; while (dr.Read()) { DashboardItem.HTML += "<li><a href=''>" + (string)dr["FriendMemberNickname"] + "!</a> - View</li>"; Empty = false; } if (Empty) { DashboardItem.HTML += "<li>No pending Friend requests</li>"; } } //-- 6. Profile updates if (DashboardItem.DashboardField == DashboardField.FriendProfileUpdate) { bool Empty = true; while (dr.Read()) { DashboardItem.HTML += "<li><a href='view.aspx?m=" + (string)dr["WebMemberID"] + "'>" + (string)dr["Nickname"] + "</a> </li>"; Empty = false; } if (Empty) { DashboardItem.HTML += "<li>No updated profiles</li>"; } } //-- 7. inbox if (DashboardItem.DashboardField == DashboardField.Inbox) { bool Empty = true; while (dr.Read()) { DashboardItem.HTML += "<li><img src='images/email.gif'> <a href=''>" + (string)dr["Nickname"] + " - " + TimeDistance.ShortDateTime((DateTime)dr["DTCreated"]) + "</a> </li>"; Empty = false; } if (Empty) { DashboardItem.HTML += "<li>No new messages</li>"; } } //-- 9. video Comments if (DashboardItem.DashboardField == DashboardField.VideoComment) { bool Empty = true; int count = 0; while (dr.Read()) { if (count != 10) { DashboardItem.HTML += "<li><a href='view?v=" + (string)dr["WebVideoID"] + "'>" + Trim((string)dr["Title"], 15) + " - " + (string)dr["NickName"] + "</a></li>"; Empty = false; count++; } else { break; } } if (Empty) { DashboardItem.HTML += "<li>No video comments</li>"; } } //-- 10. photo Comments if (DashboardItem.DashboardField == DashboardField.PhotoComment) { bool Empty = true; while (dr.Read()) { DashboardItem.HTML += "<li><a href=''>" + (string)dr["Name"] + "!</a> - <a href=''>" + (string)dr["NickName"] + "!</a></li>"; Empty = false; } if (Empty) { DashboardItem.HTML += "<li>No photo comments</li>"; } } //-- 12. Live mobile broadcasts if (DashboardItem.DashboardField == DashboardField.LiveMobileBroadcasts) { bool Empty = true; while (dr.Read()) { DashboardItem.HTML += "<li><a href='view?v=" + (string)dr["WebVideoID"] + "'>" + Trim((string)dr["Title"], 10) + "</a> - " + (string)dr["NickName"] + " " + TimeDistance.ShortDateTime((DateTime)dr["DTCreated"]) + "</li>"; Empty = false; } if (Empty) { DashboardItem.HTML += "<li>No new Videos</li>"; } } //-- 15. My AAF Questions if (DashboardItem.DashboardField == DashboardField.MyAskAFriendQuestions) { bool Empty = true; while (dr.Read()) { DashboardItem.HTML += "<li><a href='AskAFriend.aspx?q=" + (string)dr["WebAskAFriendID"] + "'>" + Trim((string)dr["Question"], 15) + "</a> - " + TimeDistance.ShortDateTime((DateTime)dr["WentLiveDT"]) + "</li>"; Empty = false; } if (Empty) { DashboardItem.HTML += "<li>No have not posted any Questions</li>"; } else { DashboardItem.HTML = "<a href='AAFUpload.aspx'>Ask A Question Now</a><br/><a href='AskAFriend.aspx'>Answer Questions</a><br/><br/><a href='MyAskAFriend.aspx'><strong>My Questions</strong></a><br/>" + DashboardItem.HTML; DashboardItem.HTML += "<br/><strong>New Questions</strong><br/>"; } } return(DashboardItem); }