/* * private void calculateMonthlyFiguresWithFOI(Excel.Workbook processed, DataSheet<WorkBoxDetails> allWorkBoxes) * { * // Now the monthly figures with FOI included: * DataSheet<FiguresForOneMonth> monthlyFiguresWithFOI = new DataSheet<FiguresForOneMonth>(processed, "Monthly Figures w FOI"); * DateTime monthWalker = new DateTime(2012, 01, 01); * * // First add all of the months up until today: * while (monthWalker < DateTime.Now) * { * monthlyFiguresWithFOI.Add(new FiguresForOneMonth(monthWalker)); * monthWalker = monthWalker.AddMonths(1); * } * * * // Now add all of the work boxes to each of the relevant months: * foreach (WorkBoxDetails workBox in allWorkBoxes) * { * if (!workBox.LoadedOK) * { * continue; * } * * try * { * if (workBox.hasBeenCreated) * { * monthWalker = (new DateTime(workBox.DateCreated.Year, workBox.DateCreated.Month, 1)).AddMonths(-1); * * while (monthWalker < DateTime.Now) * { * FiguresForOneMonth month = monthlyFiguresWithFOI[monthWalker.Date.Month + " " + monthWalker.Date.Year]; * * if (month != null) month.Add(workBox); * * monthWalker = monthWalker.AddMonths(1); * } * * } * * } * catch (Exception exception) * { * } * } * * monthlyFiguresWithFOI.SaveToSheet(); * } */ private void calculateUsedRecordsTypesFigures(Excel.Workbook processed) { // Now we're going to work out the figures for each records type DataSheet <FiguresForOneRecordsType> recordsTypesFigures = new DataSheet <FiguresForOneRecordsType>(processed, "Used Records Types", true); foreach (WorkBoxDetails workBox in AllWorkBoxes) { if (!workBox.LoadedOK || !workBox.hasBeenOpened || String.IsNullOrEmpty(workBox.RecordsType)) { continue; } FiguresForOneRecordsType figuresForRecordsType = recordsTypesFigures[workBox.RecordsType]; if (figuresForRecordsType == null) { figuresForRecordsType = new FiguresForOneRecordsType(workBox.RecordsType); recordsTypesFigures.Add(figuresForRecordsType); RecordsTypesDetails details = AllRecordsTypes[workBox.RecordsType]; figuresForRecordsType.SetRecordsTypeDetails(details); } figuresForRecordsType.Add(workBox); } foreach (RecordsDetails record in AllRecords) { if (!record.LoadedOK || String.IsNullOrEmpty(record.RecordsType)) { continue; } FiguresForOneRecordsType figuresForRecordsType = recordsTypesFigures[record.RecordsType]; if (figuresForRecordsType == null) { figuresForRecordsType = new FiguresForOneRecordsType(record.RecordsType); recordsTypesFigures.Add(figuresForRecordsType); RecordsTypesDetails details = AllRecordsTypes[record.RecordsType]; figuresForRecordsType.SetRecordsTypeDetails(details); } figuresForRecordsType.Add(record); } recordsTypesFigures.SaveToSheet(); }
public void SetRecordsTypeDetails(RecordsTypesDetails recordsTypeDetails) { Details = recordsTypeDetails; if (Details == null) { return; } if (!String.IsNullOrEmpty(Details["Auto-Close Trigger Date"] as String)) { WBAutoCloseRule = "" + Details["Auto-Close Time Scalar"] + " " + Details["Auto-Close Time Unit"] + " after " + Details["Auto-Close Trigger Date"]; } if (!String.IsNullOrEmpty(Details["Retention Trigger Date"] as String)) { WBRetentionRule = "" + Details["Retention Time Scalar"] + " " + Details["Retention Time Unit"] + " after " + Details["Retention Trigger Date"]; } }