i have a program.
and i have some dates. they are:
1. 2011/08/01
2. 2011/08/02
3. 2011/08/03 (on this date there was an error on Database(for example),that can make user can't generate the report on that date)
4. 2011/08/05
5. 2011/08/06
and when it's on 2011/08/06 it's automatically generate the LatestSuccessDa te(2011/08/02) to (2011/08/05) on excel sheet. for information, I use HSSFWorkbook to generate it to excel.
this is a part code that i mean:
and i have some dates. they are:
1. 2011/08/01
2. 2011/08/02
3. 2011/08/03 (on this date there was an error on Database(for example),that can make user can't generate the report on that date)
4. 2011/08/05
5. 2011/08/06
and when it's on 2011/08/06 it's automatically generate the LatestSuccessDa te(2011/08/02) to (2011/08/05) on excel sheet. for information, I use HSSFWorkbook to generate it to excel.
this is a part code that i mean:
Code:
DateTime processDate = new DateTime(2011, 08, 06).AddDays(-1); DateTime LastSuccessdate = processDate.AddDays(1); if (processDate > LastSuccessdate || processDate <= DateTime.Today.AddDays(-1)) { string destinationFolder = Settings.Default.CopyToDestinationFolder; string prefixFileName = Settings.Default.PrefixFileName; string[] excelColumnHeaderNames = Settings.Default.ExcelColumnHeaderNames.Split(','); IEnumerable<string[]> rows = loader.GetRows(sqlQuery, smsLastSucessDate, processDate); ExcelWriter excelWriter = new ExcelWriter(destinationFolder, prefixFileName); excelWriter.Write(excelColumnHeaderNames, rows, DateTime.Today.AddDays(-1)); }
Comment