public void WriteXml(APIWriter w) { w.Start("CheckboxItem") .Attr("Fee", Fee) .Attr("Limit", Limit) .Attr("Time", MeetingTime.ToString2("s")) .Add("Description", Description) .Add("SmallGroup", SmallGroup.trim()) .End(); }
public bool IsSmallGroupFilled(IEnumerable <string> smallgroups) { if (!(Limit > 0)) { return(false); } var cnt = smallgroups.Count(mm => mm.trim() == SmallGroup.trim()); return(cnt >= Limit); }
public bool IsSmallGroupFilled(IEnumerable <string> smallgroups) { if (!(Limit > 0)) { return(false); } var cnt = smallgroups.Count(mm => mm.HasValue() && mm.Trim().Equal(SmallGroup?.Trim())); return(cnt >= Limit); }
public void AddToSmallGroup(CMSDataContext Db, OrganizationMember om, PythonModel pe) { if (om == null) { return; } if (pe != null) { pe.instance.AddToSmallGroup(SmallGroup.trim(), om); om.Person.LogChanges(Db, om.PeopleId); } om.AddToGroup(Db, SmallGroup.trim()); if (MeetingTime.HasValue) { Attend.MarkRegistered(Db, om.OrganizationId, om.PeopleId, MeetingTime.Value, 1); } }
private IQueryable <OrganizationMember> GetMembers() { if (_members == null) { var glist = new int[] { }; if (Grades.HasValue()) { glist = (from g in (Grades ?? "").Split(',') select g.ToInt()).ToArray(); } var q = from om in DbUtil.Db.OrganizationMembers where om.Organization.DivOrgs.Any(di => di.DivId == DivId) where SourceId == 0 || om.OrganizationId == SourceId where glist.Length == 0 || glist.Contains(om.Person.Grade.Value) where !SmallGroup.HasValue() || om.OrgMemMemTags.Any(mm => mm.MemberTag.Name == SmallGroup) where !MembersOnly || om.MemberTypeId == MemberTypeCode.Member select om; _members = q; } return(_members); }
public void RemoveFromSmallGroup(CMSDataContext Db, OrganizationMember om) { om.RemoveFromGroup(Db, SmallGroup.trim()); }
private IQueryable <OrganizationMember> GetMembers() { if (members == null) { var glist = new int[] { }; var smallGroupList = new List <string>(); var matchAllSubgroups = false; if (null != SmallGroup) { if (SmallGroup.StartsWith("All:", StringComparison.InvariantCultureIgnoreCase)) { matchAllSubgroups = true; SmallGroup = SmallGroup.Substring(4); } if (SmallGroup.Contains(";")) { smallGroupList.AddRange(SmallGroup.Split(';').Select(x => x.Trim())); } else if (SmallGroup.Contains(",")) { smallGroupList.AddRange(SmallGroup.Split(';').Select(x => x.Trim())); } else { smallGroupList.Add(SmallGroup); } } if (Grades.HasValue()) { glist = (from g in (Grades ?? "").Split(new char[] { ',', ';' }) select g.ToInt()).ToArray(); } var typesToShowForMembersOnly = new[] { MemberTypeCode.Member, MemberTypeCode.Prospect, MemberTypeCode.InActive }; var q = from om in CurrentDatabase.OrganizationMembers where om.Organization.DivOrgs.Any(di => di.DivId == SourceDivId) where SourceId == 0 || om.OrganizationId == SourceId where glist.Length == 0 || glist.Contains(om.Person.Grade.Value) where !MembersOnly || typesToShowForMembersOnly.Contains(om.MemberTypeId) select om; if (smallGroupList.Any()) { if (matchAllSubgroups) { foreach (var sg in smallGroupList) { q = from om in q where om.OrgMemMemTags.Any(mm => mm.MemberTag.Name == sg) select om; } } else { q = from om in q where om.OrgMemMemTags.Any(mm => smallGroupList.Contains(mm.MemberTag.Name)) select om; } } if (null != Age && Age.Trim().Length > 0) { /* * Enter a single number for a specific age (`50`). * Use a dash to search for a range of ages (`30-40`). * Additionally, use `<=`, `>=`, `<`, and `>` for searching ranges. */ var str = Regex.Replace(Age, @"[^0-9\-<>=]", ""); if ((new Regex(@"^[0-9]+$")).IsMatch(str)) { q = from om in q where om.Person.Age == str.ToInt() select om; } else if ((new Regex(@"^[0-9]+\-[0-9]+$")).IsMatch(str)) { var matches = Regex.Matches(str, @"^([0-9]+)\-([0-9]+)$"); q = from om in q where om.Person.Age >= matches[0].Groups[1].Value.ToInt() where om.Person.Age <= matches[0].Groups[2].Value.ToInt() select om; } else if ((new Regex(@"^>=[0-9]+$")).IsMatch(str)) { var matches = Regex.Matches(str, @"^>=([0-9]+)$"); q = from om in q where om.Person.Age >= matches[0].Groups[1].Value.ToInt() select om; } else if ((new Regex(@"^>[0-9]+$")).IsMatch(str)) { var matches = Regex.Matches(str, @"^>([0-9]+)$"); q = from om in q where om.Person.Age > matches[0].Groups[1].Value.ToInt() select om; } else if ((new Regex(@"^<=[0-9]+$")).IsMatch(str)) { var matches = Regex.Matches(str, @"^<=([0-9]+)$"); q = from om in q where om.Person.Age <= matches[0].Groups[1].Value.ToInt() select om; } else if ((new Regex(@"^<[0-9]+$")).IsMatch(str)) { var matches = Regex.Matches(str, @"^<([0-9]+)$"); q = from om in q where om.Person.Age < matches[0].Groups[1].Value.ToInt() select om; } } members = q; } return(members); }