/// <summary>
        /// Retrieves current and future course descriptions from the database
        /// </summary>
        /// <param name="courseId">The course ID to retrieve the description for.</param>
        /// <param name="yrq">
        ///		The <see cref="YearQuarter"/> to retrieve the description for. If not supplied, will default to the
        ///		<see cref="OdsRepository.CurrentYearQuarter"/>.
        /// </param>
        /// <returns>
        /// A collection of <see cref="CourseDescriptionEntityBase">course description entites</see>:
        /// <list type="table">
        ///		<item>
        ///			<term>First record</term>
        ///			<description>
        ///				The course description for the specified <paramref name="yrq"/> (or <see cref="OdsRepository.CurrentYearQuarter"/>
        ///				if not supplied.
        ///			</description>
        ///		</item>
        ///		<item>
        ///			<term>Successive records</term>
        ///			<description>
        ///				Future course description updates, in the order they will be updated (by YearQuarter).
        ///			</description>
        ///		</item>
        /// </list>
        /// </returns>
        /// <exception cref="ArgumentNullException"><paramref name="yrq"/> is null.</exception>
        public IList <CourseDescription> GetDescriptions(ICourseID courseId, YearQuarter yrq)
        {
            if (yrq != null)
            {
                // Where() expressions within Entity Framework queries can only use primitive data types
                string strYrqId     = yrq.ID;
                string subject      = courseId.Subject;
                string courseNumber = courseId.Number;

                IEnumerable <CourseDescription> list = _PCdescriptionsEntity2.Where(desc => desc.CourseID.StartsWith(subject) && desc.CourseID.EndsWith(courseNumber))
                                                       // get the active description for the current quarter...
                                                       .Where(desc => desc.YearQuarterBegin.CompareTo(strYrqId) <= 0)
                                                       .OrderByDescending(d => d.YearQuarterBegin)
                                                       .Take(1)
                                                       // ...and any upcoming description changes
                                                       .Union(_PCdescriptionsEntity2.Where(d => d.CourseID.StartsWith(subject) && d.CourseID.EndsWith(courseNumber))
                                                              .Where(d => d.YearQuarterBegin.CompareTo(strYrqId) > 0)
                                                              .OrderBy(d => d.YearQuarterBegin)
                                                              ).Select(c => new CourseDescription
                {
                    CourseID          = c.CourseID,
                    Description       = c.Description,
                    _YearQuarterBegin = c.YearQuarterBegin
                });
                return(list.ToList());
            }

            throw new ArgumentNullException("yrq", "YearQuarter cannot be null.");
        }
コード例 #2
0
        public void GetSections_SimulateClassScheduleApplication()
        {
            // Simulates actual call from Online Class Schedule application - which passes extra
            IList <ISectionFacet> facets = TestHelper.GetFacets(new ModalityFacet(ModalityFacet.Options.Online));

            facets.Add(new TimeFacet(new TimeSpan(0, 0, 0), new TimeSpan(23, 59, 0)));
            facets.Add(new DaysFacet(DaysFacet.Options.All));

            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter yrq = repository.CurrentYearQuarter;

                string          subject  = TestHelper.Data.CourseSubjectOfferedEveryQuarter;
                IList <Section> sections = repository.GetSections(subject, yrq, facets);

                int count = sections.Count;
                Assert.IsTrue(count > 0, "No records returned.");

                int expectedSectionCount = _dataVerifier.GetSectionCount(string.Format("(CourseID like '{0}%' and SBCTCMisc1 like '3%' and YearQuarterID = '{1}')", subject, yrq.ID));
                Assert.AreEqual(expectedSectionCount, count);

                int allSectionCount = _dataVerifier.GetSectionCount("not ClassID is null");
                Assert.IsTrue(allSectionCount > count, "Query failed: ALL records were returned.");
            }
        }
コード例 #3
0
        public void YearQuarter_FromString_Success()
        {
            string      expected = "B014";
            YearQuarter yrq      = YearQuarter.FromString(expected);

            Assert.AreEqual(expected, yrq.ToString());
        }
コード例 #4
0
        public void YearQuarter_ToFriendlyName_UpperBound()
        {
            string expected = "Spring 2259";
            string actual   = YearQuarter.ToFriendlyName("Z894");

            Assert.AreEqual(expected, actual);
        }
コード例 #5
0
        public void GetSections_Fall2011_OnCampus_WideTimeRange()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                TimeSpan startTime = new TimeSpan(2, 55, 0);
                TimeSpan endTime   = new TimeSpan(22, 55, 0);

                IList <ISectionFacet> facets = new List <ISectionFacet>();
                facets.Add(new TimeFacet(startTime, endTime));
                facets.Add(new ModalityFacet(ModalityFacet.Options.OnCampus));
                facets.Add(new AvailabilityFacet(AvailabilityFacet.Options.All));

                string subject = null;

//				IList<Section> sections = repository.GetSections(subject, YearQuarter.FromString("B122"), facets);
                IList <Section> sections = repository.GetSections(YearQuarter.FromString("B122"), facets);
                Assert.IsTrue(sections.Count > 0, "No sections were returned");

                // make sure we have sections that fall in the specified range...
                int rightSectionCount = sections.Where(s => s.Offered.Where(o => (o.StartTime.HasValue && o.StartTime.Value.TimeOfDay.CompareTo(startTime) >= 0 && o.StartTime.Value.TimeOfDay.CompareTo(endTime) <= 0)).Count() > 0).Count();
                Assert.IsTrue(rightSectionCount > 0, "Section records do not include start/end times in the specified range.");

                // ... and that we don't have any that fall outside that range
                int wrongSectionCount = sections.Where(s => s.Offered.Where(o => (o.StartTime.HasValue && o.StartTime.Value.TimeOfDay.CompareTo(startTime) < 0 && o.StartTime.Value.TimeOfDay.CompareTo(endTime) > 0)).Count() > 0).Count();
                Assert.IsTrue(wrongSectionCount <= 0, "Found {0} sections with start/end times outside of {1} - {2}", wrongSectionCount, startTime, endTime);
            }
        }
コード例 #6
0
        public void YearQuarter_FriendlyName_Success()
        {
            string      expected = "Spring 2011";
            YearQuarter yrq      = YearQuarter.FromString("B014");

            Assert.AreEqual(expected, yrq.FriendlyName);
        }
コード例 #7
0
        public void YearQuarter_ToFriendlyName_Success()
        {
            string expected = "Spring 2011";
            string actual   = YearQuarter.ToFriendlyName("B014");

            Assert.AreEqual(expected, actual);
        }
コード例 #8
0
        public void YearQuarter_Equals_AnotherCreatedFromFriendlyName()
        {
            YearQuarter yrq1 = YearQuarter.FromString("B121");
            YearQuarter yrq2 = YearQuarter.FromFriendlyName("Summer 2011");

            Assert.AreEqual(yrq1, yrq2);
        }
コード例 #9
0
        public void YearQuarter_Equals_Another()
        {
            YearQuarter yrq1 = YearQuarter.FromString("B121");
            YearQuarter yrq2 = YearQuarter.FromString("B121");

            Assert.AreEqual(yrq1, yrq2);
        }
コード例 #10
0
 public RoyaleYearQuarter(SupportedYear year, YearQuarter yearQuarter, bool openForPlay, bool finished)
 {
     Year        = year;
     YearQuarter = yearQuarter;
     OpenForPlay = openForPlay;
     Finished    = finished;
 }
コード例 #11
0
        }         // QuarterTimeRange

        // ----------------------------------------------------------------------
        protected QuarterTimeRange(int startYear, YearQuarter startQuarter, int quarterCount, ITimeCalendar calendar) :
            base(GetPeriodOf(calendar, startYear, startQuarter, quarterCount), calendar)
        {
            this.startYear    = startYear;
            this.startQuarter = startQuarter;
            this.quarterCount = quarterCount;
            TimeTool.AddQuarter(startYear, startQuarter, quarterCount - 1, out endYear, out endQuarter);
        }         // QuarterTimeRange
コード例 #12
0
 // ----------------------------------------------------------------------
 protected QuarterTimeRange( int startYear, YearQuarter startQuarter, int quarterCount, ITimeCalendar calendar )
     : base(GetPeriodOf( calendar.YearBaseMonth, startYear, startQuarter, quarterCount ), calendar)
 {
     this.startYear = startYear;
     this.startQuarter = startQuarter;
     this.quarterCount = quarterCount;
     TimeTool.AddQuarter( startYear, startQuarter, quarterCount - 1, out endYear, out endQuarter );
 }
コード例 #13
0
        public void YearQuarter_Max()
        {
            string      yrqMin = TestHelper.MaxYrq;
            YearQuarter yrq    = YearQuarter.FromString(yrqMin);

            Assert.AreEqual(yrqMin, yrq.ID);
            Assert.AreEqual("[Maximum]", yrq.FriendlyName);
        }
コード例 #14
0
        public void Should_Construct_YearQuarter()
        {
            YearQuarter yearQuarter = new YearQuarter(id, nameEn, nameAr);

            _ = new YearQuarter();

            yearQuarter.ShouldNotBeNull();
        }
コード例 #15
0
ファイル: TimeTool.cs プロジェクト: jwg4/date-difference
        // ----------------------------------------------------------------------
        public static void AddQuarter( int startYear, YearQuarter startQuarter, int count, out int year, out YearQuarter quarter )
        {
            int offsetYear = ( Math.Abs( count ) / TimeSpec.QuartersPerYear ) + 1;
            int startQuarterCount = ( ( startYear + offsetYear ) * TimeSpec.QuartersPerYear ) + ( (int)startQuarter - 1 );
            int targetQuarterCount = startQuarterCount + count;

            year = ( targetQuarterCount / TimeSpec.QuartersPerYear ) - offsetYear;
            quarter = (YearQuarter)( ( targetQuarterCount % TimeSpec.QuartersPerYear ) + 1 );
        }
コード例 #16
0
        }         // AddQuarter

        // ----------------------------------------------------------------------
        public static void AddQuarter(int startYear, YearQuarter startQuarter, int count, out int year, out YearQuarter quarter)
        {
            int offsetYear         = (Math.Abs(count) / TimeSpec.QuartersPerYear) + 1;
            int startQuarterCount  = ((startYear + offsetYear) * TimeSpec.QuartersPerYear) + ((int)startQuarter - 1);
            int targetQuarterCount = startQuarterCount + count;

            year    = (targetQuarterCount / TimeSpec.QuartersPerYear) - offsetYear;
            quarter = (YearQuarter)((targetQuarterCount % TimeSpec.QuartersPerYear) + 1);
        }         // AddQuarter
コード例 #17
0
        public void GetSectionsByCourseID_WithYrq_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter     yrq      = YearQuarter.FromString("B012");
                IList <Section> sections = repository.GetSections(CourseID.FromString("ART 101"), yrq);

                Assert.IsTrue(sections.Count > 0);
            }
        }
コード例 #18
0
        public void GetSections_VerifyCommonCourseCharacterRemovedFromCourseID()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList <Section> sections = repository.GetSections("ENGL", YearQuarter.FromString("B122"));

                int count = sections.Where(s => s.CourseID.Contains("&")).Count();
                Assert.IsTrue(count == 0, "{0} records found to still contain the CCN character ('&') in the CourseID", count);
            }
        }
コード例 #19
0
    public async Task <IReadOnlyList <MasterGameYear> > GetMasterGamesForYearQuarter(YearQuarter yearQuarter)
    {
        IEnumerable <MasterGameYear> masterGameYears = await _masterGameRepo.GetMasterGameYears(yearQuarter.Year);

        var currentDate = _clock.GetToday();

        masterGameYears = masterGameYears.Where(x => !x.MasterGame.ReleaseDate.HasValue || x.MasterGame.ReleaseDate >= yearQuarter.FirstDateOfQuarter);
        masterGameYears = masterGameYears.OrderByDescending(x => x.GetProjectedFantasyPoints(ScoringSystem.GetDefaultScoringSystem(yearQuarter.Year), false));

        return(masterGameYears.ToList());
    }
コード例 #20
0
ファイル: Duration.cs プロジェクト: netintellect/EF7App
        }         // Quarter

        // ----------------------------------------------------------------------
        public static TimeSpan Quarter(Calendar calendar, int year, YearQuarter yearQuarter)
        {
            YearMonth[] quarterMonths = TimeTool.GetMonthsOfQuarter(yearQuarter);
            TimeSpan    duration      = TimeSpec.NoDuration;

            foreach (YearMonth quarterMonth in quarterMonths)
            {
                duration = duration.Add(Month(calendar, year, quarterMonth));
            }
            return(duration);
        }         // Quarter
コード例 #21
0
        public void GetSubjectsWithYQ_Success()
        {
            using (OdsRepository repo = new OdsRepository())
            {
                YearQuarter          yearQuarter = repo.CurrentYearQuarter;
                IList <CoursePrefix> actual      = repo.GetCourseSubjects(yearQuarter);

                int expectedCount = _dataVerifier.GetCourseSubjectCountForSections(string.Format("YearQuarterID = '{0}'", yearQuarter.ID), true);
                Assert.AreEqual(expectedCount, actual.Count);
            }
        }
コード例 #22
0
        public void GetSectionsBySubject_WithQuarterFilter_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter     yrq      = YearQuarter.FromString("B122");
                IList <Section> sections = repository.GetSections("ENGL", yrq);
                int             count    = sections.Where(s => s.Yrq.ID == "B122" && s.CourseID.StartsWith("ENGL")).Count();

                Assert.AreEqual(sections.Count, count);
            }
        }
コード例 #23
0
        public void CurrentYearQuarter_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter actual = repository.CurrentYearQuarter;

                string expected = _dataVerifier.CurrentYrq;

                Assert.AreEqual(expected, actual.ID);
            }
        }
コード例 #24
0
        }         // ComputeHashCode

        // ----------------------------------------------------------------------
        private static TimeRange GetPeriodOf(YearMonth yearMonth, int year, YearQuarter yearQuarter, int quarterCount)
        {
            if (quarterCount < 1)
            {
                throw new ArgumentOutOfRangeException("quarterCount");
            }

            DateTime yearStart = new DateTime(year, (int)yearMonth, 1);
            DateTime start     = yearStart.AddMonths(((int)yearQuarter - 1) * TimeSpec.MonthsPerQuarter);
            DateTime end       = start.AddMonths(quarterCount * TimeSpec.MonthsPerQuarter);

            return(new TimeRange(start, end));
        }         // GetPeriodOf
コード例 #25
0
        public void GetSectionsByYearQuarter_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                string      yearQuarterId = "B012";
                YearQuarter yrq           = YearQuarter.FromString(yearQuarterId);

                IList <Section> sections = repository.GetSections(yrq);
                int             count    = sections.Where(s => s.Yrq.ID == yearQuarterId).Count();

                Assert.AreEqual(sections.Count, count);
            }
        }
コード例 #26
0
ファイル: Now.cs プロジェクト: JeroenMX/TimePeriod
        public static DateTime Quarter(YearMonth yearStartMonth)
        {
            DateTime now  = ClockProxy.Clock.Now;
            int      year = now.Year;

            if (now.Month - (int)yearStartMonth < 0)
            {
                year--;
            }
            YearQuarter quarter = TimeTool.GetQuarterOfMonth(yearStartMonth, (YearMonth)now.Month);
            int         months  = ((int)quarter - 1) * TimeSpec.MonthsPerQuarter;

            return(new DateTime(year, (int)yearStartMonth, 1).AddMonths(months));
        }
コード例 #27
0
        public bool WillReleaseInQuarter(YearQuarter yearQuarter)
        {
            if (MasterGame.ReleaseDate.HasValue && yearQuarter.FirstDateOfQuarter > MasterGame.ReleaseDate.Value)
            {
                return(false);
            }

            if (yearQuarter.LastDateOfQuarter < MasterGame.MinimumReleaseDate)
            {
                return(false);
            }

            return(true);
        }
コード例 #28
0
        public void ForSubject_CurrentRegistrationQuarter()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                string      subject = "ENGL";
                YearQuarter yrq     = repository.CurrentRegistrationQuarter;

                int sectionCount = repository.SectionCountForCourse(subject, yrq, TestHelper.GetFacets(false));
                Assert.IsTrue(sectionCount > 0, string.Format("No sections found for '{0}' in '{1}'", subject, yrq.FriendlyName));

                int expectedCount = _dataVerifier.GetSectionCount(string.Format("YearQuarterID = '{0}' AND CourseID LIKE '{1}%' AND NOT CourseID LIKE '%&%'", yrq, subject));
                Assert.AreEqual(expectedCount, sectionCount);
            }
        }
コード例 #29
0
        public void ForCourseIDCommonCourse_CurrentRegistrationQuarter()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                ICourseID   courseID = CourseID.FromString("ENGL& 101");
                YearQuarter yrq      = repository.CurrentRegistrationQuarter;

                int sectionCount = repository.SectionCountForCourse(courseID, yrq, TestHelper.GetFacets(false));
                Assert.IsTrue(sectionCount > 0, string.Format("No sections found for '{0}' in '{1}'", courseID, yrq.FriendlyName));

                int expectedCount = _dataVerifier.GetSectionCount(string.Format("YearQuarterID = '{0}' AND CourseID LIKE '{1}%{2}' AND CourseID LIKE '%&%'", yrq, courseID.Subject, courseID.Number));
                Assert.AreEqual(expectedCount, sectionCount);
            }
        }
コード例 #30
0
//		[Conditional("BC_ONLY")]
        public void GetSectionsByCourseID_WithYrq_VerifyInstructorEmail()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter yrq      = YearQuarter.FromString("B233");
                string      courseId = "ART 101";

                IList <Section> sections = repository.GetSections(CourseID.FromString(courseId), yrq, TestHelper.GetFacets());
                Assert.IsTrue(sections.Count > 0, "No sections found for {0} in {1}", courseId, yrq.FriendlyName);

                int emailCount = sections.Where(s => s.Offered.Where(o => !string.IsNullOrWhiteSpace(o.InstructorEmail)).Count() > 0).Count();
                Assert.IsTrue(emailCount > 0, "No instructor e-mails found.");
            }
        }
コード例 #31
0
        public void GetSections_ByCourseIDCollection_WithYrq_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter yrq = repository.CurrentYearQuarter;

                int courseIdCount     = 3;
                IList <ICourseID> ids = _dataVerifier.GetCourseIDListFromQuery("eng", courseIdCount, string.Format(" and YearQuarterID = '{0}' ", yrq));

                IList <Section> sections     = repository.GetSections(ids, yrq, TestHelper.GetFacets());
                int             sectionCount = sections.Count;

                Assert.IsTrue(courseIdCount <= sectionCount, "Sections returned ({0}) is less than # of CourseIDs ({1})", sectionCount, courseIdCount);
            }
        }
コード例 #32
0
        public void SingleQuartersTest()
        {
            const int         startYear    = 2004;
            const YearQuarter startQuarter = YearQuarter.Second;
            Quarters          quarters     = new Quarters(startYear, startQuarter, 1);

            Assert.AreEqual(quarters.YearBaseMonth, YearMonth.January);
            Assert.AreEqual(quarters.QuarterCount, 1);
            Assert.AreEqual(quarters.StartQuarter, startQuarter);
            Assert.AreEqual(quarters.StartYear, startYear);
            Assert.AreEqual(quarters.EndYear, startYear);
            Assert.AreEqual(quarters.EndQuarter, YearQuarter.Second);
            Assert.AreEqual(quarters.GetQuarters().Count, 1);
            Assert.IsTrue(quarters.GetQuarters()[0].IsSamePeriod(new Quarter(2004, YearQuarter.Second)));
        }         // SingleQuartersTest
コード例 #33
0
ファイル: QuarterDemo.cs プロジェクト: jwg4/date-difference
        // ----------------------------------------------------------------------
        public static void ShowAll( int periodCount,  int startYear, YearQuarter yearQuarter, TimeCalendarConfig calendarConfig )
        {
            WriteLine( "Input: count={0}, year={1}, quarter={2}", periodCount, startYear, yearQuarter );
            WriteLine();

            QuarterTimeRange quarterTimeRange;
            if ( periodCount == 1 )
            {
                Quarter quarter = new Quarter( startYear, yearQuarter, new TimeCalendar( calendarConfig ) );
                quarterTimeRange = quarter;

                Quarter previousQuarter = quarter.GetPreviousQuarter();
                Quarter nextQuarter = quarter.GetNextQuarter();

                ShowQuarter( quarter );
                ShowCompactQuarter( previousQuarter, "Previous Quarter" );
                ShowCompactQuarter( nextQuarter, "Next Quarter" );
                WriteLine();
            }
            else
            {
                Quarters quarters = new Quarters( startYear, yearQuarter, periodCount, new TimeCalendar( calendarConfig ) );
                quarterTimeRange = quarters;

                ShowQuarters( quarters );
                WriteLine();

                foreach ( Quarter quarter in quarters.GetQuarters() )
                {
                    ShowCompactQuarter( quarter );
                }
                WriteLine();
            }

            foreach ( Month month in quarterTimeRange.GetMonths() )
            {
                MonthDemo.ShowCompactMonth( month );
            }
            WriteLine();
        }
        /// <summary>
        /// Retrieves current and future course descriptions from the database
        /// </summary>
        /// <param name="courseId">The course ID to retrieve the description for.</param>
        /// <param name="yrq">
        ///		The <see cref="YearQuarter"/> to retrieve the description for. If not supplied, will default to the
        ///		<see cref="OdsRepository.CurrentYearQuarter"/>.
        /// </param>
        /// <returns>
        /// A collection of <see cref="CourseDescriptionEntityBase">course description entites</see>:
        /// <list type="table">
        ///		<item>
        ///			<term>First record</term>
        ///			<description>
        ///				The course description for the specified <paramref name="yrq"/> (or <see cref="OdsRepository.CurrentYearQuarter"/>
        ///				if not supplied.
        ///			</description>
        ///		</item>
        ///		<item>
        ///			<term>Successive records</term>
        ///			<description>
        ///				Future course description updates, in the order they will be updated (by YearQuarter).
        ///			</description>
        ///		</item>
        /// </list>
        /// </returns>
        /// <exception cref="ArgumentNullException"><paramref name="yrq"/> is null.</exception>
        public IList<CourseDescription> GetDescriptions(ICourseID courseId, YearQuarter yrq)
        {
            if (_descriptionsEntity != null)
            {
                if (yrq != null)
                {
                    // Where() expressions within Entity Framework queries can only use primitive data types
                    string strYrqId = yrq.ID;
                    string subject = courseId.Subject;
                    string courseNumber = courseId.Number;

                    IEnumerable<CourseDescription> list = _descriptionsEntity.Where(desc => desc.CourseID.StartsWith(subject) && desc.CourseID.EndsWith(courseNumber))
                                                                                                                                        // get the active description for the current quarter...
                                                                                                                                        .Where(desc => desc.YearQuarterBegin.CompareTo(strYrqId) <= 0 )
                                                                                                                                        .OrderByDescending(d => d.YearQuarterBegin)
                                                                                                                                        .Take(1)
                                                                                                                                        // ...and any upcoming description changes
                                                                                                                                        .Union(_descriptionsEntity.Where(d => d.CourseID.StartsWith(subject) && d.CourseID.EndsWith(courseNumber))
                                                                                                                                                .Where(d => d.YearQuarterBegin.CompareTo(strYrqId) > 0)
                                                                                                                                                .OrderBy(d => d.YearQuarterBegin)
                                                                                                                                        ).Select(c => new CourseDescription
                                                                                                                                                                        {
                                                                                                                                                                                CourseID = c.CourseID,
                                                                                                                                                                                Description = c.Description,
                                                                                                                                                                                _YearQuarterBegin = c.YearQuarterBegin
                                                                                                                                                                        });
                    return list.ToList();
                }
            }
            else
            {
                // if we weren't given a valid _descriptionsEntity, return an empty list
                return new List<CourseDescription>();
            }

            throw new ArgumentNullException("yrq", "YearQuarter cannot be null.");
        }
コード例 #35
0
ファイル: Quarter.cs プロジェクト: HoLoveSalt/showhotel
 // ----------------------------------------------------------------------
 public Quarter( int baseYear, YearQuarter yearQuarter, ITimeCalendar calendar )
     : base(baseYear, yearQuarter, 1, calendar)
 {
 }
コード例 #36
0
ファイル: Quarters.cs プロジェクト: HoLoveSalt/showhotel
        // ----------------------------------------------------------------------
        public Quarters( DateTime moment, YearQuarter startYearQuarter, int count, ITimeCalendar calendar )
            : this(TimeTool.GetYearOf( calendar.YearBaseMonth, calendar.GetYear( moment ), calendar.GetMonth( moment ) ),
			startYearQuarter, count, calendar)
        {
        }
コード例 #37
0
ファイル: TimeCalendar.cs プロジェクト: jwg4/date-difference
 // ----------------------------------------------------------------------
 public virtual string GetQuarterOfYearName( int year, YearQuarter yearQuarter )
 {
     switch ( YearType )
     {
         case YearType.CalendarYear:
             return Strings.CalendarQuarterOfYearName( yearQuarter, year );
         case YearType.FiscalYear:
             return Strings.FiscalQuarterOfYearName( yearQuarter, year );
         case YearType.SchoolYear:
             return Strings.SchoolQuarterOfYearName( yearQuarter, year );
         default:
             return Strings.SystemQuarterOfYearName( yearQuarter, year );
     }
 }
コード例 #38
0
ファイル: Strings.cs プロジェクト: HoLoveSalt/showhotel
 // ----------------------------------------------------------------------
 public static string SchoolQuarterName( YearQuarter yearQuarter )
 {
     return Format( inst.GetString( "SchoolQuarterName" ), (int)yearQuarter );
 }
コード例 #39
0
ファイル: Quarter.cs プロジェクト: HoLoveSalt/showhotel
 // ----------------------------------------------------------------------
 public Quarter( int baseYear, YearQuarter yearQuarter )
     : this(baseYear, yearQuarter, new TimeCalendar())
 {
 }
コード例 #40
0
        // ----------------------------------------------------------------------
        private static TimeRange GetPeriodOf( YearMonth yearMonth, int year, YearQuarter yearQuarter, int quarterCount )
        {
            if ( quarterCount < 1 )
            {
                throw new ArgumentOutOfRangeException( "quarterCount" );
            }

            DateTime yearStart = new DateTime( year, (int)yearMonth, 1 );
            DateTime start = yearStart.AddMonths( ( (int)yearQuarter - 1 ) * TimeSpec.MonthsPerQuarter );
            DateTime end = start.AddMonths( quarterCount * TimeSpec.MonthsPerQuarter );
            return new TimeRange( start, end );
        }
コード例 #41
0
ファイル: Duration.cs プロジェクト: HoLoveSalt/showhotel
 // ----------------------------------------------------------------------
 public static TimeSpan Quarter( int year, YearQuarter yearQuarter )
 {
     return DateTimeFormatInfo.CurrentInfo == null ? TimeSpan.Zero : Quarter( DateTimeFormatInfo.CurrentInfo.Calendar, year, yearQuarter );
 }
コード例 #42
0
ファイル: TimeTool.cs プロジェクト: jwg4/date-difference
 // ----------------------------------------------------------------------
 public static void NextQuarter( YearQuarter startQuarter, out int year, out YearQuarter quarter )
 {
     AddQuarter( startQuarter, 1, out year, out quarter );
 }
コード例 #43
0
ファイル: TimeTool.cs プロジェクト: jwg4/date-difference
 // ----------------------------------------------------------------------
 public static void PreviousQuarter( YearQuarter startQuarter, out int year, out YearQuarter quarter )
 {
     AddQuarter( startQuarter, -1, out year, out quarter );
 }
コード例 #44
0
ファイル: TimeTool.cs プロジェクト: jwg4/date-difference
 // ----------------------------------------------------------------------
 public static void AddQuarter( YearQuarter startQuarter, int count, out int year, out YearQuarter quarter )
 {
     AddQuarter( 0, startQuarter, count, out year, out quarter );
 }
コード例 #45
0
 /// <summary>
 /// Retrieves current and future course descriptions from the database
 /// </summary>
 /// <param name="courseId">The course ID to retrieve the description for.</param>
 /// <param name="yrq">
 ///		The <see cref="YearQuarter"/> to retrieve the description for. If not supplied, will default to the
 ///		<see cref="OdsRepository.CurrentYearQuarter"/>.
 /// </param>
 /// <remarks>
 /// This class provides a default fallback in situations where the instantiation of a custom <see cref="ICourseDescriptionStrategy"/> fails.
 /// </remarks>
 /// <returns>
 /// A collection of <see cref="CourseDescriptionEntityBase">course description entites</see>:
 /// <list type="table">
 ///		<item>
 ///			<term>First record</term>
 ///			<description>
 ///				The course description for the specified <paramref name="yrq"/> (or <see cref="OdsRepository.CurrentYearQuarter"/>
 ///				if not supplied.
 ///			</description>
 ///		</item>
 ///		<item>
 ///			<term>Successive records</term>
 ///			<description>
 ///				Future course description updates, in the order they will be updated (by YearQuarter).
 ///			</description>
 ///		</item>
 /// </list>
 /// </returns>
 /// <exception cref="NotImplementedException"/>
 public IList<CourseDescription> GetDescriptions(ICourseID courseId, YearQuarter yrq)
 {
     throw new NotImplementedException();
 }
コード例 #46
0
        private static string getYRQValueForBookstoreURL(YearQuarter yrq)
        {
            string quarter = String.Empty;
            string year = String.Empty;

            if (yrq != null)
            {
                quarter = yrq.FriendlyName.ToUpper();
                year = quarter.Substring(quarter.Length - 2);
                if (quarter.Contains("FALL"))
                {
                    quarter = "F";
                }
                else if (quarter.Contains("WINTER"))
                {
                    quarter = "W";
                }
                else if (quarter.Contains("SPRING"))
                {
                    quarter = "S";
                }
                else // Summer
                {
                    quarter = "X";
                }
            }

            return String.Concat(quarter, year);
        }
コード例 #47
0
 /// <summary>
 /// Allows user to enter "current" in URL in place of quarter
 /// </summary>
 /// <param name="quarter"></param>
 /// <param name="currentQuarter"></param>
 /// <param name="routeData"></param>
 /// <returns></returns>
 public static YearQuarter DetermineRegistrationQuarter(string quarter, YearQuarter currentQuarter, RouteData routeData)
 {
     YearQuarter yrq;
     if (String.IsNullOrWhiteSpace(quarter))
     {
       yrq = null;
     }
     else
     {
       if (quarter.ToUpper() == "CURRENT")
       {
     yrq = currentQuarter;
     routeData.Values["YearQuarter"] = yrq.FriendlyName.Replace(" ", string.Empty);
       }
       else
       {
     yrq = YearQuarter.FromFriendlyName(quarter);
       }
     }
     return yrq;
 }
コード例 #48
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="db"></param>
        /// <param name="searchterm"></param>
        /// <param name="yrq"></param>
        /// <returns></returns>
        private SearchResultNoSectionModel GetNoSectionSearchResults(ClassScheduleDb db, string searchterm, YearQuarter yrq)
        {
            SqlParameter[] parms = {
                            new SqlParameter("SearchWord", searchterm),
                            new SqlParameter("YearQuarterID", yrq.ID)
                                   };

              SearchResultNoSectionModel model = new SearchResultNoSectionModel {SearchedYearQuarter = yrq};
            using (_profiler.Step("Executing 'other classes' stored procedure"))
              {
            model.NoSectionSearchResults = db.ExecuteStoreQuery<SearchResultNoSection>("usp_CourseSearch @SearchWord, @YearQuarterID", parms).ToList();
              }
              return model;
        }
コード例 #49
0
ファイル: Quarters.cs プロジェクト: HoLoveSalt/showhotel
 // ----------------------------------------------------------------------
 public Quarters( DateTime moment, YearQuarter startYearQuarter, int count )
     : this(moment, startYearQuarter, count, new TimeCalendar())
 {
 }
コード例 #50
0
ファイル: TimeTool.cs プロジェクト: jwg4/date-difference
 // ----------------------------------------------------------------------
 public static YearMonth[] GetMonthsOfQuarter( YearQuarter yearQuarter )
 {
     switch ( yearQuarter )
     {
         case YearQuarter.First:
             return TimeSpec.FirstQuarterMonths;
         case YearQuarter.Second:
             return TimeSpec.SecondQuarterMonths;
         case YearQuarter.Third:
             return TimeSpec.ThirdQuarterMonths;
         case YearQuarter.Fourth:
             return TimeSpec.FourthQuarterMonths;
     }
     throw new InvalidOperationException( "invalid year quarter " + yearQuarter );
 }
コード例 #51
0
ファイル: Duration.cs プロジェクト: HoLoveSalt/showhotel
 // ----------------------------------------------------------------------
 public static TimeSpan Quarter( Calendar calendar, int year, YearQuarter yearQuarter )
 {
     YearMonth[] quarterMonths = TimeTool.GetMonthsOfQuarter( yearQuarter );
     TimeSpan duration = TimeSpec.NoDuration;
     foreach ( YearMonth quarterMonth in quarterMonths )
     {
         duration = duration.Add( Month( calendar, year, quarterMonth ) );
     }
     return duration;
 }
コード例 #52
0
ファイル: Quarters.cs プロジェクト: HoLoveSalt/showhotel
 // ----------------------------------------------------------------------
 public Quarters( int startYear, YearQuarter startYearQuarter, int quarterCount, ITimeCalendar calendar )
     : base(startYear, startYearQuarter, quarterCount, calendar)
 {
 }
コード例 #53
0
 // ----------------------------------------------------------------------
 protected QuarterTimeRange( int startYear, YearQuarter startQuarter, int quarterCount )
     : this(startYear, startQuarter, quarterCount, new TimeCalendar())
 {
 }
コード例 #54
0
ファイル: Quarters.cs プロジェクト: HoLoveSalt/showhotel
 // ----------------------------------------------------------------------
 public Quarters( int startYear, YearQuarter startYearQuarter, int quarterCount )
     : this(startYear, startYearQuarter, quarterCount, new TimeCalendar())
 {
 }
コード例 #55
0
ファイル: Strings.cs プロジェクト: HoLoveSalt/showhotel
 // ----------------------------------------------------------------------
 public static string SystemQuarterOfYearName( YearQuarter yearQuarter, int year )
 {
     return Format( inst.GetString( "SystemQuarterOfYearName" ), (int)yearQuarter, year );
 }
コード例 #56
0
ファイル: Strings.cs プロジェクト: HoLoveSalt/showhotel
 // ----------------------------------------------------------------------
 public static string CalendarQuarterName( YearQuarter yearQuarter )
 {
     return Format( inst.GetString( "CalendarQuarterName" ), (int)yearQuarter );
 }