public AjaxComment PostComment(string type, string WebID, string CommentText) { AjaxComment ajaxComment = new AjaxComment(); member = (Member)Session["Member"]; if (type == "n") { NSpot nspot = NSpot.GetNSpotByNSpotWebID(WebID); NSpotComment comment = new NSpotComment(); comment.NSpotID = nspot.NSpotID; comment.MemberID = member.MemberID; comment.Text = CommentText; comment.DTCreated = DateTime.Now; comment.Save(); ajaxComment = AjaxComment.GetAjaxNSpotCommentByNSpotCommentIDWithJoin(comment.NSpotCommentID); ajaxComment.TotalNumberOfComments = "0"; } return(ajaxComment); }
protected void Page_Load(object sender, EventArgs e) { AjaxPro.Utility.RegisterTypeForAjax(typeof(NSpotPage)); member = (Member)Session["Member"]; // set the default forwarding if the member is not logged in LoginUrl = @"signup.aspx?u=" + Request.Url.AbsoluteUri; SubscribeLink = LoginUrl; SendMessageLink = LoginUrl; BlockMemberLink = LoginUrl; AddToFriendsLink = LoginUrl; DefaultVoteUpLink = LoginUrl; DefaultVoteDownLink = LoginUrl; AddFavouritesLink = LoginUrl; string strWebNSpotID = Request.Params["n"]; // load the members photo string strMemberPhoto = Request.Params["np"]; if (strWebNSpotID != null) { ViewingNSpot = NSpot.GetNSpotByNSpotWebIDWithJoin(strWebNSpotID); PhotoURL = ViewingNSpot.PhotoResourceFile.FullyQualifiedURL; ProfileDefaultPageType = NSDefaultPageType.NSpot; DefaultNumberOfViews = (++ViewingNSpot.NumberOfViews).ToString(); ViewingNSpot.Save(); PermaLink = WebRoot + "nspot.aspx?m=" + strWebNSpotID; GenerateNSpotMemberLister(); } if (strMemberPhoto != null) { ResourceFile PhotoRes = new ResourceFile(ViewingNSpot.PhotoResourceFileID); LoadLargeNSpotPhoto = true; LargePhotoURL = @"user/" + ViewingNSpot.Member.NickName + "/nslrge/" + PhotoRes.FileName; } if (member != null) { IsLoggedIn = true; if (ViewingNSpot.MemberID == member.MemberID) { IsMyPage = true; } } GeneratePageComments(); //CreateEmbeddedLinks(); }
/// <summary> /// Genetate the NSpot lister /// </summary> public string GenerateFeaturesNspotLister() { List <NSpot> Nspots = NSpot.GetTop100NSpots(TopNspotType.Featured); StringBuilder sbHTMLList = new StringBuilder(); for (int i = 0; i < 6; i++) { if (Nspots.Count <= i) { break; } StringBuilder sbHTMLItem = new StringBuilder(); object[] parameters = new object[7]; parameters[0] = Nspots[i].WebNSpotID; parameters[1] = Nspots[i].PhotoResourceFile.FullyQualifiedURL; parameters[2] = Nspots[i].Name; parameters[3] = Nspots[i].Description; parameters[4] = Nspots[i].WebNSpotID; parameters[5] = Nspots[i].Member.NickName; parameters[6] = Nspots[i].NumberOfViews; string HTMLItem = @"<li><a href='NSpot.aspx?n={0}'><img src='{1}' alt=''></a><br /> <a href='#'>{2}</a><br/> <p class='metadata'>by: <a href='#'>{5}</a> Views: <a href='#'>{6}</a></p> </li>" ; sbHTMLItem.AppendFormat(HTMLItem, parameters); sbHTMLList.Append(sbHTMLItem.ToString()); } //<p class='metadata'>{3}</p><br/> return(sbHTMLList.ToString()); }
protected void Page_Load(object sender, EventArgs e) { string strWebMemberID = Request.Params["m"]; string strWebNSpotID = Request.Params["n"]; if (strWebMemberID != null) { Member ViewingMember = Member.GetMemberViaWebMemberID(strWebMemberID); List <MemberProfile> profile = ViewingMember.MemberProfile; if (profile[0] != null) { //if (profile[0].ReserializeXML) //{ GalleryXML = Photo.MemberXMLGallery(ViewingMember.MemberID); //Photo.SaveMemberXML(GalleryXML, ViewingMember); //} //else //{ // string path = OSRegistry.GetDiskUserDirectory() + ViewingMember.NickName + "/gallery.xml"; // StreamReader reader = new StreamReader(path, System.Text.Encoding.UTF8); // GalleryXML = reader.ReadToEnd(); //} } } else if (strWebNSpotID != null) { NSpot ViewingNSpot = NSpot.GetNSpotByNSpotWebID(strWebNSpotID); if (ViewingNSpot != null) { GalleryXML = Photo.NSpotXMLGallery(ViewingNSpot.NSpotID); //Photo.SaveMemberXML(GalleryXML, ViewingMember); } } }
/// <summary> /// Creates a lister with members friends /// </summary> public void GenerateNSpotMemberLister() { List <Member> NspotMembers = NSpot.GetNSpotMembersByNSpotIDWithJoin(ViewingNSpot.NSpotID); NumberOfMembers = NspotMembers.Count; StringBuilder sbHTMLList = new StringBuilder(); for (int i = 0; i < 10; i++) { if (NspotMembers.Count <= i) { break; } StringBuilder sbHTMLItem = new StringBuilder(); object[] parameters = new object[3]; parameters[0] = NspotMembers[i].WebMemberID; parameters[1] = NspotMembers[i].DefaultPhoto.FullyQualifiedURL; parameters[2] = NspotMembers[i].NickName; string HTMLItem = @"<li><a href='view.aspx?m={0}'> <img src='{1}' alt='friend' width='45' height='45' /></a> <p><a href='view.aspx?m={0}'><strong>{2}</strong></a><br /> Videos: <a href='#'>2</a><br /> Friends: <a href='#'>39</a></p> </li>" ; sbHTMLItem.AppendFormat(HTMLItem, parameters); sbHTMLList.Append(sbHTMLItem.ToString()); } DefaultMemberLister = sbHTMLList.ToString(); }
public TabContents GenerateNspotLister(int TabType, int Page) { List <NSpot> nspots = NSpot.GetTop100NSpots((TopNspotType)TabType); StringBuilder sbHTMLList = new StringBuilder(); int PageSize = 10; int StartAt = (Page * PageSize) - PageSize; for (int i = StartAt; i < StartAt + PageSize; i++) { if (nspots.Count <= i) { break; } StringBuilder sbHTMLItem = new StringBuilder(); object[] parameters = new object[15]; parameters[0] = nspots[i].WebNSpotID; parameters[1] = nspots[i].PhotoResourceFile.FullyQualifiedURL; parameters[2] = nspots[i].Name; parameters[3] = nspots[i].Description; parameters[4] = nspots[i].WebNSpotID; parameters[5] = nspots[i].Member.NickName; parameters[6] = nspots[i].NumberOfViews; parameters[7] = nspots[i].Member.WebMemberID; parameters[8] = nspots[i].NumberOfViews; parameters[9] = nspots[i].NumberOfComments; parameters[10] = nspots[i].TotalVoteScore; parameters[11] = TimeDistance.TimeAgo(nspots[i].DTCreated); string HTMLItem = @"<li> <div class='vid_thumb' style='text-align:center;width:131px;overflow:hidden;'> <a href='nspot.aspx?n={0}'><img src='{1}' height='91' alt='thumb' /></a></div> <div class='vid_info'> <h3><a href='nspot.aspx?n={0}'>{2}</a></h3> <p class='timestamp'>{11}</p> <div class='vote vote_condensed'><span class='vote_count'>{10}</span></div> <p class='metadata'>Views: {8}<br /> Comments: <a href='#'>{9}</a><br /> by: <a href='view.aspx?m={7}'>{5}</a></p> </div> </li>" ; //<li><a href='inbox.aspx?s=Mzk5OWEwN2Y5ZDg5NDg3Mz' class='send_message'>Send Message</a></li> //<li><a href='#' class='send_instant'>Send Instant Message</a></li> //<li><a href='inbox.aspx?f=Mzk5OWEwN2Y5ZDg5NDg3Mz' class='forward'>Forward to a nspot</a></li> //<li><a href='javascript:blocknspot('Mzk5OWEwN2Y5ZDg5NDg3Mz');' class='block'>Block this user</a></li> sbHTMLItem.AppendFormat(HTMLItem, parameters); sbHTMLList.Append(sbHTMLItem.ToString()); } StringBuilder sbPager = new StringBuilder(); object[] PagerParameters = new object[4]; PagerParameters[0] = TabType; PagerParameters[1] = Page - 1; PagerParameters[2] = Page + 1; PagerParameters[3] = TabType; if (Page != 1) { sbPager.AppendFormat("<a href='?t={3}&p={1}' class='previous'>Previous</a>", PagerParameters); } sbPager.AppendFormat("<a href='?t={3}&p={2}' class='next'>next</a>", PagerParameters); TabContents tabContents = new TabContents(); tabContents.HTML = sbHTMLList.ToString(); //tabContents.PagerHTML = sbPager.ToString(); return(tabContents); }
protected void btnSubmit_Click(object sender, EventArgs e) { bool go = true; member = new Member(3); DateTime StartDT = DateTime.Now; DateTime EndDT = DateTime.Now; if (txtNspotName.Text.Length < 5) { litNspotName.Text = "<span class='formerror_msg'>Your NSpot name must be at least 5 characters long</span>"; txtNspotName.CssClass = "form_txt formerror"; go = false; } else { litNspotName.Text = string.Empty; txtNspotName.CssClass = "form_txt"; } try { int Day = Int32.Parse(drpDay.SelectedValue); int Month = Int32.Parse(drpMonth.SelectedValue); int Year = Int32.Parse(drpYear.SelectedValue); int Hour = Int32.Parse(drpHour.SelectedValue); int Minute = Int32.Parse(drpMinute.SelectedValue); StartDT = new DateTime(Year, Month, Day, Hour, Minute, 0); if (StartDT < DateTime.Now) { litBeginTime.Text = "<span class='formerror_msg'>Start Date and Time must be in the future</span>"; go = false; } else { litBeginTime.Text = string.Empty; } } catch { litBeginTime.Text = "<span class='formerror_msg'>Not a valid Date and Time</span>"; } try { int Hour = Int32.Parse(drpHourLast.SelectedValue); EndDT = StartDT.AddHours(Hour); litDuration.Text = string.Empty; } catch { litDuration.Text = "<span class='formerror_msg'>Not a valid Duration</span>"; go = false; } if (txtDescription.Text.Length < 5) { litDescription.Text = "<span class='formerror_msg'>Your NSpot description must be at least 5 characters long</span>"; txtDescription.CssClass = "form_txt formerror"; go = false; } else { litDescription.Text = string.Empty; txtDescription.CssClass = "form_txt"; } if (FileUpload.HasFile) { if (!Photo.IsPhotoFile(FileUpload.FileBytes)) { litBrowsePhoto.Text = "<span class='formerror_msg'>please upload a Jpg or Png photo</span>"; FileUpload.CssClass = "form_txt formerror"; go = false; } else { litBrowsePhoto.Text = string.Empty; FileUpload.CssClass = "form_txt"; } } else { litBrowsePhoto.Text = "<span class='formerror_msg'>please select your NSpot Photo</span>"; FileUpload.CssClass = "form_txt formerror"; go = false; } if (go) { NSpot nspot = new NSpot(); nspot.WebNSpotID = Next2Friends.Misc.UniqueID.NewWebID(); nspot.MemberID = member.MemberID; nspot.Name = txtNspotName.Text; nspot.Description = txtDescription.Text; nspot.StartDateTime = StartDT; nspot.EndDateTime = EndDT; nspot.DTCreated = DateTime.Now; nspot.AskBeforeJoining = ChbMakePrivate.Checked; nspot = Photo.ProcessNSpotPhoto(member, nspot, FileUpload.FileBytes); nspot.Save(); ShowWizard = false; } }
/// <summary> /// Creates a lister with members friends /// </summary> public void GenerateNspotLister() { member = new Member(3); List <NSpot> nspots = NSpot.GetAllNSpotByMemberID(member); StringBuilder sbHTMLList = new StringBuilder(); for (int i = 0; i < 10; i++) { if (nspots.Count <= i) { break; } StringBuilder sbHTMLItem = new StringBuilder(); object[] parameters = new object[15]; parameters[0] = nspots[i].WebNSpotID; parameters[1] = nspots[i].PhotoResourceFile.FullyQualifiedURL; parameters[2] = nspots[i].Name; parameters[3] = nspots[i].Description; parameters[4] = nspots[i].StartDateTime.ToString(); parameters[5] = nspots[i].EndDateTime.ToString("hh:mm dd MMM yyyy"); parameters[6] = nspots[i].EndDateTime.ToString("hh:mm dd MMM yyyy"); parameters[7] = nspots[i].NumberOfMembers.ToString(); parameters[8] = nspots[i].NumberOfViews.ToString(); parameters[9] = nspots[i].NumberOfPhotos.ToString(); parameters[10] = nspots[i].NumberOfComments.ToString(); string HTMLItem = @" <div class='nspot_list clearfix'> <div class='profile_pic'> <a href='nspot.aspx?n={0}'><img src='{1}' alt='pic' /></a> </div> <div class='nspot_data'> <p class='nspot_name'><a href='nspot.aspx?n={0}'>{2}</a></p> <div class='nscol1'> <strong>Started:</strong> {5}<br /> <strong>Ended:</strong> {6}<br /> </div> <div class='nscol2'> <strong>Number of members:</strong> {7}<br /> <strong>Number of views:</strong> {8}<br /> <strong>Number of photos:</strong> {9}<br /> <strong>Number of comments:</strong> {10}<br /> </div> </div> <ul class='nspot_actions'> </ul></div>" ; //<li><a href='inbox.aspx?s=Mzk5OWEwN2Y5ZDg5NDg3Mz' class='send_message'>Send Message</a></li> //<li><a href='#' class='send_instant'>Send Instant Message</a></li> //<li><a href='inbox.aspx?f=Mzk5OWEwN2Y5ZDg5NDg3Mz' class='forward'>Forward to a nspot</a></li> //<li><a href='javascript:blocknspot('Mzk5OWEwN2Y5ZDg5NDg3Mz');' class='block'>Block this user</a></li> sbHTMLItem.AppendFormat(HTMLItem, parameters); sbHTMLList.Append(sbHTMLItem.ToString()); } DefaultNSpotLister = sbHTMLList.ToString(); }