Esempio n. 1
0
        public IEnumerable <SelectListItem> Organizations2()
        {
            int divId  = (TargetDivId == 0) ? SourceDivId : TargetDivId;
            var member = MemberTypeCode.Member;
            var roles  = CurrentDatabase.CurrentRoles();
            var q      = from o in CurrentDatabase.Organizations
                         where o.LimitToRole == null || roles.Contains(o.LimitToRole)
                         where o.DivOrgs.Any(di => di.DivId == divId)
                         where o.OrganizationStatusId == OrgStatusCode.Active
                         orderby o.OrganizationName
                         let sctime = o.OrgSchedules.Count() == 1 ? " " + CurrentDatabase.GetScheduleDesc(o.OrgSchedules.First().MeetingTime) : ""
                                      let cmales = o.OrganizationMembers.Count(m => m.Person.GenderId == 1 && m.MemberTypeId == member)
                                                   let cfemales = o.OrganizationMembers.Count(m => m.Person.GenderId == 2 && m.MemberTypeId == member)
                                                                  select new SelectListItem
            {
                Value = o.OrganizationId.ToString(),
                Text  = o.OrganizationName + sctime + " (" + cmales + "+" + cfemales + "=" + (cmales + cfemales) + ")"
            };
            var list = q.ToList();

            list.Insert(0, new SelectListItem {
                Value = "0", Text = "(not specified)"
            });
            return(list);
        }
Esempio n. 2
0
        public IEnumerable <SelectListItem> ScheduleIds()
        {
            var q = from sc in CurrentDatabase.OrgSchedules
                    group sc by new { sc.ScheduleId, sc.MeetingTime }
            into g
            orderby g.Key.ScheduleId
            where g.Key.ScheduleId != null
                select new SelectListItem
            {
                Value = g.Key.ScheduleId.Value.ToString(),
                Text  = CurrentDatabase.GetScheduleDesc(g.Key.MeetingTime)
            };
            var list = q.ToList();

            list.Insert(0, new SelectListItem
            {
                Value = "-1",
                Text  = "(None)"
            });
            list.Insert(0, new SelectListItem
            {
                Value = "0",
                Text  = "(not specified)"
            });
            return(list);
        }
Esempio n. 3
0
        public IEnumerable <SelectListItem> Organizations()
        {
            var roles = CurrentDatabase.CurrentRoles();
            var q     = from o in CurrentDatabase.Organizations
                        where o.LimitToRole == null || roles.Contains(o.LimitToRole)
                        where o.DivOrgs.Any(di => di.DivId == SourceDivId)
                        where o.OrganizationStatusId == OrgStatusCode.Active
                        orderby o.OrganizationName
                        let sctime = o.OrgSchedules.Count() == 1 ? " " + CurrentDatabase.GetScheduleDesc(o.OrgSchedules.First().MeetingTime) : ""
                                     select new SelectListItem
            {
                Value = o.OrganizationId.ToString(),
                Text  = o.OrganizationName + sctime
            };
            var list = q.ToList();

            list.Insert(0, new SelectListItem {
                Value = "0", Text = "(not specified)"
            });
            return(list);
        }