/// <summary> /// Retrieves the merchandise calendar week from the date. Returns 0 if restated is true and date falls within the "lost" week in a 53 week year restated for comparability. /// </summary> /// <param name="date"> /// Date you wish to get the merchandise week from. /// </param> /// <returns> /// integer /// </returns> public static int GetWeek(DateTime date) { // Get information about the merchandise year. var merchYear = new MerchYear(GetYear(date)); // TimeSpan used to calculate the number of weeks from the beginning of the year to the date. var timeSpan = date - merchYear.DateRange.StartDate; // Gets the number of days + 1 divided by 7, rounded up to the nearest whole number. var returnValue = (int)(Math.Ceiling((decimal)(timeSpan.Days + 1) / 7)); return(returnValue); }
/// <summary> /// Retrieves all Merchandise Dates within the Merchandise Year /// </summary> /// <param name="year"> /// The year you wish to get the list of dates for. /// </param> /// <returns> /// IEnumerable<MerchandiseDate> /// </returns> public static IEnumerable<MerchandiseDate> GetMerchandiseDatesByYear(int year) { MerchYear merchYear = new MerchYear(year); return GetMerchandiseDatesBetween(merchYear.DateRange); }
/// <summary> /// Retrieves all Merchandise Dates within the Merchandise Year /// </summary> /// <param name="year"> /// The year you wish to get the list of dates for. /// </param> /// <returns> /// IEnumerable<MerchandiseDate> /// </returns> public static IEnumerable <MerchandiseDate> GetMerchandiseDatesByYear(int year) { MerchYear merchYear = new MerchYear(year); return(GetMerchandiseDatesBetween(merchYear.DateRange)); }