Example #1
0
        private void calculateFunctionalAreasFigures(Excel.Workbook processed)
        {
            // Now we're going to work out the figures for each records type
            DataSheet <FiguresForFunctionalArea> funtionalAreas = new DataSheet <FiguresForFunctionalArea>(processed, "Functional Areas", true);

            foreach (TeamDetails team in AllTeams)
            {
                if (!team.LoadedOK || String.IsNullOrEmpty(team.FunctionalArea))
                {
                    continue;
                }

                FiguresForFunctionalArea figuresForFunctionalArea = funtionalAreas[team.FunctionalArea];
                if (figuresForFunctionalArea == null)
                {
                    figuresForFunctionalArea = new FiguresForFunctionalArea(team.FunctionalArea);
                    funtionalAreas.Add(figuresForFunctionalArea);
                }

                figuresForFunctionalArea.Add(team);
            }


            foreach (WorkBoxDetails workBox in AllWorkBoxes)
            {
                if (!workBox.LoadedOK || !workBox.hasBeenOpened || String.IsNullOrEmpty(workBox.FunctionalArea))
                {
                    continue;
                }

                FiguresForFunctionalArea figuresForFunctionalArea = funtionalAreas[workBox.FunctionalArea];
                if (figuresForFunctionalArea == null)
                {
                    figuresForFunctionalArea = new FiguresForFunctionalArea(workBox.FunctionalArea);
                    funtionalAreas.Add(figuresForFunctionalArea);
                }

                figuresForFunctionalArea.Add(workBox);
            }

            foreach (RecordsDetails record in AllRecords)
            {
                if (!record.LoadedOK || String.IsNullOrEmpty(record.FunctionalArea))
                {
                    continue;
                }

                FiguresForFunctionalArea figuresForFunctionalArea = funtionalAreas[record.FunctionalArea];
                if (figuresForFunctionalArea == null)
                {
                    figuresForFunctionalArea = new FiguresForFunctionalArea(record.FunctionalArea);
                    funtionalAreas.Add(figuresForFunctionalArea);
                }

                figuresForFunctionalArea.Add(record);
            }


            funtionalAreas.SaveToSheet();
        }
Example #2
0
        /*
         * 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();
        }
Example #3
0
        private void calculateTeamFigures(Excel.Workbook processed)
        {
            foreach (WorkBoxDetails workBox in AllWorkBoxes)
            {
                if (!workBox.LoadedOK || String.IsNullOrEmpty(workBox.OwningTeam))
                {
                    continue;
                }

                TeamDetails figuresForTeam = AllTeams[workBox.OwningTeam];
                if (figuresForTeam == null)
                {
                    figuresForTeam = new TeamDetails(workBox.OwningTeam);
                    AllTeams.Add(figuresForTeam);
                }

                figuresForTeam.Add(workBox);
            }
            AllTeams.SaveToSheet();
        }
Example #4
0
        private void calculateWBCFigures(Excel.Workbook processed)
        {
            // Now we're going to work out the figures for each WBC
            DataSheet <FiguresForWBC> wbcFigures = new DataSheet <FiguresForWBC>(processed, "WBC Figures", true);

            foreach (WorkBoxDetails workBox in AllWorkBoxes)
            {
                if (!workBox.LoadedOK)
                {
                    continue;
                }

                FiguresForWBC figuresForWBC = wbcFigures[workBox.WorkBoxCollectionURL];
                if (figuresForWBC == null)
                {
                    figuresForWBC = new FiguresForWBC(workBox.WorkBoxCollectionURL);
                    wbcFigures.Add(figuresForWBC);
                }

                figuresForWBC.Add(workBox);
            }
            wbcFigures.SaveToSheet();
        }
Example #5
0
        private int calculateMonthlyFigures(String workSheetTitle, Excel.Workbook processed, bool excludeFOI, bool excludeIAS)
        {
            // Now we're going to work out the monthly figures:
            DataSheet <FiguresForOneMonth> monthlyFigures = new DataSheet <FiguresForOneMonth>(processed, workSheetTitle, true);
            DateTime monthWalker   = new DateTime(2012, 01, 01);
            DateTime continueUntil = new DateTime(2020, 01, 01);

            // First add all of the months up until today + two years.
            while (monthWalker <= continueUntil)
            {
                monthlyFigures.Add(new FiguresForOneMonth(monthWalker));
                monthWalker = monthWalker.AddMonths(1);
            }


            int failures = 0;

            // Now add all of the work boxes to each of the relevant months:
            foreach (WorkBoxDetails workBox in AllWorkBoxes)
            {
                if (!workBox.LoadedOK)
                {
                    failures++;
                    continue;
                }

                try
                {
                    if (workBox.hasBeenCreated)
                    {
                        if (excludeFOI)
                        {
                            if (workBox.WorkBoxCollectionURL.Equals("http://collection.izzi/foi"))
                            {
                                continue;
                            }
                        }
                        if (excludeIAS)
                        {
                            if (workBox.WorkBoxCollectionURL.Equals("http://hass.izzi/ias"))
                            {
                                continue;
                            }
                        }

                        monthWalker = (new DateTime(workBox.DateCreated.Year, workBox.DateCreated.Month, 1)).AddMonths(-1);

                        while (monthWalker <= continueUntil)
                        {
                            FiguresForOneMonth month = monthlyFigures[monthWalker.Date.Month + " " + monthWalker.Date.Year];

                            if (month != null)
                            {
                                month.Add(workBox);
                            }

                            monthWalker = monthWalker.AddMonths(1);
                        }
                    }
                }
                catch (Exception exception)
                {
                    failures++;
                }
            }


            foreach (TeamDetails team in AllTeams)
            {
                if (team.hasBeenCreated)
                {
                    monthWalker = (new DateTime(team.DateCreated.Year, team.DateCreated.Month, 1)).AddMonths(-1);

                    while (monthWalker < DateTime.Now)
                    {
                        FiguresForOneMonth month = monthlyFigures[monthWalker.Date.Month + " " + monthWalker.Date.Year];

                        if (month != null)
                        {
                            month.Add(team);
                        }

                        monthWalker = monthWalker.AddMonths(1);
                    }
                }
            }


            foreach (UserDetails user in AllUsers)
            {
                if (user.VisitedAnyWB)
                {
                    monthWalker = (new DateTime(user.OldestVisitDate.Year, user.OldestVisitDate.Month, 1)).AddMonths(-1);

                    while (monthWalker < DateTime.Now)
                    {
                        FiguresForOneMonth month = monthlyFigures[monthWalker.Date.Month + " " + monthWalker.Date.Year];

                        if (month != null)
                        {
                            month.Add(user);
                        }

                        monthWalker = monthWalker.AddMonths(1);
                    }
                }
            }

            foreach (RecordsDetails record in AllRecords)
            {
                if (record.hasBeenCreated)
                {
                    monthWalker = (new DateTime(record.DateCreated.Year, record.DateCreated.Month, 1)).AddMonths(-1);

                    while (monthWalker < DateTime.Now)
                    {
                        FiguresForOneMonth month = monthlyFigures[monthWalker.Date.Month + " " + monthWalker.Date.Year];

                        if (month != null)
                        {
                            month.Add(record);
                        }

                        monthWalker = monthWalker.AddMonths(1);
                    }
                }
            }

            monthlyFigures.SaveToSheet();

            return(failures);
        }