예제 #1
0
        /// <summary>
        /// Reads daily offers for provided Date
        /// </summary>
        /// <param name="date"></param>
        /// <returns></returns>
        public IEnumerable <DailyOfferFood> ReadDailyOffers(DateTime date)
        {
            var foundMerge = FindDateRangeInSheets(date);

            if (foundMerge.IsSuccess)
            {
                var namesRange = A1Notation.ToRangeFormat(
                    foundMerge.Value.Range.StartColumnIndex.Value, 2,    // Start Corner
                    foundMerge.Value.Range.EndColumnIndex.Value, 6);     // End corner

                var offersList = _reader.ReadSheetData(string.Format("'{0}'!{1}", foundMerge.Value.SheetName, namesRange));

                return(DataExtractor.ExtractDailyOffers(offersList));
            }
            else
            {
                _logger.LogError($"Unable to load daily offers for Restaurant Hedone on date {date.Date.ToString()}");
                return(new DailyOfferFood[0]);
            }
        }
예제 #2
0
 /// <summary>
 /// Reads food items that are offered any day.
 /// </summary>
 /// <returns></returns>
 public IEnumerable <FoodItem> ReadFoodItems()
 {
     return(DataExtractor.ExtractFoodItems(
                _reader.ReadSheetData(
                    Configuration.HedoneOfferRange)));
 }