コード例 #1
0
 public static AnnouncementPeriodViewData Create(ScheduleItem scheduleItem, IList <ClassAnnouncement> classAnnouncements,
                                                 IList <LessonPlan> lessonPlans, IList <SupplementalAnnouncement> supplementalAnnouncements, DateTime nowSchoolTime, IList <ClaimInfo> claims)
 {
     return(new AnnouncementPeriodViewData
     {
         Period = ScheduleItemViewData.Create(scheduleItem, nowSchoolTime),
         Announcements = ClassAnnouncementViewData.Create(classAnnouncements, claims),
         LessonPlans = LessonPlanViewData.Create(lessonPlans),
         SupplementalAnnouncements = SupplementalAnnouncementViewData.Create(supplementalAnnouncements)
     });
 }
コード例 #2
0
        protected AnnouncementViewData(Announcement announcementData, IList <ClaimInfo> claims) : base(announcementData)
        {
            ShortAnnouncementViewData annData = null;
            var lp = announcementData as LessonPlan;

            if (lp != null)
            {
                LessonPlanData = LessonPlanViewData.Create(lp);
                annData        = LessonPlanData;
                ClassId        = lp.ClassRef;
                ClassName      = lp.ClassName;
            }
            var sup = announcementData as SupplementalAnnouncement;

            if (sup != null)
            {
                SupplementalAnnouncementData = SupplementalAnnouncementViewData.Create(sup);
                annData   = SupplementalAnnouncementData;
                ClassId   = sup.ClassRef;
                ClassName = sup.ClassName;
            }

            var adminAnn = announcementData as AdminAnnouncement;

            if (adminAnn != null)
            {
                AdminAnnouncementData = AdminAnnouncementViewData.Create(adminAnn);
                annData = AdminAnnouncementData;
            }
            var classAnn = announcementData as ClassAnnouncement;

            if (classAnn != null)
            {
                ClassAnnouncementData = ClassAnnouncementViewData.Create(classAnn, claims);
                annData   = ClassAnnouncementData;
                ClassId   = classAnn.ClassRef;
                ClassName = classAnn.ClassName;
            }
            if (annData != null)
            {
                PersonId     = annData.PersonId;
                PersonName   = annData.PersonName;
                PersonGender = annData.PersonGender;
            }
        }