public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (RequestId == 0)
            {
                Redirect("Default.aspx");
                return;
            }

            TransitDiscussionThread t = SessionManager.GetPrivateInstance <TransitDiscussionThread, int>(
                RequestId, SessionManager.DiscussionService.GetDiscussionThreadById);

            if (t == null)
            {
                ReportWarning("Discussion has been deleted or invalid discussion thread.");
                return;
            }

            TransitDiscussion td = SessionManager.GetPrivateInstance <TransitDiscussion, int>(
                t.DiscussionId, SessionManager.DiscussionService.GetDiscussionById);

            if (td.Personal)
            {
                string uri = SessionManager.DiscussionService.GetThreadRedirectUri(
                    SessionManager.Ticket, td.Id);

                if (!string.IsNullOrEmpty(uri))
                {
                    Redirect(uri);
                    return;
                }
            }

            this.Title = Renderer.Render(td.Name);

            discussionMain.DiscussionThreadId = RequestId;
            discussionMain.DiscussionId       = t.DiscussionId;
            discussionMain.DataBind();

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();

            if (!string.IsNullOrEmpty(td.ParentObjectName))
            {
                sitemapdata.Add(new SiteMapDataAttributeNode(td.ParentObjectName, Request, td.ParentObjectUri));
                sitemapdata.Add(new SiteMapDataAttributeNode(td.Name, Request, string.Format("{0}#discuss", td.ParentObjectUri)));
                sitemapdata.Add(new SiteMapDataAttributeNode("Thread", Request.Url));
            }
            else
            {
                sitemapdata.Add(new SiteMapDataAttributeNode("Discussions", Request, "DiscussionsView.aspx"));
                sitemapdata.Add(new SiteMapDataAttributeNode(td.Name, Request, string.Format("DiscussionView.aspx?id={0}", td.Id)));
                sitemapdata.Add(new SiteMapDataAttributeNode("Thread", Request.Url));
            }
            StackSiteMap(sitemapdata);
        }
    }
Beispiel #2
0
    public void move_Click(object sender, EventArgs args)
    {
        SessionManager.DiscussionService.MoveDiscussionThread(
            SessionManager.Ticket,
            RequestId,
            int.Parse(listDiscussions.SelectedValue));

        SessionManager.InvalidateCache <TransitDiscussion>();
        SessionManager.InvalidateCache <TransitDiscussionThread>();
        SessionManager.InvalidateCache <TransitDiscussionPost>();

        TransitDiscussionThread tt = SessionManager.DiscussionService.GetDiscussionThreadById(
            SessionManager.Ticket, RequestId);

        Redirect(string.Format("DiscussionThreadView.aspx?id={0}&did={1}",
                               tt.Id, tt.DiscussionId));
    }
Beispiel #3
0
    public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            TransitDiscussionThread tt = SessionManager.DiscussionService.GetDiscussionThreadById(
                SessionManager.Ticket, RequestId);

            TransitDiscussion td = SessionManager.DiscussionService.GetDiscussionById(
                SessionManager.Ticket, tt.DiscussionId);

            TransitDiscussionPost tp = SessionManager.DiscussionService.GetDiscussionThreadPost(
                SessionManager.Ticket, tt.Id);

            this.Title = Renderer.Render(td.Name);

            if (td.ObjectId != 0 && !string.IsNullOrEmpty(td.ParentObjectType))
            {
                listDiscussions.DataSource = SessionManager.DiscussionService.GetDiscussionsByObjectId(
                    SessionManager.Ticket, td.ParentObjectType, td.ObjectId, null);
            }
            else
            {
                listDiscussions.DataSource = SessionManager.DiscussionService.GetDiscussions(
                    SessionManager.Ticket, null);
            }

            listDiscussions.DataBind();

            ListItemManager.TrySelect(listDiscussions, tt.DiscussionId);

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Discussions", Request, "DiscussionsView.aspx"));
            sitemapdata.Add(new SiteMapDataAttributeNode(td.Name, Request, string.Format("DiscussionView.aspx?id={0}", td.Id)));
            sitemapdata.Add(new SiteMapDataAttributeNode(tp.Subject, Request, string.Format("DiscussionThreadView.aspx?id={0}&did={1}", tp.DiscussionThreadId, td.Id)));
            sitemapdata.Add(new SiteMapDataAttributeNode("Move", Request.Url));
            StackSiteMap(sitemapdata);
        }
    }