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


C# Member.SetText方法代码示例

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


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

示例1: MakeNew

        public static Member MakeNew(string Name, string LoginName, string Email, MemberType mbt, User u)
        {
            var loginName = (!String.IsNullOrEmpty(LoginName)) ? LoginName : Name;

            if (String.IsNullOrEmpty(loginName))
                throw new ArgumentException("The loginname must be different from an empty string", "loginName");

            // Test for e-mail
            if (Email != "" && Member.GetMemberFromEmail(Email) != null)
                throw new Exception(String.Format("Duplicate Email! A member with the e-mail {0} already exists", Email));
            else if (Member.GetMemberFromLoginName(loginName) != null)
                throw new Exception(String.Format("Duplicate User name! A member with the user name {0} already exists", loginName));

            Guid newId = Guid.NewGuid();

            //create the cms node first
            CMSNode newNode = MakeNew(-1, _objectType, u.Id, 1, Name, newId);

            //we need to create an empty member and set the underlying text property
            Member tmp = new Member(newId, true);
            tmp.SetText(Name);

            //create the content data for the new member
            tmp.CreateContent(mbt);

            // Create member specific data ..
            SqlHelper.ExecuteNonQuery(
                "insert into cmsMember (nodeId,Email,LoginName,Password) values (@id,@email,@loginName,'')",
                SqlHelper.CreateParameter("@id", tmp.Id),
                SqlHelper.CreateParameter("@loginName", loginName),
                SqlHelper.CreateParameter("@email", Email));

            //read the whole object from the db
            Member m = new Member(newId);

            NewEventArgs e = new NewEventArgs();

            m.OnNew(e);

            m.Save();

            return m;
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:43,代码来源:Member.cs


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