public void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { TransitAccountBlogPost t_post = SessionManager.BlogService.GetAccountBlogPostById( SessionManager.Ticket, RequestId); // discussions listDiscussions.DataSource = SessionManager.DiscussionService.GetDiscussions( SessionManager.Ticket, null); listDiscussions.DataBind(); // blogs List <TransitAccountBlog> t_blogs = SessionManager.BlogService.GetAccountBlogs( SessionManager.Ticket, SessionManager.AccountId, null); t_blogs.AddRange(SessionManager.BlogService.GetAuthoredAccountBlogs( SessionManager.Ticket, SessionManager.AccountId, null)); listBlogs.DataSource = t_blogs; listBlogs.DataBind(); // ---- SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute(); sitemapdata.Add(new SiteMapDataAttributeNode("Blogs", Request, "AccountFeedItemsView.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode(t_post.AccountBlogName, Request, string.Format("AccountBlogView.aspx?id={0}", t_post.AccountBlogId))); sitemapdata.Add(new SiteMapDataAttributeNode(t_post.Title, Request, string.Format("AccountBlogPostView.aspx?id={0}", t_post.Id))); sitemapdata.Add(new SiteMapDataAttributeNode("Move", Request.Url)); StackSiteMap(sitemapdata); } }
public void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { TransitAccountBlogPost post = SessionManager.GetPrivateInstance <TransitAccountBlogPost, int>( RequestId, SessionManager.BlogService.GetAccountBlogPostById); if (post == null) { Response.StatusCode = 404; Response.End(); return; } labelAccountName.Text = Renderer.Render(post.AccountName); imageAccount.Src = string.Format("AccountPictureThumbnail.aspx?id={0}", post.AccountPictureId); this.Title = string.Format("{0}'s {1} in {2}", Renderer.Render(post.AccountName), Renderer.Render(post.Title), Renderer.Render(post.AccountBlogName)); licenseView.AccountId = post.AccountId; BlogTitle.Text = Renderer.Render(post.AccountBlogName); BlogPostCreated.Text = base.Adjust(post.Created).ToString(); linkEdit.Visible = post.CanEdit; linkEdit.NavigateUrl = string.Format("AccountBlogPost.aspx?bid={0}&id={1}&ReturnUrl={2}", post.AccountBlogId, post.Id, Renderer.UrlEncode(Request.Url.PathAndQuery)); linkMove.Visible = post.CanEdit && post.CanDelete; linkMove.NavigateUrl = string.Format("AccountBlogPostMove.aspx?id={0}&ReturnUrl={1}", post.Id, Renderer.UrlEncode(Request.Url.PathAndQuery)); linkDelete.Visible = post.CanDelete; linkAccountView.HRef = string.Format("AccountView.aspx?id={0}", post.AccountId); BlogTitle.NavigateUrl = string.Format("AccountBlogView.aspx?id={0}", post.AccountBlogId); BlogPostTitle.Text = Renderer.Render(string.IsNullOrEmpty(post.Title) ? "Untitled" : post.Title); BlogPostBody.Text = RenderEx(post.Body); BlogPostComments.DiscussionId = SessionManager.GetCount <TransitDiscussion, string, int>( typeof(AccountBlogPost).Name, RequestId, SessionManager.DiscussionService.GetOrCreateDiscussionId); BlogPostComments.DataBind(); if (!post.EnableComments) { BlogPostComments.PostNewText = string.Empty; } SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute(); sitemapdata.Add(new SiteMapDataAttributeNode("Blogs", Request, "AccountFeedItemsView.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode(post.AccountBlogName, Request, string.Format("AccountBlogView.aspx?id={0}", post.AccountBlogId))); sitemapdata.Add(new SiteMapDataAttributeNode(post.Title, Request.Url)); StackSiteMap(sitemapdata); } }
public void linkDelete_Click(object sender, EventArgs e) { TransitAccountBlogPost post = SessionManager.GetPrivateInstance <TransitAccountBlogPost, int>( RequestId, SessionManager.BlogService.GetAccountBlogPostById); SessionManager.Delete <TransitAccountBlogPost>(post.Id, SessionManager.BlogService.DeleteAccountBlogPost); Redirect(string.Format("AccountBlogView.aspx?id={0}", post.AccountBlogId)); }
public void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DomainClass cs = SessionManager.GetDomainClass("AccountBlogPost"); inputTitle.MaxLength = cs["Title"].MaxLengthInChars; this.addFile.Attributes["onclick"] = this.files.GetAddFileScriptReference() + "return false;"; linkBack.NavigateUrl = ReturnUrl; TransitAccountBlog blog = SessionManager.BlogService.GetAccountBlogById(SessionManager.Ticket, BlogId); labelAccountName.Text = Renderer.Render(blog.AccountName); labelBlog.Text = Renderer.Render(blog.Name); labelBlogDescription.Text = Renderer.Render(blog.Description); linkAccount.HRef = string.Format("AccountView.aspx?id={0}", blog.AccountId); imageAccount.Src = string.Format("AccountPictureThumbnail.aspx?id={0}", blog.AccountPictureId); if (!blog.EnableComments) { enableComments.Enabled = false; } SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute(); sitemapdata.Add(new SiteMapDataAttributeNode("Me Me", Request, "AccountManage.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode("Blogs", Request, "AccountBlogsManage.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode(blog.Name, Request, string.Format("AccountBlogEdit.aspx?id={0}", blog.Id))); if (RequestId != 0) { TransitAccountBlogPost post = SessionManager.BlogService.GetAccountBlogPostById(SessionManager.Ticket, RequestId); inputBody.Content = post.Body; inputTitle.Text = post.Title; inputSticky.Checked = post.Sticky; inputPublish.Checked = post.Publish; labelLastSaved.Text = string.Format("Last saved: {0}", Adjust(post.Modified)); sitemapdata.Add(new SiteMapDataAttributeNode(post.Title, Request.Url)); linkPreview.NavigateUrl = string.Format("AccountBlogPostView.aspx?id={0}", RequestId); } else { sitemapdata.Add(new SiteMapDataAttributeNode("New Post", Request.Url)); linkPreview.Visible = false; } StackSiteMap(sitemapdata); } SetDefaultButton(linkSave); }
private int saveOnly() { TransitAccountBlogPost tp = new TransitAccountBlogPost(); tp.Title = inputTitle.Text; tp.Body = inputBody.Content; tp.AccountBlogId = BlogId; tp.Id = RequestId; tp.EnableComments = enableComments.Checked; tp.Sticky = inputSticky.Checked; tp.Publish = inputPublish.Checked; tp.Id = SessionManager.CreateOrUpdate <TransitAccountBlogPost>( tp, SessionManager.BlogService.CreateOrUpdateAccountBlogPost); SessionManager.InvalidateCache <TransitAccountBlog>(); return(tp.Id); }
public int CreateOrUpdateAccountBlogPost(string ticket, TransitAccountBlogPost post) { return WebServiceImpl<TransitAccountBlogPost, ManagedAccountBlogPost, AccountBlogPost>.CreateOrUpdate( ticket, post); }
private int saveOnly() { TransitAccountBlogPost tp = new TransitAccountBlogPost(); tp.Title = inputTitle.Text; tp.Body = inputBody.Content; tp.AccountBlogId = BlogId; tp.Id = RequestId; tp.EnableComments = enableComments.Checked; tp.Sticky = inputSticky.Checked; tp.Publish = inputPublish.Checked; tp.Id = SessionManager.CreateOrUpdate<TransitAccountBlogPost>( tp, SessionManager.BlogService.CreateOrUpdateAccountBlogPost); SessionManager.InvalidateCache<TransitAccountBlog>(); return tp.Id; }
public int CreateOrUpdateAccountBlogPost(string ticket, TransitAccountBlogPost post) { return(WebServiceImpl <TransitAccountBlogPost, ManagedAccountBlogPost, AccountBlogPost> .CreateOrUpdate( ticket, post)); }