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 CreateAccountStoryPicture() { ManagedAccount a = new ManagedAccount(Session); try { a.Create("Test User", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext); a.VerifyAllEmails(); a.AddDefaultPicture(); TransitAccountStory s = new TransitAccountStory(); s.Name = GetNewString(); s.Summary = GetNewString(); ManagedAccountStory ms = new ManagedAccountStory(Session); int story_id = ms.CreateOrUpdate(s, a.GetSecurityContext()); TransitAccountStoryPicture p = new TransitAccountStoryPicture(); p.Name = GetNewString(); p.AccountStoryId = story_id; ManagedAccountStoryPicture mp = new ManagedAccountStoryPicture(Session); mp.CreateOrUpdate(p, a.GetSecurityContext()); } finally { a.Delete(AdminSecurityContext); Session.Flush(); } }
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 save_Click(object sender, EventArgs e) { TransitAccountStoryPicture t = new TransitAccountStoryPicture(); t.Name = inputName.Text; t.AccountStoryId = AccountStoryId; t.Id = RequestId; SessionManager.CreateOrUpdate<TransitAccountStoryPicture>( t, SessionManager.StoryService.CreateOrUpdateAccountStoryPicture); Redirect(string.Format("AccountStoryPicturesManage.aspx?id={0}", AccountStoryId)); }
public void save_Click(object sender, EventArgs e) { TransitAccountStoryPicture t = new TransitAccountStoryPicture(); t.Name = inputName.Text; t.AccountStoryId = AccountStoryId; t.Id = RequestId; SessionManager.CreateOrUpdate <TransitAccountStoryPicture>( t, SessionManager.StoryService.CreateOrUpdateAccountStoryPicture); Redirect(string.Format("AccountStoryPicturesManage.aspx?id={0}", AccountStoryId)); }
public TransitAccountStoryPicture GetAccountStoryPictureIfModifiedSinceById(string ticket, int id, DateTime ifModifiedSince) { TransitAccountStoryPicture t_instance = WebServiceImpl <TransitAccountStoryPicture, ManagedAccountStoryPicture, AccountStoryPicture> .GetById( ticket, id); if (t_instance.Modified <= ifModifiedSince) { return(null); } return(t_instance); }
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 override TransitPicture GetPictureWithThumbnail(int id) { TransitAccountStoryPicture p = SessionManager.GetInstance <TransitAccountStoryPicture, int>( id, SessionManager.StoryService.GetAccountStoryPictureById); if (p == null) { return(null); } TransitPicture result = new TransitPicture(); result.Id = p.Id; result.Bitmap = p.Thumbnail; result.Created = p.Created; result.Modified = p.Modified; result.Name = p.Name; return(result); }
public override TransitPicture GetPictureWithBitmap(int id, DateTime ifModifiedSince) { TransitAccountStoryPicture p = SessionManager.GetInstance <TransitAccountStoryPicture, int, DateTime>( id, ifModifiedSince, SessionManager.StoryService.GetAccountStoryPictureIfModifiedSinceById); if (p == null) { return(null); } TransitPicture result = new TransitPicture(); result.Id = p.Id; result.Bitmap = p.Picture; result.Created = p.Created; result.Modified = p.Modified; result.Name = p.Name; return(result); }
protected void files_FilesPosted(object sender, FilesPostedEventArgs e) { try { if (e.PostedFiles.Count == 0) { return; } ExceptionCollection exceptions = new ExceptionCollection(); foreach (HttpPostedFile file in e.PostedFiles) { try { TransitAccountStoryPicture p = new TransitAccountStoryPicture(); ThumbnailBitmap t = new ThumbnailBitmap(file.InputStream); p.Picture = t.Bitmap; p.Name = Path.GetFileName(file.FileName); p.AccountStoryId = RequestId; SessionManager.CreateOrUpdate <TransitAccountStoryPicture>( p, SessionManager.StoryService.CreateOrUpdateAccountStoryPicture); } catch (Exception ex) { exceptions.Add(new Exception(string.Format("Error processing {0}: {1}", Renderer.Render(file.FileName), ex.Message), ex)); } } GetData(sender, e); exceptions.Throw(); } catch (Exception ex) { ReportException(ex); } }
protected void files_FilesPosted(object sender, FilesPostedEventArgs e) { try { if (e.PostedFiles.Count == 0) return; ExceptionCollection exceptions = new ExceptionCollection(); foreach (HttpPostedFile file in e.PostedFiles) { try { TransitAccountStoryPicture p = new TransitAccountStoryPicture(); ThumbnailBitmap t = new ThumbnailBitmap(file.InputStream); p.Picture = t.Bitmap; p.Name = Path.GetFileName(file.FileName); p.AccountStoryId = RequestId; SessionManager.CreateOrUpdate<TransitAccountStoryPicture>( p, SessionManager.StoryService.CreateOrUpdateAccountStoryPicture); } catch (Exception ex) { exceptions.Add(new Exception(string.Format("Error processing {0}: {1}", Renderer.Render(file.FileName), ex.Message), ex)); } } GetData(sender, e); exceptions.Throw(); } catch (Exception ex) { ReportException(ex); } }
public int CreateOrUpdateAccountStoryPicture(string ticket, TransitAccountStoryPicture picture) { return(WebServiceImpl <TransitAccountStoryPicture, ManagedAccountStoryPicture, AccountStoryPicture> .CreateOrUpdate( ticket, picture)); }
public int CreateOrUpdateAccountStoryPicture(string ticket, TransitAccountStoryPicture picture) { return WebServiceImpl<TransitAccountStoryPicture, ManagedAccountStoryPicture, AccountStoryPicture>.CreateOrUpdate( ticket, picture); }