protected void Page_Load(object sender, EventArgs e) { gridManage.OnGetDataSource += new EventHandler(gridManage_OnGetDataSource); if (!IsPostBack) { this.Visible = (BlogId > 0); if (BlogId > 0) { TransitAccountBlog blog = SessionManager.GetInstance <TransitAccountBlog, int>( BlogId, SessionManager.BlogService.GetAccountBlogById); lblBlogName.Text = Renderer.Render(blog.Name); gridManage.RepeatRows = blog.DefaultViewRows; gridManage.VirtualItemCount = Math.Min(gridManage.PageSize, SessionManager.GetCount <TransitAccountBlogPost, TransitAccountBlogPostQueryOptions>( GetBlogPostsOptions(), SessionManager.BlogService.GetAccountBlogPostsCount)); gridManage_OnGetDataSource(this, null); gridManage.DataBind(); linkRelRss.NavigateUrl = string.Format("AccountBlogRss.aspx?id={0}", BlogId); linkRelRss.Title = Renderer.Render(blog.Name); } } }
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("Blogs", Request, "AccountBlogsManage.aspx")); TransitAccountBlog tb = SessionManager.BlogService.GetAccountBlogById(SessionManager.Ticket, BlogId); sitemapdata.Add(new SiteMapDataAttributeNode(tb.Name, Request, string.Format("AccountBlogEdit.aspx?id={0}", tb.Id))); sitemapdata.Add(new SiteMapDataAttributeNode("Authors", Request, string.Format("AccountBlogEdit.aspx?id={0}#authors", tb.Id))); linkBack.NavigateUrl = string.Format("AccountBlogEdit.aspx?id={0}", BlogId); if (RequestId != 0) { TransitAccountBlogAuthor author = SessionManager.BlogService.GetAccountBlogAuthorById(SessionManager.Ticket, RequestId); inputId.Text = string.Format("{0} ({1})", author.AccountName, author.AccountId); inputId.Enabled = false; allowDelete.Checked = author.AllowDelete; allowEdit.Checked = author.AllowEdit; allowPost.Checked = author.AllowPost; sitemapdata.Add(new SiteMapDataAttributeNode(author.AccountName, Request.Url)); } else { sitemapdata.Add(new SiteMapDataAttributeNode("New Author", Request.Url)); } StackSiteMap(sitemapdata); } SetDefaultButton(manageAdd); }
public void save(object sender, EventArgs e) { TransitAccountBlog s = new TransitAccountBlog(); s.Id = RequestId; s.Name = inputName.Text; s.Description = inputDescription.Text; s.AccountId = SessionManager.Account.Id; s.EnableComments = enableComments.Checked; s.DefaultViewRows = int.Parse(inputDefaultViewRows.SelectedValue); if (s.Id == 0) { List <TransitAccountBlog> blogs = SessionManager.BlogService.GetAccountBlogs( SessionManager.Ticket, SessionManager.AccountId, null); foreach (TransitAccountBlog blog in blogs) { if (blog.Name.Trim().ToLower() == s.Name.Trim().ToLower()) { throw new Exception(string.Format("A blog with the same name '{0}' already exists. " + "Click <a href='AccountBlogEdit.aspx?id={1}'>here</a> to modify it.", Renderer.Render(blog.Name), blog.Id)); } } } s.Id = SessionManager.CreateOrUpdate <TransitAccountBlog>( s, SessionManager.BlogService.CreateOrUpdateAccountBlog); SessionManager.InvalidateCache <TransitAccountBlogPost>(); // automatically syndicate the blog SessionManager.BlogService.SyndicateAccountBlog(SessionManager.Ticket, s.Id); Redirect("AccountBlogsManage.aspx"); }
private void GetDataBlogs(object sender, EventArgs e) { // get blogs List <TransitAccountBlog> blogs = new List <TransitAccountBlog>(); blogs.Add(new TransitAccountBlog()); blogs.AddRange(SessionManager.GetCollection <TransitAccountBlog, int>( SessionManager.AccountId, null, SessionManager.BlogService.GetAccountBlogs)); blogs.AddRange(SessionManager.GetCollection <TransitAccountBlog, int>( SessionManager.AccountId, null, SessionManager.BlogService.GetAuthoredAccountBlogs)); inputBlog.DataSource = blogs; inputBlog.DataBind(); if (RequestId > 0) { TransitAccountGroup tw = GetAccountGroup(); if (tw.AccountBlogId > 0) { inputBlog.ClearSelection(); ListItem item = inputBlog.Items.FindByValue(tw.AccountBlogId.ToString()); if (item == null) { TransitAccountBlog t_blog = SessionManager.GetPrivateInstance <TransitAccountBlog, int>( tw.AccountBlogId, SessionManager.BlogService.GetAccountBlogById); blogs.Add(t_blog); item = inputBlog.Items.FindByValue(tw.AccountBlogId.ToString()); inputBlog.DataBind(); } item.Selected = true; } } }
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); }
public void Page_Load(object sender, EventArgs e) { gridManagePosts.OnGetDataSource += new EventHandler(gridManagePosts_OnGetDataSource); gridManageAuthors.OnGetDataSource += new EventHandler(gridManageAuthors_OnGetDataSource); if (!IsPostBack) { SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute(); sitemapdata.Add(new SiteMapDataAttributeNode("Me Me", Request, "AccountManage.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode("Blogs", Request, "AccountBlogsManage.aspx")); DomainClass cs = SessionManager.GetDomainClass("AccountBlog"); inputName.MaxLength = cs["Name"].MaxLengthInChars; if (RequestId > 0) { TransitAccountBlog tf = SessionManager.BlogService.GetAccountBlogById( SessionManager.Ticket, RequestId); inputName.Text = tf.Name; inputDescription.Text = tf.Description; enableComments.Checked = tf.EnableComments; ListItemManager.SelectAdd(inputDefaultViewRows, tf.DefaultViewRows); if (!IsPostBack) { GetBlogPostsData(sender, e); GetBlogAuthorsData(sender, e); } linkNew.NavigateUrl = string.Format("AccountBlogPost.aspx?bid={0}", RequestId); linkNewAuthor.NavigateUrl = string.Format("AccountBlogAuthorEdit.aspx?bid={0}", RequestId); accountredirect.TargetUri = linkPreview.NavigateUrl = string.Format("AccountBlogView.aspx?id={0}", RequestId); sitemapdata.Add(new SiteMapDataAttributeNode(tf.Name, Request.Url)); } else { panelEntries.Visible = false; linkPreview.Visible = false; sitemapdata.Add(new SiteMapDataAttributeNode("New Blog", Request.Url)); } StackSiteMap(sitemapdata); } SetDefaultButton(linkSave); }
public void Page_Load(object sender, EventArgs e) { gridManage.OnGetDataSource += new EventHandler(gridManage_OnGetDataSource); if (!IsPostBack) { TransitAccountBlog blog = AccountBlog; if (blog == null) { Response.StatusCode = 404; Response.End(); return; } labelBlog.Text = Renderer.Render(blog.Name); labelBlogDescription.Text = Renderer.Render(blog.Description); TransitAccount a = SessionManager.GetInstance <TransitAccount, int>( blog.AccountId, SessionManager.AccountService.GetAccountById); labelAccountName.Text = Renderer.Render(a.Name); linkAccount.HRef = string.Format("AccountView.aspx?id={0}", a.Id); imageAccount.Src = string.Format("AccountPictureThumbnail.aspx?id={0}", a.PictureId); licenseView.AccountId = a.Id; linkRelRss.Title = this.Title = string.Format("{0}'s {1}", Renderer.Render(a.Name), Renderer.Render(blog.Name)); GetData(sender, e); if (SessionManager.IsAdministrator) { linkFeature.Text = (LatestAccountBlogFeature != null) ? string.Format("Feature » Last on {0}", Adjust(LatestAccountBlogFeature.Created).ToString("d")) : "Feature » Never Featured"; } linkRelRss.NavigateUrl = string.Format("AccountBlogRss.aspx?id={0}", RequestId); linkEdit.NavigateUrl = string.Format("AccountBlogEdit.aspx?id={0}", RequestId); linkPostNew.NavigateUrl = string.Format("AccountBlogPost.aspx?bid={0}", RequestId); SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute(); sitemapdata.Add(new SiteMapDataAttributeNode("Blogs", Request, "AccountFeedItemsView.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode(blog.Name, Request.Url)); StackSiteMap(sitemapdata); } }
protected void Page_Load(object sender, EventArgs e) { gridManage.OnGetDataSource += new EventHandler(gridManage_OnGetDataSource); if (!IsPostBack) { if (BlogId > 0) { TransitAccountBlog tb = SessionManager.GetInstance <TransitAccountBlog, int>( BlogId, SessionManager.BlogService.GetAccountBlogById); blogName.Text = Renderer.Render(tb.Name); blogDescription.Text = Renderer.Render(tb.Description); linkRelRss.NavigateUrl = string.Format("AccountBlogRss.aspx?id={0}", BlogId); linkRelRss.Title = Renderer.Render(tb.Name); linkRead.NavigateUrl = string.Format("AccountBlogView.aspx?id={0}", BlogId); gridManage.RepeatRows = tb.DefaultViewRows; if (tb.DefaultViewRows > 0) { gridManage.VirtualItemCount = SessionManager.GetCount <TransitAccountBlogPost, TransitAccountBlogPostQueryOptions>( GetBlogPostsOptions(), SessionManager.BlogService.GetAccountBlogPostsCount); gridManage_OnGetDataSource(this, null); gridManage.DataBind(); } StringBuilder sb = new StringBuilder(); if (tb.PostCount > 0) { sb.AppendFormat(" » {0} post{1}", tb.PostCount, tb.PostCount == 1 ? string.Empty : "s"); sb.AppendFormat(" <span class='{0}'>» last post {1}</span>", DateTime.UtcNow.Subtract(tb.Updated).TotalDays < 3 ? "sncore_datetime_highlight" : string.Empty, SessionManager.ToAdjustedString(tb.Updated)); } labelPosts.Text = sb.ToString(); } } }
public void save(object sender, EventArgs e) { TransitAccountBlog s = new TransitAccountBlog(); s.Id = RequestId; s.Name = inputName.Text; s.Description = inputDescription.Text; s.AccountId = SessionManager.Account.Id; s.EnableComments = enableComments.Checked; s.DefaultViewRows = int.Parse(inputDefaultViewRows.SelectedValue); if (s.Id == 0) { List<TransitAccountBlog> blogs = SessionManager.BlogService.GetAccountBlogs( SessionManager.Ticket, SessionManager.AccountId, null); foreach (TransitAccountBlog blog in blogs) { if (blog.Name.Trim().ToLower() == s.Name.Trim().ToLower()) { throw new Exception(string.Format("A blog with the same name '{0}' already exists. " + "Click <a href='AccountBlogEdit.aspx?id={1}'>here</a> to modify it.", Renderer.Render(blog.Name), blog.Id)); } } } s.Id = SessionManager.CreateOrUpdate<TransitAccountBlog>( s, SessionManager.BlogService.CreateOrUpdateAccountBlog); SessionManager.InvalidateCache<TransitAccountBlogPost>(); // automatically syndicate the blog SessionManager.BlogService.SyndicateAccountBlog(SessionManager.Ticket, s.Id); Redirect("AccountBlogsManage.aspx"); }
public int CreateOrUpdateAccountBlog(string ticket, TransitAccountBlog blog) { return WebServiceImpl<TransitAccountBlog, ManagedAccountBlog, AccountBlog>.CreateOrUpdate( ticket, blog); }
public int CreateOrUpdateAccountBlog(string ticket, TransitAccountBlog blog) { return(WebServiceImpl <TransitAccountBlog, ManagedAccountBlog, AccountBlog> .CreateOrUpdate( ticket, blog)); }