Exemple #1
0
        private DateTime GetAggStartDateBasedOnGeneratedReports()
        {
            FileSystemInfo newestFile = NewestFileName(2000, string.Format("AS*_{0}.xls", litCurrentThreshold.Text));

            DateTime result;

            if (newestFile == null)
            {
                result = DateTime.Now.Date.AddMonths(-1);
            }
            else
            {
                ParsedFileName pfn = ParsedFileName.Parse(newestFile.Name);
                result = pfn.AggStartDate;
            }

            return(result);
        }
Exemple #2
0
        private DateTime GetReportDateBasedOnGeneratedReports(DateTime aggStartDate)
        {
            FileSystemInfo newestFile = NewestFileName(ppRep.StartPeriod.Year, string.Format("AS{0:yyyyMM}_Report*_{1}.xls", aggStartDate, litCurrentThreshold.Text));

            DebugText += string.Format(@"<div style=""padding-left: 10px;"">newestFile = ""{0}""</div>", newestFile);

            DateTime repDate;

            if (newestFile == null || newestFile.LastWriteTime.Year == ppRep.StartPeriod.Year) // no files found, new agg start
            {
                repDate       = aggStartDate;
                ppRep.Enabled = false;
            }
            else
            {
                ParsedFileName pfn = ParsedFileName.Parse(newestFile.Name);
                repDate       = pfn.ReportDate.AddMonths(1);
                ppRep.Enabled = true;
            }

            return(repDate); //the maximum allowable date for the report
        }