Пример #1
0
        public override void LoadPeriods()
        {
            DirectoryInfo dir = new DirectoryInfo(ConnectionString);

            // Get year directories
            foreach (DirectoryInfo subDir in dir.GetDirectories())
            {
                string year = subDir.Name;
                // Get months in the directory
                foreach (FileInfo file in subDir.GetFiles())
                {
                    int    startIndex = file.Name.LastIndexOf(file.Extension, StringComparison.CurrentCulture);
                    string month      = file.Name.Remove(startIndex);
                    Period period     = new XlPeriod(year, month, connectionString);
                    period.LoadBrews();
                    string periodName = year + "-" + month;
                    if (!periods.ContainsKey(periodName))
                    {
                        periods.Add(periodName, period);
                    }
                    else
                    {
                        periods[periodName] = period;
                    }
                }
            }
        }
Пример #2
0
        // TODO: Create LoadPeriod for lazy loading
        public override Period LoadPeriod(string year, string month)
        {
            Period period = new XlPeriod(year, month, connectionString);

            period.LoadBrews();
            string periodName = year + "-" + month;

            if (!periods.ContainsKey(periodName))
            {
                periods.Add(periodName, period);
            }
            else
            {
                periods[periodName] = period;
            }
            return(period);
        }