Esempio n. 1
0
    void GetPictureData(object sender, EventArgs e)
    {
        TransitAccountEventPicture p = AccountEventPicture;

        inputPicture.Src      = string.Format("AccountEventPicture.aspx?id={0}", p.Id);
        inputName.Text        = Renderer.Render(p.Name);
        inputDescription.Text = Renderer.Render(p.Description);
        inputCreated.Text     = Adjust(p.Created).ToString("d");
        inputCounter.Text     = p.Counter.Total.ToString();

        TransitAccountEvent t = AccountEvent;

        labelAccountEventName.Text = this.Title = string.Format("{0}: {1}",
                                                                Renderer.Render(t.Name), string.IsNullOrEmpty(p.Name) ? "Untitled" : Renderer.Render(p.Name));

        linkBack.NavigateUrl = string.Format("AccountEventView.aspx?id={0}", t.Id);
        linkBack.Text        = string.Format("» Back to {0}", Renderer.Render(t.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.ReturnUrl    = string.Format("AccountEventPictureView.aspx?id={0}", PictureId);
        discussionComments.DiscussionId = SessionManager.GetCount <TransitDiscussion, string, int>(
            typeof(AccountEventPicture).Name, PictureId, SessionManager.DiscussionService.GetOrCreateDiscussionId);
        discussionComments.DataBind();
    }
    public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            TransitAccountEvent p = SessionManager.EventService.GetAccountEventById(
                SessionManager.Ticket, AccountEventId, SessionManager.UtcOffset.Ticks);

            linkBack.NavigateUrl = string.Format("AccountEventPicturesManage.aspx?id={0}", p.Id);

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Me Me", Request, "AccountManage.aspx"));
            sitemapdata.Add(new SiteMapDataAttributeNode("Events", Request, "AccountEventsManage.aspx"));
            sitemapdata.Add(new SiteMapDataAttributeNode(p.Name, Request, string.Format("AccountEventView.aspx?id={0}", p.Id)));
            sitemapdata.Add(new SiteMapDataAttributeNode("Pictures", Request, string.Format("AccountEventPicturesManage.aspx?id={0}", p.Id)));

            if (RequestId > 0)
            {
                TransitAccountEventPicture t = SessionManager.EventService.GetAccountEventPictureById(SessionManager.Ticket, RequestId);
                inputName.Text        = t.Name;
                inputDescription.Text = t.Description;
                imageFull.ImageUrl    = string.Format("AccountEventPicture.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 save_Click(object sender, EventArgs e)
 {
     TransitAccountEventPicture t = new TransitAccountEventPicture();
     t.Name = inputName.Text;
     t.Description = inputDescription.Text;
     t.AccountEventId = AccountEventId;
     t.Id = RequestId;
     SessionManager.CreateOrUpdate<TransitAccountEventPicture>(
         t, SessionManager.EventService.CreateOrUpdateAccountEventPicture);
     Redirect(string.Format("AccountEventPicturesManage.aspx?id={0}", AccountEventId));
 }
    public void save_Click(object sender, EventArgs e)
    {
        TransitAccountEventPicture t = new TransitAccountEventPicture();

        t.Name           = inputName.Text;
        t.Description    = inputDescription.Text;
        t.AccountEventId = AccountEventId;
        t.Id             = RequestId;
        SessionManager.CreateOrUpdate <TransitAccountEventPicture>(
            t, SessionManager.EventService.CreateOrUpdateAccountEventPicture);
        Redirect(string.Format("AccountEventPicturesManage.aspx?id={0}", AccountEventId));
    }
Esempio n. 5
0
        public TransitAccountEventPicture GetAccountEventPictureIfModifiedSinceById(string ticket, int id, DateTime ifModifiedSince)
        {
            TransitAccountEventPicture t_instance = WebServiceImpl <TransitAccountEventPicture, ManagedAccountEventPicture, AccountEventPicture> .GetById(
                ticket, id);

            if (t_instance.Modified <= ifModifiedSince)
            {
                return(null);
            }

            return(t_instance);
        }
Esempio n. 6
0
    public override TransitPicture GetPictureWithThumbnail(int id)
    {
        TransitAccountEventPicture p = SessionManager.GetInstance <TransitAccountEventPicture, int>(
            id, SessionManager.EventService.GetAccountEventPictureById);

        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);
    }
Esempio n. 7
0
    public override TransitPicture GetPictureWithBitmap(int id, DateTime ifModifiedSince)
    {
        TransitAccountEventPicture p = SessionManager.GetInstance <TransitAccountEventPicture, int, DateTime>(
            id, ifModifiedSince, SessionManager.EventService.GetAccountEventPictureIfModifiedSinceById);

        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);
    }
Esempio n. 8
0
    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
                {
                    TransitAccountEventPicture p = new TransitAccountEventPicture();
                    ThumbnailBitmap            t = new ThumbnailBitmap(file.InputStream);
                    p.Picture        = t.Bitmap;
                    p.Name           = Path.GetFileName(file.FileName);
                    p.Description    = string.Empty;
                    p.AccountEventId = RequestId;
                    SessionManager.CreateOrUpdate <TransitAccountEventPicture>(
                        p, SessionManager.EventService.CreateOrUpdateAccountEventPicture);
                }
                catch (Exception ex)
                {
                    exceptions.Add(new Exception(string.Format("Error processing {0}: {1}",
                                                               Renderer.Render(file.FileName), ex.Message), ex));
                }
            }

            gridManage.CurrentPageIndex = 0;
            gridManage_OnGetDataSource(sender, e);
            gridManage.DataBind();
            exceptions.Throw();

            Redirect(string.Format("AccountEventView.aspx?id={0}", RequestId));
        }
        catch (Exception ex)
        {
            ReportException(ex);
        }
    }
Esempio n. 9
0
    public void Page_Load(object sender, EventArgs e)
    {
        picturesView.OnGetDataSource += new EventHandler(picturesView_OnGetDataSource);
        if (!IsPostBack)
        {
            mPictureId = RequestId;
            GetPictureData(sender, e);
            GetPicturesData(sender, e);

            TransitAccountEvent        t = AccountEvent;
            TransitAccountEventPicture p = AccountEventPicture;

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Events", Request, "AccountEventsView.aspx"));
            sitemapdata.AddRange(SiteMapDataAttribute.GetLocationAttributeNodes(Request, "AccountEventsToday.aspx", t.PlaceCountry, t.PlaceState, t.PlaceCity, t.PlaceNeighborhood, t.AccountEventType));
            sitemapdata.Add(new SiteMapDataAttributeNode(t.Name, Request, string.Format("AccountEventView.aspx?id={0}", t.Id)));
            sitemapdata.Add(new SiteMapDataAttributeNode("Pictures", Request.Url));
            StackSiteMap(sitemapdata);
        }
    }
Esempio n. 10
0
 public int CreateOrUpdateAccountEventPicture(string ticket, TransitAccountEventPicture eventpicture)
 {
     return(WebServiceImpl <TransitAccountEventPicture, ManagedAccountEventPicture, AccountEventPicture> .CreateOrUpdate(
                ticket, eventpicture));
 }
    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
                {
                    TransitAccountEventPicture p = new TransitAccountEventPicture();
                    ThumbnailBitmap t = new ThumbnailBitmap(file.InputStream);
                    p.Picture = t.Bitmap;
                    p.Name = Path.GetFileName(file.FileName);
                    p.Description = string.Empty;
                    p.AccountEventId = RequestId;
                    SessionManager.CreateOrUpdate<TransitAccountEventPicture>(
                        p, SessionManager.EventService.CreateOrUpdateAccountEventPicture);
                }
                catch (Exception ex)
                {
                    exceptions.Add(new Exception(string.Format("Error processing {0}: {1}",
                        Renderer.Render(file.FileName), ex.Message), ex));
                }
            }

            gridManage.CurrentPageIndex = 0;
            gridManage_OnGetDataSource(sender, e);
            gridManage.DataBind();
            exceptions.Throw();

            Redirect(string.Format("AccountEventView.aspx?id={0}", RequestId));
        }
        catch (Exception ex)
        {
            ReportException(ex);
        }
    }
Esempio n. 12
0
 public int CreateOrUpdateAccountEventPicture(string ticket, TransitAccountEventPicture eventpicture)
 {
     return WebServiceImpl<TransitAccountEventPicture, ManagedAccountEventPicture, AccountEventPicture>.CreateOrUpdate(
         ticket, eventpicture);
 }