protected void bt_submit_Click(object sender, EventArgs e)
        {
            confirm.Visible = false;
            error.Visible = false;

            Member m = Member.GetCurrentMember();

            int pId = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["id"]) && int.TryParse(Request.QueryString["id"], out pId) && umbraco.library.IsLoggedOn())
            {

                Document d = new Document(pId);

                if ((int)d.getProperty("owner").Value == m.Id)
                {
                    Member c = Member.GetMemberFromLoginName(tb_email.Text);

                    if (c != null && c.Id != m.Id)
                    {
                        //member found

                        ProjectContributor pc = new ProjectContributor(d.Id, c.Id);
                        pc.Add();

                        confirm.Visible = true;
                        tb_email.Text = "";

                    }
                    else
                    {

                        //member not found
                        error.Visible = true;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static string RemoveContributor(int projectId, int memberId)
        {
            int _currentMember = umbraco.presentation.umbracobase.library.library.CurrentMemberId();

            if (_currentMember > 0)
            {
                umbraco.presentation.nodeFactory.Node p = new umbraco.presentation.nodeFactory.Node(projectId);

                if (p.GetProperty("owner").Value == _currentMember.ToString())
                {

                    ProjectContributor pc = new ProjectContributor(projectId, memberId);
                    pc.Delete();
                    return "true";
                }
                else
                {
                    return "false";
                }

            }

            return "false";
        }