Example #1
0
		/// <summary>
		/// Deletes all members of the membertype specified
		/// 
		/// Used when a membertype is deleted
		/// 
		/// Use with care
		/// </summary>
		/// <param Name="dt">The membertype which are being deleted</param>
		public static void DeleteFromType(MemberType dt)
		{
			foreach (Content c in getContentOfContentType(dt))
			{
				// due to recursive structure document might already been deleted..
				if (IsNode(c.UniqueId))
				{
					Member tmp = new Member(c.UniqueId);
					tmp.delete();
				}
			}
		}
Example #2
0
		/// <summary>
		/// Creates a new member
		/// </summary>
		/// <param Name="Name">Membername</param>
		/// <param Name="mbt">Member type</param>
		/// <param Name="u">The Umbraco usercontext</param>
		/// <param Name="Email">The email of the user</param>
		/// <returns>The new member</returns>
		public static Member MakeNew(string Name, string Email, MemberType mbt, User u)
		{
			Guid newId = Guid.NewGuid();
			MakeNew(-1, _objectType, u.Id, 1, Name, newId);

			Member tmp = new Member(newId);

			tmp.CreateContent(mbt);
			// Create member specific data ..
			// TODO: SQL
			Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString, CommandType.Text,
			                          "insert into cmsMember (nodeId,Email,LoginName,Password) values (@id,@email,@text,'')",
			                          new SqlParameter("@id", tmp.Id),
			                          new SqlParameter("@text", tmp.Text),
			                          new SqlParameter("@email", Email));
			return tmp;
		}