Esempio n. 1
0
        public dtoEnrollment(DateTime enrollOn, liteCommunityInfo community, List <dtoCommunityConstraint> constraints)
        {
            NotAvailableFor = new List <EnrollingStatus>();
            Constraints     = constraints;

            IdCommunity   = community.Id;
            CommunityName = community.Name;
            EnrollOn      = enrollOn;
            if (!community.AllowSubscription)
            {
                NotAvailableFor.Add(EnrollingStatus.Unavailable);
            }
            else
            {
                if (!IsAvailableForSubscriptionStartOn(DateTime.Now))
                {
                    NotAvailableFor.Add(EnrollingStatus.StartDate);
                }
                else if (!IsAvailableForSubscriptionEndOn(DateTime.Now))
                {
                    NotAvailableFor.Add(EnrollingStatus.EndDate);
                }
            }
            if (constraints.Where(c => !c.IsRespected).Any())
            {
                NotAvailableFor.Add(EnrollingStatus.Constraints);
            }

            if (NotAvailableFor.Any())
            {
                Status = EnrolledStatus.NotAvailable;
            }
            else
            {
                Status = EnrolledStatus.None;
            }
            ExtendedInfo = new dtoEnrollmentInfo();
        }
Esempio n. 2
0
 public dtoEnrollment()
 {
     NotAvailableFor = new List <EnrollingStatus>();
     Constraints     = new List <dtoCommunityConstraint>();
     ExtendedInfo    = new dtoEnrollmentInfo();
 }