override public IEnumerable <AttendInfo> DefineViewList(IQueryable <Attend> q)
 {
     return(from a in q
            let conflict = DbUtil.Db.ViewMeetingConflicts.Any(mm =>
                                                              a.PeopleId == mm.PeopleId &&
                                                              a.MeetingDate == mm.MeetingDate &&
                                                              (mm.OrgId1 == a.OrganizationId || mm.OrgId2 == a.OrganizationId))
                           let o = a.Meeting.Organization
                                   select new AttendInfo
     {
         PeopleId = a.PeopleId,
         MeetingId = a.MeetingId,
         OrganizationId = a.Meeting.OrganizationId,
         OrganizationName = CmsData.Organization
                            .FormatOrgName(o.OrganizationName, o.LeaderName, null),
         AttendType = a.AttendType.Description ?? "(null)",
         MeetingName = o.Division.Name + ": " + o.OrganizationName,
         MeetingDate = a.MeetingDate,
         MemberType = a.MemberType.Description ?? "(null)",
         AttendFlag = a.AttendanceFlag,
         OtherAttends = a.OtherAttends,
         Commitment = AttendCommitmentCode.Lookup(a.Commitment ?? 99),
         conflict = Future && conflict,
     });
 }
Example #2
0
        //Accept subgroup to limit query by those who are in this subgroup  --JoelS
        public static List <AttendInfo> RollListFilteredBySubgroup(int?meetingId, int orgId, DateTime meetingDate,
                                                                   bool sortByName = false, bool currentMembers = false, bool fromMobile = false)
        {
            string subgroupIds       = "";
            bool   includeLeaderless = false;
            var    userPersonId      = Db.UserPeopleId.GetValueOrDefault();
            //get array of subgroupIds for the groups that this user is a leader of
            var subgroups = (from mt in Db.OrgMemMemTags
                             where mt.PeopleId == userPersonId
                             where mt.OrgId == orgId
                             where mt.IsLeader == true
                             select mt.MemberTagId).ToArray();

            if (subgroups.Any())
            {
                subgroupIds = string.Join(",", subgroups);
                //if current user is the OrgLeader, include all members NOT in a subgroup
                var o = Db.LoadOrganizationById(orgId);
                includeLeaderless = userPersonId == o.LeaderId;
            }

            var q = Db.RollListFilteredBySubgroups(meetingId, meetingDate, orgId, currentMembers, fromMobile, subgroupIds, includeLeaderless);

            if (sortByName)
            {
                q = from p in q
                    orderby p.Name
                    select p;
            }
            else
            {
                q = from p in q
                    orderby p.Section, p.Last, p.FamilyId, p.First
                select p;
            }

            var q2 = from p in q
                     select new AttendInfo()
            {
                PeopleId           = p.PeopleId.Value,
                Name               = p.Name,
                Email              = p.Email,
                Attended           = p.Attended ?? false,
                AttendCommitmentId = p.CommitmentId,
                Commitment         = AttendCommitmentCode.Lookup(p.CommitmentId ?? 99),
                Member             = p.Section == 1,
                CurrMemberType     = p.CurrMemberType,
                MemberType         = p.MemberType,
                AttendType         = p.AttendType,
                OtherAttend        = p.OtherAttends,
                CurrMember         = p.CurrMember == true,
                Conflict           = p.Conflict == true,
                ChurchMemberStatus = p.ChurchMemberStatus
            };

            return(q2.ToList());
        }
Example #3
0
        public ContentResult EditCommitment(string id, string value)
        {
            var a = id.Substring(1).Split('_').Select(vv => vv.ToInt()).ToArray();
            var c = value.ToInt2();

            if (c == 99)
            {
                c = null;
            }
            Attend.MarkRegistered(DbUtil.Db, a[1], a[0], c);
            var desc = AttendCommitmentCode.Lookup(c ?? 99);

            DbUtil.LogActivity($"EditCommitment {desc} id={id}");
            return(Content(desc));
        }
Example #4
0
        public static List <AttendInfo> RollListHighlight(int?meetingId, int orgId, DateTime meetingDate,
                                                          bool sortByName = false, bool currentMembers = false, string highlight = null, bool registeredOnly = false)
        {
            var q = from p in Db.RollListHighlight(meetingId, meetingDate, orgId, currentMembers, highlight)
                    select p;

            if (sortByName)
            {
                q = from p in q
                    orderby p.Name
                    select p;
            }
            else
            {
                q = from p in q
                    orderby p.Section, p.Last, p.FamilyId, p.First
                select p;
            }

            if (registeredOnly)
            {
                q = from p in q
                    where AttendCommitmentCode.committed.Contains(p.CommitmentId ?? 0)
                    select p;
            }

            var q2 = from p in q
                     select new AttendInfo()
            {
                PeopleId           = p.PeopleId.Value,
                Name               = p.Name,
                Email              = p.Email,
                Attended           = p.Attended ?? false,
                AttendCommitmentId = p.CommitmentId,
                Commitment         = AttendCommitmentCode.Lookup(p.CommitmentId ?? 99),
                Member             = p.Section == 1,
                CurrMemberType     = p.CurrMemberType,
                MemberType         = p.MemberType,
                AttendType         = p.AttendType,
                OtherAttend        = p.OtherAttends,
                CurrMember         = p.CurrMember ?? false,
                Highlight          = p.Highlight ?? false,
                ChurchMemberStatus = p.ChurchMemberStatus
            };

            return(q2.ToList());
        }
Example #5
0
        public static List <AttendInfo> RollList(int?meetingId, int orgId, DateTime meetingDate,
                                                 bool sortByName = false, bool currentMembers = false, bool fromMobile = false)
        {
            var q = DbUtil.Db.RollList(meetingId, meetingDate, orgId, currentMembers, fromMobile);

            if (sortByName)
            {
                q = from p in q
                    orderby p.Name
                    select p;
            }
            else
            {
                q = from p in q
                    orderby p.Section, p.Last, p.FamilyId, p.First
                select p;
            }

            var q2 = from p in q
                     select new AttendInfo()
            {
                PeopleId           = p.PeopleId.Value,
                Name               = p.Name,
                Email              = p.Email,
                Attended           = p.Attended ?? false,
                AttendCommitmentId = p.CommitmentId,
                Commitment         = AttendCommitmentCode.Lookup(p.CommitmentId ?? 99),
                Member             = p.Section == 1,
                CurrMemberType     = p.CurrMemberType,
                MemberType         = p.MemberType,
                AttendType         = p.AttendType,
                OtherAttend        = p.OtherAttends,
                CurrMember         = p.CurrMember == true,
                Conflict           = p.Conflict == true,
                ChurchMemberStatus = p.ChurchMemberStatus
            };

            return(q2.ToList());
        }
Example #6
0
        public static IEnumerable <AttendInfo> RollListHighlight(int?meetingId, int orgId, DateTime meetingDate,
                                                                 bool sortByName = false, bool currentMembers = false, string highlight = null)
        {
            var q = from p in DbUtil.Db.RollListHighlight(meetingId, meetingDate, orgId, currentMembers, highlight)
                    select p;

            if (sortByName)
            {
                q = from p in q
                    orderby p.Name
                    select p;
            }
            else
            {
                q = from p in q
                    orderby p.Section, p.Last, p.FamilyId, p.First
                select p;
            }

            return(from p in q
                   select new AttendInfo()
            {
                PeopleId = p.PeopleId.Value,
                Name = p.Name,
                Email = p.Email,
                Attended = p.Attended ?? false,
                AttendCommitmentId = p.CommitmentId,
                Commitment = AttendCommitmentCode.Lookup(p.CommitmentId ?? 99),
                Member = p.Section == 1,
                CurrMemberType = p.CurrMemberType,
                MemberType = p.MemberType,
                AttendType = p.AttendType,
                OtherAttend = p.OtherAttends,
                CurrMember = p.CurrMember ?? false,
                Highlight = p.Highlight ?? false,
                ChurchMemberStatus = p.ChurchMemberStatus
            });
        }