コード例 #1
0
        protected virtual IList <AnnouncementDetails> InternalGetDetailses(BaseAnnouncementDataAccess <TAnnouncement> dataAccess, IList <int> announcementIds, bool onlyOnwer = true)
        {
            Trace.Assert(Context.PersonId.HasValue);
            var anns = dataAccess.GetDetailses(announcementIds, Context.PersonId.Value, Context.Role.Id, onlyOnwer);

            return(anns);
        }
コード例 #2
0
        protected override IList <AnnouncementDetails> InternalGetDetailses(BaseAnnouncementDataAccess <SupplementalAnnouncement> dataAccess, IList <int> announcementIds, bool onlyOnwer = true)
        {
            Trace.Assert(Context.PersonId.HasValue);
            var anns = dataAccess.GetDetailses(announcementIds, Context.PersonId.Value, Context.Role.Id, onlyOnwer);

            if (anns == null)
            {
                return(null);
            }

            var classIds = anns.Where(x => x.ClassRef.HasValue).Select(x => x.ClassRef.Value).Distinct().ToList();
            var types    = ServiceLocator.ClassAnnouncementTypeService.GetClassAnnouncementTypes(classIds);

            foreach (var ann in anns)
            {
                var type = types.FirstOrDefault(x => x.Id == ann.SupplementalAnnouncementData.ClassAnnouncementTypeRef);
                ann.SupplementalAnnouncementData.ClassAnnouncementTypeName = type?.Name;
                ann.SupplementalAnnouncementData.ChalkableAnnouncementType = type?.ChalkableAnnouncementTypeRef;
            }

            return(PrepareRecipientsData(anns));
        }