AddToGroup() public method

public AddToGroup ( CmsData.CMSDataContext Db, int n ) : int
Db CmsData.CMSDataContext
n int
return int
Example #1
0
        private string DoAddSmallGroup(string text, EmailQueueTo emailqueueto)
        {
            const string RE    = @"\{addsmallgroup:\[(?<group>[^\]]*)\]\}";
            var          re    = new Regex(RE, RegexOptions.Singleline);
            Match        match = re.Match(text);

            if (match.Success && emailqueueto.OrgId.HasValue)
            {
                string             tag   = match.Value;
                string             group = match.Groups["group"].Value;
                OrganizationMember om    = (from mm in OrganizationMembers
                                            where mm.OrganizationId == emailqueueto.OrgId
                                            where mm.PeopleId == emailqueueto.PeopleId
                                            select mm).SingleOrDefault();
                if (om != null)
                {
                    om.AddToGroup(this, group);
                }
                text = text.Replace(tag, "");
            }
            return(text);
        }
Example #2
0
 private OrganizationMember RecordAllFamilyAttends(OrganizationMember om)
 {
     om.AddToGroup(DbUtil.Db, "Attended");
     om.AddToGroup(DbUtil.Db, "Registered");
     foreach (var fm in FamilyAttend)
     {
         if (fm.PeopleId == -1)
             continue;
         Person pp = null;
         OrganizationMember omm = null;
         if (!fm.PeopleId.HasValue && fm.Attend)
         {
             if (!fm.Name.HasValue())
                 continue;
             string first, last;
             Util.NameSplit(fm.Name, out first, out last);
             if (!first.HasValue())
             {
                 first = last;
                 last = LastName;
             }
             var uperson = DbUtil.Db.LoadPersonById(PeopleId ?? 0);
             var p = new OnlineRegPersonModel()
             {
                 FirstName = first,
                 LastName = last,
                 DateOfBirth = fm.Birthday,
                 EmailAddress = fm.Email,
                 gender = fm.GenderId,
                 married = fm.MaritalId
             };
             p.AddPerson(uperson, org.EntryPointId ?? 0);
             pp = p.person;
             omm = OrganizationMember.InsertOrgMembers(DbUtil.Db, org.OrganizationId, pp.PeopleId,
                 MemberTypeCode.Member, DateTime.Now, null, false);
         }
         else
         {
             pp = DbUtil.Db.LoadPersonById(fm.PeopleId ?? 0);
             if (fm.Attend)
                 omm = OrganizationMember.InsertOrgMembers(DbUtil.Db, org.OrganizationId, pp.PeopleId,
                     MemberTypeCode.Member, DateTime.Now, null, false);
             else
             {
                 omm = OrganizationMember.Load(DbUtil.Db, pp.PeopleId, org.OrganizationId);
                 omm?.RemoveFromGroup(DbUtil.Db, "Attended");
             }
         }
         if (omm == null)
             continue;
         if (fm.Attend)
             omm.AddToGroup(DbUtil.Db, "Attended");
         if (!fm.PeopleId.HasValue)
             omm.AddToGroup(DbUtil.Db, "Added");
     }
     return om;
 }
Example #3
0
 private static OrganizationMember AddSender(OrganizationMember om)
 {
     if (!om.IsInGroup("Goer"))
         om.MemberTypeId = MemberTypeCode.InActive;
     om.AddToGroup(DbUtil.Db, "Sender");
     return om;
 }
Example #4
0
 private void SaveYesNoChoices(OrganizationMember om, Ask ask)
 {
     if (setting.TargetExtraValues == false)
     {
         foreach (var yn in ((AskYesNoQuestions) ask).list)
         {
             om.RemoveFromGroup(DbUtil.Db, "Yes:" + yn.SmallGroup);
             om.RemoveFromGroup(DbUtil.Db, "No:" + yn.SmallGroup);
         }
         foreach (var g in YesNoQuestion)
             om.AddToGroup(DbUtil.Db, (g.Value == true ? "Yes:" : "No:") + g.Key);
     }
     else
         foreach (var g in YesNoQuestion)
             person.AddEditExtraValue(g.Key, g.Value == true ? "Yes" : "No");
 }
Example #5
0
 private void SaveMenuChoices(OrganizationMember om, Ask ask)
 {
     foreach (var i in MenuItem[ask.UniqueId])
         om.AddToGroup(DbUtil.Db, i.Key, i.Value);
     {
         var menulabel = ((AskMenu) ask).Label;
         foreach (var i in ((AskMenu) ask).MenuItemsChosen(MenuItem[ask.UniqueId]))
         {
             om.AddToMemberDataBelowComments(menulabel);
             var desc = i.amt > 0 
                 ? $"{i.number} {i.desc} (at {i.amt:N2})" 
                 : $"{i.number} {i.desc}";
             om.AddToMemberDataBelowComments(desc);
             menulabel = string.Empty;
         }
     }
 }
Example #6
0
 private void SaveAgeGroupChoice(OrganizationMember om)
 {
     if (setting.TargetExtraValues)
     {
         foreach (var ag in setting.AgeGroups)
             person.RemoveExtraValue(DbUtil.Db, ag.SmallGroup);
         if (setting.AgeGroups.Count > 0)
             person.AddEditExtraValue(AgeGroup(), "true");
     }
     else
     {
         foreach (var ag in setting.AgeGroups)
             om.RemoveFromGroup(DbUtil.Db, ag.SmallGroup);
         if (setting.AgeGroups.Count > 0)
             om.AddToGroup(DbUtil.Db, AgeGroup());
     }
 }
Example #7
0
 private void DoLinkGroupsFromOrgs(OrganizationMember om)
 {
     if (setting.LinkGroupsFromOrgs.Count > 0)
     {
         var q = from omt in DbUtil.Db.OrgMemMemTags
             where setting.LinkGroupsFromOrgs.Contains(omt.OrgId)
             where omt.PeopleId == om.PeopleId
             select omt.MemberTag.Name;
         foreach (var name in q)
             om.AddToGroup(DbUtil.Db, name);
     }
     if (om.Organization.IsMissionTrip == true)
         om.AddToGroup(DbUtil.Db, "Goer");
 }
Example #8
0
 public void AddToSmallGroup(CMSDataContext Db, OrganizationMember om, PythonModel pe)
 {
     if (om == null)
         return;
     if (pe != null)
         pe.instance.AddToSmallGroup(SmallGroup, om);
     om.AddToGroup(Db, SmallGroup);
     if (MeetingTime.HasValue)
         Attend.MarkRegistered(Db, om.OrganizationId, om.PeopleId, MeetingTime.Value, 1);
 }