/// <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."); }
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."); } }
public void YearQuarter_FromString_Success() { string expected = "B014"; YearQuarter yrq = YearQuarter.FromString(expected); Assert.AreEqual(expected, yrq.ToString()); }
public void YearQuarter_ToFriendlyName_UpperBound() { string expected = "Spring 2259"; string actual = YearQuarter.ToFriendlyName("Z894"); Assert.AreEqual(expected, actual); }
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); } }
public void YearQuarter_FriendlyName_Success() { string expected = "Spring 2011"; YearQuarter yrq = YearQuarter.FromString("B014"); Assert.AreEqual(expected, yrq.FriendlyName); }
public void YearQuarter_ToFriendlyName_Success() { string expected = "Spring 2011"; string actual = YearQuarter.ToFriendlyName("B014"); Assert.AreEqual(expected, actual); }
public void YearQuarter_Equals_AnotherCreatedFromFriendlyName() { YearQuarter yrq1 = YearQuarter.FromString("B121"); YearQuarter yrq2 = YearQuarter.FromFriendlyName("Summer 2011"); Assert.AreEqual(yrq1, yrq2); }
public void YearQuarter_Equals_Another() { YearQuarter yrq1 = YearQuarter.FromString("B121"); YearQuarter yrq2 = YearQuarter.FromString("B121"); Assert.AreEqual(yrq1, yrq2); }
public RoyaleYearQuarter(SupportedYear year, YearQuarter yearQuarter, bool openForPlay, bool finished) { Year = year; YearQuarter = yearQuarter; OpenForPlay = openForPlay; Finished = finished; }
} // 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
// ---------------------------------------------------------------------- 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 ); }
public void YearQuarter_Max() { string yrqMin = TestHelper.MaxYrq; YearQuarter yrq = YearQuarter.FromString(yrqMin); Assert.AreEqual(yrqMin, yrq.ID); Assert.AreEqual("[Maximum]", yrq.FriendlyName); }
public void Should_Construct_YearQuarter() { YearQuarter yearQuarter = new YearQuarter(id, nameEn, nameAr); _ = new YearQuarter(); yearQuarter.ShouldNotBeNull(); }
// ---------------------------------------------------------------------- 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 // ---------------------------------------------------------------------- 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
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); } }
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); } }
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()); }
} // 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
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); } }
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); } }
public void CurrentYearQuarter_Success() { using (OdsRepository repository = new OdsRepository()) { YearQuarter actual = repository.CurrentYearQuarter; string expected = _dataVerifier.CurrentYrq; Assert.AreEqual(expected, actual.ID); } }
} // 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
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); } }
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)); }
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); }
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); } }
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); } }
// [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."); } }
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); } }
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
// ---------------------------------------------------------------------- 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."); }
// ---------------------------------------------------------------------- public Quarter( int baseYear, YearQuarter yearQuarter, ITimeCalendar calendar ) : base(baseYear, yearQuarter, 1, calendar) { }
// ---------------------------------------------------------------------- public Quarters( DateTime moment, YearQuarter startYearQuarter, int count, ITimeCalendar calendar ) : this(TimeTool.GetYearOf( calendar.YearBaseMonth, calendar.GetYear( moment ), calendar.GetMonth( moment ) ), startYearQuarter, count, calendar) { }
// ---------------------------------------------------------------------- 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 ); } }
// ---------------------------------------------------------------------- public static string SchoolQuarterName( YearQuarter yearQuarter ) { return Format( inst.GetString( "SchoolQuarterName" ), (int)yearQuarter ); }
// ---------------------------------------------------------------------- public Quarter( int baseYear, YearQuarter yearQuarter ) : this(baseYear, yearQuarter, new TimeCalendar()) { }
// ---------------------------------------------------------------------- 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 ); }
// ---------------------------------------------------------------------- public static TimeSpan Quarter( int year, YearQuarter yearQuarter ) { return DateTimeFormatInfo.CurrentInfo == null ? TimeSpan.Zero : Quarter( DateTimeFormatInfo.CurrentInfo.Calendar, year, yearQuarter ); }
// ---------------------------------------------------------------------- public static void NextQuarter( YearQuarter startQuarter, out int year, out YearQuarter quarter ) { AddQuarter( startQuarter, 1, out year, out quarter ); }
// ---------------------------------------------------------------------- public static void PreviousQuarter( YearQuarter startQuarter, out int year, out YearQuarter quarter ) { AddQuarter( startQuarter, -1, out year, out quarter ); }
// ---------------------------------------------------------------------- public static void AddQuarter( YearQuarter startQuarter, int count, out int year, out YearQuarter quarter ) { AddQuarter( 0, startQuarter, count, out year, out quarter ); }
/// <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(); }
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); }
/// <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; }
/// <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; }
// ---------------------------------------------------------------------- public Quarters( DateTime moment, YearQuarter startYearQuarter, int count ) : this(moment, startYearQuarter, count, new TimeCalendar()) { }
// ---------------------------------------------------------------------- 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 ); }
// ---------------------------------------------------------------------- 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; }
// ---------------------------------------------------------------------- public Quarters( int startYear, YearQuarter startYearQuarter, int quarterCount, ITimeCalendar calendar ) : base(startYear, startYearQuarter, quarterCount, calendar) { }
// ---------------------------------------------------------------------- protected QuarterTimeRange( int startYear, YearQuarter startQuarter, int quarterCount ) : this(startYear, startQuarter, quarterCount, new TimeCalendar()) { }
// ---------------------------------------------------------------------- public Quarters( int startYear, YearQuarter startYearQuarter, int quarterCount ) : this(startYear, startYearQuarter, quarterCount, new TimeCalendar()) { }
// ---------------------------------------------------------------------- public static string SystemQuarterOfYearName( YearQuarter yearQuarter, int year ) { return Format( inst.GetString( "SystemQuarterOfYearName" ), (int)yearQuarter, year ); }
// ---------------------------------------------------------------------- public static string CalendarQuarterName( YearQuarter yearQuarter ) { return Format( inst.GetString( "CalendarQuarterName" ), (int)yearQuarter ); }