protected void Page_Load(object sender, System.EventArgs e)
		{
            _memberGroupId = !String.IsNullOrEmpty(memberGroupName.Value) ? memberGroupName.Value : Request.QueryString["id"];

            // Restore any escaped apostrophe for name look up
            _memberGroupId = _memberGroupId.Replace("\\'", "'");

            if (!IsPostBack)
			{
                ClientTools
					.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadMemberGroups>().Tree.Alias)
                    .SyncTree(_memberGroupId, false);
			}

            if (!Member.IsUsingUmbracoRoles())
            {
                NameTxt.Enabled = false;
                save.Enabled = false;
                NameTxt.Text = _memberGroupId + " (not editable from umbraco)";
            }
            else
            {
                _memberGroup = MemberGroup.GetByName(_memberGroupId);

                if (!IsPostBack)
                {
                    NameTxt.Text = _memberGroup.Text;
                }
            }
		}
예제 #2
0
		/// <summary>
		/// Adds a member the group.
		/// </summary>
		/// <param name="member">The member.</param>
		/// <param name="group">The group.</param>
		public static void AddGroup(this Member member, MemberGroup group)
		{
			if (group != null)
			{
				member.AddGroup(group.Id);
			}
		}
예제 #3
0
		/// <summary>
		/// Determines whether [is in group] [the specified member].
		/// </summary>
		/// <param name="member">The member.</param>
		/// <param name="group">The group.</param>
		/// <returns>
		/// 	<c>true</c> if [is in group] [the specified member]; otherwise, <c>false</c>.
		/// </returns>
		public static bool IsInGroup(this Member member, MemberGroup group)
		{
			if (group != null)
			{
				return member.IsInGroup(group.Id);
			}

			return false;
		}
예제 #4
0
        /// <summary>
        /// Create a new MemberGroup
        /// </summary>
        /// <param name="Name">The name of the MemberGroup</param>
        /// <param name="u">The creator of the MemberGroup</param>
        /// <returns>The new MemberGroup</returns>
        public static MemberGroup MakeNew(string Name, BusinessLogic.User u)
        {
            Guid newId = Guid.NewGuid();

            CMSNode.MakeNew(-1, _objectType, u.Id, 1, Name, newId);
            MemberGroup  mg = new MemberGroup(newId);
            NewEventArgs e  = new NewEventArgs();

            mg.OnNew(e);
            return(mg);
        }
예제 #5
0
        /// <summary>
        /// Create a new MemberGroup
        /// </summary>
        /// <param name="Name">The name of the MemberGroup</param>
        /// <param name="u">The creator of the MemberGroup</param>
        /// <returns>The new MemberGroup</returns>
        public static MemberGroup MakeNew(string Name, BusinessLogic.User u)
        {
            var group = new global::Umbraco.Core.Models.MemberGroup {
                Name = Name
            };

            ApplicationContext.Current.Services.MemberGroupService.Save(group);

            var mg = new MemberGroup(group);
            var e  = new NewEventArgs();

            mg.OnNew(e);
            return(mg);
        }
        protected void btnSendMass_Click(object sender, EventArgs e)
        {
            //needs to be async

            //send mass

            int MemberGroupID = Convert.ToInt32(ddmemberGroup.SelectedValue);
            MemberGroup group = null;
            if (MemberGroupID  != 0)
            {
                group = new MemberGroup(MemberGroupID );
            }
            int PageId = int.Parse(Request["id"]);
            string body = umbraco.library.RenderTemplate(PageId);

            HttpContext.Current.Application.Add(typeof(mailing).ToString() + ".sendMass", new MailTask(Helper.FilterMembers(group, txtFilter.Text), txtFrom.Text, txtSubject.Text, PageId, body));
        }
예제 #7
0
		/// <summary>
		/// Removes a member the group.
		/// </summary>
		/// <param name="member">The member.</param>
		/// <param name="group">The group.</param>
		public static void RemoveGroup(this Member member, MemberGroup group)
		{
			if (group != null)
			{
				member.RemoveGroup(group.Id);
			}
		}
예제 #8
0
		/// <summary>
		/// Create a new MemberGroup
		/// </summary>
		/// <param name="Name">The name of the MemberGroup</param>
		/// <param name="u">The creator of the MemberGroup</param>
		/// <returns>The new MemberGroup</returns>
		public static MemberGroup MakeNew(string Name, BusinessLogic.User u) 
		{
			Guid newId = Guid.NewGuid();
			CMSNode.MakeNew(-1,_objectType, u.Id, 1,  Name, newId);
			MemberGroup mg = new MemberGroup(newId);
            NewEventArgs e = new NewEventArgs();
            mg.OnNew(e);
            return mg;
		}
예제 #9
0
        public static List<Member> FilterMembers(MemberGroup Group, string filter)
        {
            Member[] getAll = Member.GetAll;
            List<Member> list = new List<Member>();

            foreach (Member member in getAll)
            {
                if (!string.IsNullOrEmpty(member.Email) && ((Group == null) || member.Groups.ContainsKey(Group.Id)))
                {
                    if (filter.Length == 0)
                    {
                        list.Add(member);
                    }
                    else
                    {
                        bool flag = true;
                        foreach (PropertyFilter propfilter in FiltersFromString(filter))
                        {
                            Property property = member.getProperty(propfilter.Field);
                            if (property == null)
                            {
                                break;
                            }
                            string str = property.Value.ToString();
                            if (Array.IndexOf<string>(propfilter.Values, str) == -1)
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (flag)
                        {
                            list.Add(member);
                        }
                    }
                }
            }

            return list;
        }
        private void updateCount()
        {
            btnSendMass.Enabled = true;

            int MemberGroupID = Convert.ToInt32(ddmemberGroup.SelectedValue);
            MemberGroup group = null;
            if (MemberGroupID != 0)
            {
                group = new MemberGroup(MemberGroupID);
            }
            int count = Helper.FilterMembers(group,txtFilter.Text).Count;

            ProgressBar1.Maximum = count;
            lblMemberCount.Text = string.Format("this configuration will send to {0} members", count);

            if (count == 0)
                btnSendMass.Enabled = false;
        }