void GetPictureData(object sender, EventArgs e) { TransitAccountStoryPicture p = AccountStoryPicture; inputPicture.Src = string.Format("AccountStoryPicture.aspx?id={0}", p.Id); inputName.Text = Renderer.Render(p.Name); inputCreated.Text = Adjust(p.Created).ToString("d"); inputCounter.Text = p.Counter.Total.ToString(); TransitAccountStory l = AccountStory; labelAccountStoryName.Text = this.Title = string.Format("{0}: {1}", Renderer.Render(l.Name), string.IsNullOrEmpty(p.Name) ? "Untitled" : Renderer.Render(p.Name)); linkBack.NavigateUrl = string.Format("AccountStoryView.aspx?id={0}", l.Id); linkBack.Text = string.Format("» Back to {0}", Renderer.Render(l.Name)); linkComments.Visible = p.CommentCount > 0; linkComments.Text = string.Format("» {0} comment{1}", (p.CommentCount > 0) ? p.CommentCount.ToString() : "no", (p.CommentCount == 1) ? "" : "s"); linkPrev.Enabled = p.PrevId > 0; linkPrev.CommandArgument = p.PrevId.ToString(); linkNext.Enabled = p.NextId > 0; linkNext.CommandArgument = p.NextId.ToString(); labelIndex.Text = string.Format("{0} / {1}", p.Index + 1, p.Count); discussionComments.DiscussionId = SessionManager.GetCount <TransitDiscussion, string, int>( typeof(AccountStoryPicture).Name, PictureId, SessionManager.DiscussionService.GetOrCreateDiscussionId); discussionComments.DataBind(); }
public void CreateManyStoriesPerAccount(int count, int wordsperstory) { Random r = new Random(); IList accounts = Session.CreateCriteria(typeof(Account)).List(); foreach (Account a in accounts) { for (int i = 0; i < count; i++) { TransitAccountStory s = new TransitAccountStory(); s.Name = Guid.NewGuid().ToString(); List <string> words = new List <string>(wordsperstory); for (int w = 0; w < wordsperstory; w++) { StringBuilder word = new StringBuilder(); int len = r.Next() % 10 + 1; for (int l = 0; l < len; l++) { word.Append((char)(r.Next() % 26 + 'a')); } s.Summary = s.Summary + word.ToString() + (w == 0 ? "" : " "); } ManagedAccount ma = new ManagedAccount(Session, a); ManagedAccountStory ms = new ManagedAccountStory(Session); ms.CreateOrUpdate(s, ma.GetSecurityContext()); } } }
public void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { TransitAccountStory p = SessionManager.StoryService.GetAccountStoryById(SessionManager.Ticket, AccountStoryId); linkBack.NavigateUrl = string.Format("AccountStoryPicturesManage.aspx?id={0}", p.Id); SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute(); sitemapdata.Add(new SiteMapDataAttributeNode("Me Me", Request, "AccountManage.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode("Stories", Request, "AccountStoriesManage.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode(p.Name, Request, string.Format("AccountStoryView.aspx?id={0}", p.Id))); sitemapdata.Add(new SiteMapDataAttributeNode("Pictures", Request, string.Format("AccountStoryPicturesManage.aspx?id={0}", p.Id))); if (RequestId > 0) { TransitAccountStoryPicture t = SessionManager.StoryService.GetAccountStoryPictureById(SessionManager.Ticket, RequestId); inputName.Text = t.Name; imageFull.ImageUrl = string.Format("AccountStoryPicture.aspx?id={0}&CacheDuration=0", t.Id); sitemapdata.Add(new SiteMapDataAttributeNode(t.Name, Request.Url)); } else { sitemapdata.Add(new SiteMapDataAttributeNode("New Picture", Request.Url)); } StackSiteMap(sitemapdata); } SetDefaultButton(manageAdd); }
public void linkSummarize_Click(object sender, EventArgs e) { List <HtmlImage> list = HtmlImageExtractor.Extract(inputSummary.Content); string imageuri = string.Empty; if (list.Count > 0) { imageuri = list[0].Src; imageuri = imageuri.Replace("AccountStoryPicture.aspx", "AccountStoryPictureThumbnail.aspx"); } else { TransitAccountStory ts = SessionManager.StoryService.GetAccountStoryById( SessionManager.Ticket, RequestId); imageuri = string.Format("AccountStoryPictureThumbnail.aspx?id={0}", ts.AccountStoryPictureId); } labelSummary.Text = string.Format( "<table cellpadding='4' cellspacing='4'>\n" + "<tr>\n" + "<td valign='middle'>\n" + "<a href='{2}'><img border='0' src='{0}'></a>\n" + "</td>\n" + "<td valign='middle'>\n" + "<p><a href='{2}'>{3}</a></p>\n" + "<p>{1}</p>\n" + "</td>\n" + "</tr>\n" + "</table>", imageuri, Renderer.GetSummary(inputSummary.Content), string.Format("AccountStoryView.aspx?id={0}", RequestId), Renderer.Render(inputName.Text)); }
public void Page_Load(object sender, EventArgs e) { this.addFile.Attributes["onclick"] = this.files.GetAddFileScriptReference() + "return false;"; if (!IsPostBack) { TransitAccountStory ts = SessionManager.StoryService.GetAccountStoryById( SessionManager.Ticket, RequestId); linkBack.NavigateUrl = string.Format("AccountStoryEdit.aspx?id={0}", ts.Id); GetData(sender, e); SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute(); sitemapdata.Add(new SiteMapDataAttributeNode("Me Me", Request, "AccountManage.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode("Stories", Request, "AccountStoriesManage.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode(ts.Name, Request, string.Format("AccountStoryEdit.aspx?id={0}", ts.Id))); sitemapdata.Add(new SiteMapDataAttributeNode("Pictures", Request.Url)); StackSiteMap(sitemapdata); } if (!SessionManager.HasVerified()) { ReportWarning("You don't have any verified e-mail addresses and/or profile photos.\n" + "You must add/confirm a valid e-mail address and upload a profile photo before uploading story pictures."); picturesAdd.Enabled = false; } SetDefaultButton(picturesAdd); }
public string GetAccountStory(TransitAccountStory s) { if (s == null) { return(string.Empty); } else { return("new story: " + Renderer.Render(s.Name)); } }
private int saveOnly() { TransitAccountStory s = new TransitAccountStory(); s.Name = inputName.Text; s.Summary = inputSummary.Content; s.Publish = inputPublish.Checked; s.Id = RequestId; s.Id = SessionManager.CreateOrUpdate <TransitAccountStory>( s, SessionManager.StoryService.CreateOrUpdateAccountStory); labelLastSaved.Text = string.Format("Last saved: {0}", Adjust(DateTime.UtcNow)); return(s.Id); }
public void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute(); sitemapdata.Add(new SiteMapDataAttributeNode("Me Me", Request, "AccountManage.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode("Stories", Request, "AccountStoriesManage.aspx")); DomainClass cs = SessionManager.GetDomainClass("AccountStory"); inputName.MaxLength = cs["Name"].MaxLengthInChars; if (RequestId > 0) { TransitAccountStory ts = SessionManager.StoryService.GetAccountStoryById( SessionManager.Ticket, RequestId); inputName.Text = ts.Name; inputSummary.Content = ts.Summary; inputPublish.Checked = ts.Publish; linkAddPictures.NavigateUrl = string.Format("AccountStoryPicturesManage.aspx?id={0}", ts.Id); linkView.NavigateUrl = string.Format("AccountStoryView.aspx?id={0}", ts.Id); labelTitle.Text = "Edit Story"; sitemapdata.Add(new SiteMapDataAttributeNode(ts.Name, Request.Url)); labelLastSaved.Text = string.Format("Last saved: {0}", Adjust(ts.Modified)); } else { linkAddPictures.Visible = false; sitemapdata.Add(new SiteMapDataAttributeNode("New Story", Request.Url)); } StackSiteMap(sitemapdata); GetImagesData(sender, e); } if (!SessionManager.HasVerified()) { ReportWarning("You don't have any verified e-mail addresses and/or profile photos.\n" + "You must add/confirm a valid e-mail address and upload a profile photo before posting stories."); linkSave.Enabled = false; } SetDefaultButton(linkSave); }
public void Page_Load(object sender, EventArgs e) { picturesView.OnGetDataSource += new EventHandler(picturesView_OnGetDataSource); if (!IsPostBack) { mPictureId = RequestId; GetPictureData(sender, e); GetPicturesData(sender, e); TransitAccountStoryPicture p = AccountStoryPicture; TransitAccountStory s = AccountStory; SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute(); sitemapdata.Add(new SiteMapDataAttributeNode("Stories", Request, "AccountStoriesView.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode(s.Name, Request, string.Format("AccountStoryView.aspx?id={0}", s.Id))); sitemapdata.Add(new SiteMapDataAttributeNode(string.Format("Pictures > {0}", p.Name), Request.Url)); StackSiteMap(sitemapdata); } }
public void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { TransitAccountStory ts = SessionManager.GetInstance <TransitAccountStory, int>( RequestId, SessionManager.StoryService.GetAccountStoryById); TransitAccount acct = SessionManager.GetInstance <TransitAccount, int>( ts.AccountId, SessionManager.AccountService.GetAccountById); licenseView.AccountId = acct.Id; picturesView.AccountStoryId = ts.Id; this.Title = string.Format("{0}'s {1}", Renderer.Render(acct.Name), Renderer.Render(ts.Name)); storyName.Text = Renderer.Render(ts.Name); storySummary.Text = RenderEx(ts.Summary); storyComments.DiscussionId = SessionManager.GetCount <TransitDiscussion, string, int>( typeof(AccountStory).Name, RequestId, SessionManager.DiscussionService.GetOrCreateDiscussionId); storyComments.DataBind(); linkEdit.NavigateUrl = string.Format("AccountStoryEdit.aspx?id={0}", ts.Id); linkAddPhotos.NavigateUrl = string.Format("AccountStoryPicturesManage.aspx?id={0}", ts.Id); panelOwner.Visible = SessionManager.IsLoggedIn && (SessionManager.IsAdministrator || ts.AccountId == SessionManager.Account.Id); linkAuthor.NavigateUrl = string.Format("AccountView.aspx?id={0}", ts.AccountId); linkAuthor.Text = string.Format("written by » {0}", Renderer.Render(ts.AccountName)); SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute(); sitemapdata.Add(new SiteMapDataAttributeNode("Stories", Request, "AccountStoriesView.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode(ts.Name, Request.Url)); StackSiteMap(sitemapdata); } }
private int saveOnly() { TransitAccountStory s = new TransitAccountStory(); s.Name = inputName.Text; s.Summary = inputSummary.Content; s.Publish = inputPublish.Checked; s.Id = RequestId; s.Id = SessionManager.CreateOrUpdate<TransitAccountStory>( s, SessionManager.StoryService.CreateOrUpdateAccountStory); labelLastSaved.Text = string.Format("Last saved: {0}", Adjust(DateTime.UtcNow)); return s.Id; }
public int CreateOrUpdateAccountStory(string ticket, TransitAccountStory story) { return(WebServiceImpl <TransitAccountStory, ManagedAccountStory, AccountStory> .CreateOrUpdate( ticket, story)); }
public int GetAccountStoryId(TransitAccountStory s) { return((s == null) ? 0 : s.Id); }
public int GetAccountStoryId(TransitAccountStory s) { return (s == null) ? 0 : s.Id; }
public void CreateManyStoriesPerAccount(int count, int wordsperstory) { Random r = new Random(); IList accounts = Session.CreateCriteria(typeof(Account)).List(); foreach (Account a in accounts) { for (int i = 0; i < count; i++) { TransitAccountStory s = new TransitAccountStory(); s.Name = Guid.NewGuid().ToString(); List<string> words = new List<string>(wordsperstory); for (int w = 0; w < wordsperstory; w++) { StringBuilder word = new StringBuilder(); int len = r.Next() % 10 + 1; for (int l = 0; l < len; l++) { word.Append((char)(r.Next() % 26 + 'a')); } s.Summary = s.Summary + word.ToString() + (w == 0 ? "" : " "); } ManagedAccount ma = new ManagedAccount(Session, a); ManagedAccountStory ms = new ManagedAccountStory(Session); ms.CreateOrUpdate(s, ma.GetSecurityContext()); } } }
public string GetAccountStory(TransitAccountStory s) { if (s == null) { return string.Empty; } else { return "new story: " + Renderer.Render(s.Name); } }
public int CreateOrUpdateAccountStory(string ticket, TransitAccountStory story) { return WebServiceImpl<TransitAccountStory, ManagedAccountStory, AccountStory>.CreateOrUpdate( ticket, story); }