当前位置: 首页>>代码示例>>C#>>正文


C# Member.AddGroup方法代码示例

本文整理汇总了C#中umbraco.cms.businesslogic.member.Member.AddGroup方法的典型用法代码示例。如果您正苦于以下问题:C# Member.AddGroup方法的具体用法?C# Member.AddGroup怎么用?C# Member.AddGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在umbraco.cms.businesslogic.member.Member的用法示例。


在下文中一共展示了Member.AddGroup方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: createMember

        protected void createMember(object sender, EventArgs e)
        {
            if (tb_email.Text != "")
                {
                    m = Member.GetMemberFromEmail(tb_email.Text);
                    if (m == null)
                    {
                        MemberType mt = MemberType.GetByAlias(memberType);
                        m = Member.MakeNew(tb_name.Text, mt, new umbraco.BusinessLogic.User(0));
                        m.Email = tb_email.Text;
                        m.Password = tb_password.Text;
                        m.LoginName = tb_email.Text;

                        //Standard values
                        m.getProperty("reputationTotal").Value = 20;
                        m.getProperty("reputationCurrent").Value = 20;
                        m.getProperty("forumPosts").Value = 0;

                        if (!string.IsNullOrEmpty(Group))
                        {
                            MemberGroup mg = MemberGroup.GetByName(Group);
                            if (mg != null)
                                m.AddGroup(mg.Id);
                        }

                        //set a default avatar
                        Api.CommunityController.SetAvatar(m.Id, "gravatar");

                        m.Save();
                        m.XmlGenerate(new System.Xml.XmlDocument());
                        Member.AddMemberToCache(m);
                        Response.Redirect(umbraco.library.NiceUrl(NextPage));
                    }
                }
        }
开发者ID:larrynPL,项目名称:OurUmbraco,代码行数:35,代码来源:SignupSimple.ascx.cs

示例2: createMember

        protected void createMember(object sender, EventArgs e)
        {
            //Member is already logged in, and we just need to save his new data...
            if (m != null) {
                m.Text = tb_name.Text;
                m.Email = tb_email.Text;
                m.LoginName = tb_email.Text;

                if (tb_password.Text != "")
                    m.Password = tb_password.Text;

                //optional..
                m.getProperty("twitter").Value = tb_twitter.Text;
                m.getProperty("flickr").Value = tb_flickr.Text;
                m.getProperty("company").Value = tb_company.Text;
                m.getProperty("profileText").Value = tb_bio.Text;

                //location
                m.getProperty("location").Value = tb_location.Text;
                m.getProperty("latitude").Value = tb_lat.Value;
                m.getProperty("longitude").Value = tb_lng.Value;

                //treshold + newsletter
                m.getProperty("treshold").Value = tb_treshold.Text;
                m.getProperty("bugMeNot").Value = cb_bugMeNot.Checked;

                m.XmlGenerate(new System.Xml.XmlDocument());
                m.Save();

                //Refresh the member cache data
                Member.RemoveMemberFromCache(m);
                Member.AddMemberToCache(m);

                Response.Redirect(umbraco.library.NiceUrl(NextPage));

            } else {
                if (tb_email.Text != "") {
                    m = Member.GetMemberFromEmail(tb_email.Text);
                    if (m == null) {
                        MemberType mt = MemberType.GetByAlias(memberType);
                        m = Member.MakeNew(tb_name.Text, mt, new umbraco.BusinessLogic.User(0));
                        m.Email = tb_email.Text;
                        m.Password = tb_password.Text;
                        m.LoginName = tb_email.Text;

                        //Location
                        m.getProperty("location").Value = tb_location.Text;
                        m.getProperty("latitude").Value = tb_lat.Value;
                        m.getProperty("longitude").Value = tb_lng.Value;

                        //optional..
                        m.getProperty("twitter").Value = tb_twitter.Text;
                        m.getProperty("flickr").Value = tb_flickr.Text;
                        m.getProperty("company").Value = tb_company.Text;
                        m.getProperty("profileText").Value = tb_bio.Text;

                        //treshold + newsletter
                        m.getProperty("treshold").Value = tb_treshold.Text;
                        m.getProperty("bugMeNot").Value = cb_bugMeNot.Checked;

                        //Standard values
                        m.getProperty("reputationTotal").Value = 20;
                        m.getProperty("reputationCurrent").Value = 20;
                        m.getProperty("forumPosts").Value = 0;

                        if (!string.IsNullOrEmpty(Group)) {
                            MemberGroup mg = MemberGroup.GetByName(Group);
                            if (mg != null)
                                m.AddGroup(mg.Id);
                        }

                        //set a default avatar
                        Rest.BuddyIcon.SetAvatar(m.Id, "gravatar");

                        m.Save();
                        m.XmlGenerate(new System.Xml.XmlDocument());
                        Member.AddMemberToCache(m);

                        Response.Redirect(umbraco.library.NiceUrl(NextPage));
                    }
                }
            }
        }
开发者ID:nul800sebastiaan,项目名称:OurUmbraco,代码行数:83,代码来源:Signup.ascx.cs

示例3: AddMemberToPotentialSpamGroup

        public static void AddMemberToPotentialSpamGroup(Member member)
        {
            var memberGroup = MemberGroup.GetByName(SpamMemberGroupName);
            if (memberGroup == null)
                MemberGroup.MakeNew(SpamMemberGroupName, new User(0));

            memberGroup = MemberGroup.GetByName(SpamMemberGroupName);

            if (Roles.IsUserInRole(member.LoginName, SpamMemberGroupName) == false)
                member.AddGroup(memberGroup.Id);
        }
开发者ID:Jeavon,项目名称:OurUmbraco,代码行数:11,代码来源:Utills.cs

示例4: createMember

        protected void createMember(object sender, EventArgs e)
        {
            //Member is already logged in, and we just need to save his new data...
            if (m != null)
            {
                m.Text = tb_name.Text;
                m.Email = tb_email.Text;
                m.LoginName = tb_email.Text;

                if (tb_password.Text != "")
                    m.Password = tb_password.Text;

                //optional..
                m.getProperty("twitter").Value = tb_twitter.Text;
                m.getProperty("flickr").Value = tb_flickr.Text;
                m.getProperty("company").Value = tb_company.Text;
                m.getProperty("profileText").Value = tb_bio.Text;

                //location
                m.getProperty("location").Value = tb_location.Text;
                m.getProperty("latitude").Value = tb_lat.Value;
                m.getProperty("longitude").Value = tb_lng.Value;

                //treshold + newsletter
                m.getProperty("treshold").Value = tb_treshold.Text;
                m.getProperty("bugMeNot").Value = cb_bugMeNot.Checked;

                m.XmlGenerate(new System.Xml.XmlDocument());
                m.Save();

                //Refresh the member cache data
                Member.RemoveMemberFromCache(m);
                Member.AddMemberToCache(m);

                Response.Redirect(umbraco.library.NiceUrl(NextPage));

            }
            else
            {
                if (tb_email.Text != "")
                {
                    m = Member.GetMemberFromLoginName(tb_email.Text);
                    if (m == null)
                    {
                        MemberType mt = MemberType.GetByAlias(memberType);

                        // Adding " Temp" is a hack - bizarrely, when you create a member using MakeNew and
                        // the name does not have a space in it (like: Ben) you'll get a YSOD saying the
                        // username already exists. However, create it with a space in it and everything is
                        // fine and dandy! So now we just force the last name to be "Temp" during creation
                        // and then update the member's name immediately after that... -SJ
                        m = Member.MakeNew(tb_name.Text + " Temp", mt, new User(0));
                        m.Text = tb_name.Text;

                        m.Email = tb_email.Text;
                        m.Password = tb_password.Text;
                        m.LoginName = tb_email.Text;

                        //Location
                        m.getProperty("location").Value = tb_location.Text;
                        m.getProperty("latitude").Value = tb_lat.Value;
                        m.getProperty("longitude").Value = tb_lng.Value;

                        //optional..
                        m.getProperty("twitter").Value = tb_twitter.Text;
                        m.getProperty("flickr").Value = tb_flickr.Text;
                        m.getProperty("company").Value = tb_company.Text;
                        m.getProperty("profileText").Value = tb_bio.Text;

                        //treshold + newsletter
                        m.getProperty("treshold").Value = tb_treshold.Text;
                        m.getProperty("bugMeNot").Value = cb_bugMeNot.Checked;

                        //Standard values
                        m.getProperty("reputationTotal").Value = 20;
                        m.getProperty("reputationCurrent").Value = 20;
                        m.getProperty("forumPosts").Value = 0;

                        if (!string.IsNullOrEmpty(Group))
                        {
                            MemberGroup mg = MemberGroup.GetByName(Group);
                            if (mg != null)
                                m.AddGroup(mg.Id);
                        }

                        //set a default avatar
                        BuddyIcon.SetAvatar(m.Id, "gravatar");

                        m.Save();
                        m.XmlGenerate(new XmlDocument());
                        Member.AddMemberToCache(m);

                        Response.Redirect(library.NiceUrl(NextPage));
                    }
                    else
                    {
                        MemberExists.Visible = true;
                        Panel1.Visible = false;
                    }
                }
//.........这里部分代码省略.........
开发者ID:KevinJump,项目名称:OurUmbraco,代码行数:101,代码来源:Signup.ascx.cs

示例5: CreateMember

        protected void CreateMember(object sender, EventArgs e)
        {
            //Member is already logged in, and we just need to save his new data...
            if (_member != null)
            {
                _member.Text = tb_name.Text;
                _member.Email = tb_email.Text;
                _member.LoginName = tb_email.Text;

                if (tb_password.Text != "")
                    _member.Password = tb_password.Text;

                //optional..
                _member.getProperty("twitter").Value = tb_twitter.Text;
                _member.getProperty("flickr").Value = tb_flickr.Text;
                _member.getProperty("company").Value = tb_company.Text;
                _member.getProperty("profileText").Value = tb_bio.Text;

                //location
                _member.getProperty("location").Value = tb_location.Text;
                _member.getProperty("latitude").Value = tb_lat.Value;
                _member.getProperty("longitude").Value = tb_lng.Value;

                //treshold + newsletter
                _member.getProperty("treshold").Value = tb_treshold.Text;
                _member.getProperty("bugMeNot").Value = cb_bugMeNot.Checked;

                _member.XmlGenerate(new XmlDocument());
                _member.Save();

                //Refresh the member cache data
                Member.RemoveMemberFromCache(_member);
                Member.AddMemberToCache(_member);

                uForum.Library.Utills.CheckForSpam(_member);

                Response.Redirect(library.NiceUrl(NextPage));

            }
            else
            {
                if (tb_email.Text != string.Empty && Page.IsValid)
                {
                    _member = Member.GetMemberFromLoginName(tb_email.Text);
                    if (_member == null)
                    {
                        // If spammer then this will stop account creation
                        var spamResult = uForum.Library.Utills.CheckForSpam(tb_email.Text, tb_name.Text, true);
                        if (spamResult != null && spamResult.Blocked)
                            return;

                        var mt = MemberType.GetByAlias(memberType);

                        // Adding " Temp" is a hack - bizarrely, when you create a member using MakeNew and
                        // the name does not have a space in it (like: Ben) you'll get a YSOD saying the
                        // username already exists. However, create it with a space in it and everything is
                        // fine and dandy! So now we just force the last name to be "Temp" during creation
                        // and then update the member's name immediately after that... -SJ
                        _member = Member.MakeNew(tb_name.Text + " Temp", mt, new User(0));
                        _member.Text = tb_name.Text;

                        _member.Email = tb_email.Text;
                        _member.Password = tb_password.Text;
                        _member.LoginName = tb_email.Text;

                        //Location
                        _member.getProperty("location").Value = tb_location.Text;
                        _member.getProperty("latitude").Value = tb_lat.Value;
                        _member.getProperty("longitude").Value = tb_lng.Value;

                        //optional..
                        _member.getProperty("twitter").Value = tb_twitter.Text;
                        _member.getProperty("flickr").Value = tb_flickr.Text;
                        _member.getProperty("company").Value = tb_company.Text;
                        _member.getProperty("profileText").Value = tb_bio.Text;

                        //treshold + newsletter
                        _member.getProperty("treshold").Value = tb_treshold.Text;
                        _member.getProperty("bugMeNot").Value = cb_bugMeNot.Checked;

                        //Standard values
                        _member.getProperty("reputationTotal").Value = 20;
                        _member.getProperty("reputationCurrent").Value = 20;
                        _member.getProperty("forumPosts").Value = 0;

                        if (string.IsNullOrEmpty(Group) == false)
                        {
                            var memberGroup = MemberGroup.GetByName(Group);
                            if (memberGroup != null)
                                _member.AddGroup(memberGroup.Id);
                        }

                        //set a default avatar
                        BuddyIcon.SetAvatar(_member.Id, "gravatar");

                        _member.Save();
                        _member.XmlGenerate(new XmlDocument());
                        Member.AddMemberToCache(_member);

                        if (spamResult == null)
//.........这里部分代码省略.........
开发者ID:Jeavon,项目名称:OurUmbraco,代码行数:101,代码来源:Signup.ascx.cs


注:本文中的umbraco.cms.businesslogic.member.Member.AddGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。