Ejemplo n.º 1
0
    public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (GroupId == 0)
            {
                throw new Exception("Missing Group");
            }

            TransitAccountGroup group = SessionManager.GroupService.GetAccountGroupById(
                SessionManager.Ticket, GroupId);
            linkAccountGroup.NavigateUrl = string.Format("AccountGroupView.aspx?id={0}", group.Id);
            linkBack.NavigateUrl         = ReturnUrl;
            linkAccountGroup.Text        = Renderer.Render(group.Name);
            imageAccountGroup.ImageUrl   = string.Format("AccountGroupPictureThumbnail.aspx?id={0}", group.PictureId);
            inputMessage.Text            = string.Format("Hi,\n\nI would like to join \"{0}\".\n\nThanks!\n", Renderer.Render(group.Name));

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Groups", Request, "AccountGroupsView.aspx"));
            sitemapdata.Add(new SiteMapDataAttributeNode(group.Name, Request, string.Format("AccountGroupView.aspx?id={0}", group.Id)));
            sitemapdata.Add(new SiteMapDataAttributeNode("Join", Request.Url));
            StackSiteMap(sitemapdata);
        }

        SetDefaultButton(manageSave);

        if (!SessionManager.HasVerified())
        {
            ReportWarning("You don't have any verified e-mail addresses and/or profile photos.\n" +
                          "You must add/confirm a valid e-mail address and upload a profile photo before joining groups.");

            manageSave.Enabled = false;
        }
    }
    public void listPending_ItemCommand(object sender, DataListCommandEventArgs e)
    {
        switch (e.CommandName)
        {
        case "Accept":
        {
            int id = int.Parse(e.CommandArgument.ToString());
            TransitAccountGroupAccountInvitation t_instance = SessionManager.GroupService.GetAccountGroupAccountInvitationById(
                SessionManager.Ticket, id);
            SessionManager.GroupService.AcceptAccountGroupAccountInvitation(SessionManager.Ticket, id, inputReason.Text);
            GetData(sender, e);
            TransitAccountGroup t_group = SessionManager.GetInstance <TransitAccountGroup, int>(
                t_instance.AccountGroupId, SessionManager.GroupService.GetAccountGroupById);
            ReportInfo(t_instance.AccountGroupIsPrivate && !t_instance.RequesterIsAdministrator
                        ? "Since this is a private group, your membership must first be approved by the group administrator. A request has been submitted."
                        : string.Format("Invitation accepted. Click <a href='AccountGroupView.aspx?id={0}'>here</a> for \"{1}\".", t_group.Id, Renderer.Render(t_group.Name)));
            break;
        }

        case "Reject":
        {
            int id = int.Parse(e.CommandArgument.ToString());
            SessionManager.GroupService.RejectAccountGroupAccountInvitation(SessionManager.Ticket, id, inputReason.Text);
            GetData(sender, e);
            ReportInfo("Invitation rejected.");
            break;
        }
        }
    }
Ejemplo n.º 3
0
    public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            TransitAccountGroup p = SessionManager.GroupService.GetAccountGroupById(
                SessionManager.Ticket, AccountGroupId);
            linkBack.NavigateUrl = string.Format("AccountGroupPicturesManage.aspx?id={0}", p.Id);

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Groups", Request, "AccountGroupsView.aspx"));
            sitemapdata.Add(new SiteMapDataAttributeNode(p.Name, Request, string.Format("AccountGroupView.aspx?id={0}", p.Id)));
            sitemapdata.Add(new SiteMapDataAttributeNode("Pictures", Request, string.Format("AccountGroupPicturesManage.aspx?id={0}", p.Id)));

            if (RequestId > 0)
            {
                TransitAccountGroupPicture t = SessionManager.GroupService.GetAccountGroupPictureById(SessionManager.Ticket, RequestId);
                inputName.Text        = t.Name;
                inputDescription.Text = t.Description;
                imageFull.ImageUrl    = string.Format("AccountGroupPicture.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);
    }
Ejemplo n.º 4
0
    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)
    {
        this.addFile.Attributes["onclick"] = this.files.GetAddFileScriptReference() + "return false;";
        gridManage.OnGetDataSource        += new EventHandler(gridManage_OnGetDataSource);

        if (!IsPostBack)
        {
            TransitAccountGroup group = SessionManager.GroupService.GetAccountGroupById(SessionManager.Ticket, RequestId);

            GetData(sender, e);

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Groups", Request, "AccountGroupsView.aspx"));
            sitemapdata.Add(new SiteMapDataAttributeNode(group.Name, Request, string.Format("AccountGroupView.aspx?id={0}", group.Id)));
            sitemapdata.Add(new SiteMapDataAttributeNode("Pictures", Request.Url));
            StackSiteMap(sitemapdata);
        }

        if (!SessionManager.HasVerified())
        {
            ReportWarning("You don't have any verified e-mail addresses and/or profile photos.\n" +
                          "You must add/confirm a valid e-mail address and upload a profile photo before uploading group pictures.");

            addFile.Enabled = false;
            save.Enabled    = false;
        }
    }
Ejemplo n.º 6
0
    public void save_Click(object sender, EventArgs e)
    {
        TransitAccountGroup tw = new TransitAccountGroup();

        tw.Name          = inputName.Text;
        tw.Description   = inputDescription.Text;
        tw.IsPrivate     = inputPrivate.Checked;
        tw.Id            = RequestId;
        tw.AccountBlogId = (!string.IsNullOrEmpty(inputBlog.SelectedValue)) ? int.Parse(inputBlog.SelectedValue) : 0;
        SessionManager.CreateOrUpdate <TransitAccountGroup>(
            tw, SessionManager.GroupService.CreateOrUpdateAccountGroup);
        Redirect(ReturnUrl);
    }
Ejemplo n.º 7
0
    public string GetDataObjectName()
    {
        switch (Feature.DataObjectName)
        {
        case "AccountFeed":
        {
            TransitAccountFeed t_instance = SessionManager.GetInstance <TransitAccountFeed, int>(
                Feature.DataRowId, SessionManager.SyndicationService.GetAccountFeedById);
            return(t_instance.Name);
        }

        case "AccountFeedItem":
        {
            TransitAccountFeedItem t_instance = SessionManager.GetInstance <TransitAccountFeedItem, int>(
                Feature.DataRowId, SessionManager.SyndicationService.GetAccountFeedItemById);
            return(t_instance.Title);
        }

        case "Account":
        {
            TransitAccount t_instance = SessionManager.GetInstance <TransitAccount, int>(
                Feature.DataRowId, SessionManager.AccountService.GetAccountById);
            return(t_instance.Name);
        }

        case "AccountEvent":
        {
            TransitAccountEvent t_instance = SessionManager.GetInstance <TransitAccountEvent, int, long>(
                Feature.DataRowId, 0, SessionManager.EventService.GetAccountEventById);
            return(t_instance.Name);
        }

        case "AccountGroup":
        {
            TransitAccountGroup t_instance = SessionManager.GetInstance <TransitAccountGroup, int>(
                Feature.DataRowId, SessionManager.GroupService.GetAccountGroupById);
            return(t_instance.Name);
        }

        case "Place":
        {
            TransitPlace t_instance = SessionManager.GetInstance <TransitPlace, int>(
                Feature.DataRowId, SessionManager.PlaceService.GetPlaceById);
            return(t_instance.Name);
        }
        }

        return(string.Empty);
    }
Ejemplo n.º 8
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);

            TransitAccountGroup  p           = AccountGroup;
            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Groups", Request, "AccountGroupsView.aspx"));
            sitemapdata.Add(new SiteMapDataAttributeNode(p.Name, Request, string.Format("AccountGroupView.aspx?id={0}", p.Id)));
            sitemapdata.Add(new SiteMapDataAttributeNode("Pictures", Request.Url));
            StackSiteMap(sitemapdata);
        }
    }
Ejemplo n.º 9
0
    public void Page_Load(object sender, EventArgs e)
    {
        gridManage.OnGetDataSource += new EventHandler(gridManage_OnGetDataSource);
        if (!IsPostBack)
        {
            TransitAccountGroup ta = SessionManager.GroupService.GetAccountGroupById(
                SessionManager.Ticket, RequestId);

            labelName.Text               = string.Format("{0}'s Places", Render(ta.Name));
            linkAccountGroup.Text        = string.Format("&#187; Back to {0}", Render(ta.Name));
            linkAccountGroup.NavigateUrl = string.Format("AccountGroupView.aspx?id={0}", ta.Id);
            linkRelRss.NavigateUrl       = string.Format("AccountGroupPlacesRss.aspx?id={0}", ta.Id);

            GetData(sender, e);

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Groups", Request, "AccountGroupsView.aspx"));
            sitemapdata.Add(new SiteMapDataAttributeNode(ta.Name, Request, string.Format("AccountGroupView.aspx?id={0}", ta.Id)));
            sitemapdata.Add(new SiteMapDataAttributeNode("Places", Request.Url));
            StackSiteMap(sitemapdata);
        }
    }
Ejemplo n.º 10
0
    public void Page_Load(object sender, EventArgs e)
    {
        gridManage.OnGetDataSource += new EventHandler(gridManage_OnGetDataSource);
        if (!IsPostBack)
        {
            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Me Me", Request, "AccountManage.aspx"));
            sitemapdata.Add(new SiteMapDataAttributeNode("Groups", Request, "AccountGroupsManage.aspx"));

            linkBack.NavigateUrl          = ReturnUrl;
            linkNewDiscussion.NavigateUrl = string.Format("SystemDiscussionEdit.aspx?Type=AccountGroup&ObjectId={0}&ReturnUrl={1}",
                                                          RequestId, Renderer.UrlEncode(Request.Url.PathAndQuery));

            // get group data
            if (RequestId > 0)
            {
                GetData(sender, e);

                TransitAccountGroup tw = GetAccountGroup();

                inputName.Text        = tw.Name;
                inputDescription.Text = tw.Description;
                inputPrivate.Checked  = tw.IsPrivate;
                sitemapdata.Add(new SiteMapDataAttributeNode(tw.Name, Request.Url));
            }
            else
            {
                linkNewDiscussion.Visible = false;
                sitemapdata.Add(new SiteMapDataAttributeNode("New Group", Request.Url));
            }

            GetDataBlogs(sender, e);
            StackSiteMap(sitemapdata);
        }

        SetDefaultButton(manageAdd);
    }
Ejemplo n.º 11
0
    void GetPictureData(object sender, EventArgs e)
    {
        TransitAccountGroupPicture p = AccountGroupPicture;

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

        TransitAccountGroup l = AccountGroup;

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

        labelAccountGroupName.Text = Renderer.Render(l.Name);

        linkBack.NavigateUrl = string.Format("AccountGroupView.aspx?id={0}", l.Id);
        linkBack.Text        = string.Format("&#187; Back to {0}", Renderer.Render(l.Name));
        linkComments.Visible = p.CommentCount > 0;
        linkComments.Text    = string.Format("&#187; {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("AccountGroupPictureView.aspx?id={0}", PictureId);
        discussionComments.DiscussionId = SessionManager.GetCount <TransitDiscussion, string, int>(
            typeof(AccountGroupPicture).Name, PictureId, SessionManager.DiscussionService.GetOrCreateDiscussionId);
        discussionComments.DataBind();
    }
Ejemplo n.º 12
0
    public void Page_Load(object sender, EventArgs e)
    {
        friendsList.OnGetDataSource += new EventHandler(friendsList_OnGetDataSource);

        if (!IsPostBack)
        {
            linkBack.NavigateUrl = ReturnUrl;

            if (GroupId == 0)
            {
                panelInvite.Visible = false;
                throw new Exception("Missing Group");
            }

            if (GetAccountGroupAccount() == null && !SessionManager.IsAdministrator)
            {
                panelInvite.Visible = false;
                throw new Exception("You must be a member of the group to invite friends.");
            }

            GetData(sender, e);

            TransitAccountGroup group = SessionManager.GroupService.GetAccountGroupById(
                SessionManager.Ticket, GroupId);
            linkAccountGroup.NavigateUrl = string.Format("AccountGroupView.aspx?id={0}", group.Id);
            linkAccountGroup.Text        = Renderer.Render(group.Name);
            imageAccountGroup.ImageUrl   = string.Format("AccountGroupPictureThumbnail.aspx?id={0}", group.PictureId);
            inputMessage.Text            = string.Format("Hi,\n\nI would like to invite you to \"{0}\".\n\nJoin in!\n", Renderer.Render(group.Name));

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Groups", Request, "AccountGroupsView.aspx"));
            sitemapdata.Add(new SiteMapDataAttributeNode(group.Name, Request, string.Format("AccountGroupView.aspx?id={0}", group.Id)));
            sitemapdata.Add(new SiteMapDataAttributeNode("Invite a Friend", Request.Url));
            StackSiteMap(sitemapdata);
        }
    }
Ejemplo n.º 13
0
 public int CreateOrUpdateAccountGroup(string ticket, TransitAccountGroup t_instance)
 {
     return WebServiceImpl<TransitAccountGroup, ManagedAccountGroup, AccountGroup>.CreateOrUpdate(
         ticket, t_instance);
 }
Ejemplo n.º 14
0
 public int CreateOrUpdateAccountGroup(string ticket, TransitAccountGroup t_instance)
 {
     return(WebServiceImpl <TransitAccountGroup, ManagedAccountGroup, AccountGroup> .CreateOrUpdate(
                ticket, t_instance));
 }
Ejemplo n.º 15
0
 public void save_Click(object sender, EventArgs e)
 {
     TransitAccountGroup tw = new TransitAccountGroup();
     tw.Name = inputName.Text;
     tw.Description = inputDescription.Text;
     tw.IsPrivate = inputPrivate.Checked;
     tw.Id = RequestId;
     tw.AccountBlogId = (! string.IsNullOrEmpty(inputBlog.SelectedValue)) ? int.Parse(inputBlog.SelectedValue) : 0;
     SessionManager.CreateOrUpdate<TransitAccountGroup>(
         tw, SessionManager.GroupService.CreateOrUpdateAccountGroup);
     Redirect(ReturnUrl);
 }