Example #1
0
        public static void GenerateSpecification(string filename, ControllerModel c, SpecificatorDataModel model)
        {
            using (var doc = WordprocessingDocument.Open(filename, true))
            {
                // Add a main document part.
                Body body = doc.MainDocumentPart.Document.Body;
                body.RemoveAllChildren <Paragraph>();

                //var gensWithElems = CCOLGenerator.GetAllGeneratorsWithElements(c);

                // Headers, title page, versioning
                FunctionalityGenerator.AddHeaderTextsToDocument(doc, model, c.Data);
                body.Append(FunctionalityGenerator.GetFirstPage(c.Data));
                body.Append(FunctionalityGenerator.GetVersionControl(c.Data));


                // Chap 1: Introduction
                FunctionalityGenerator.GetIntroChapter(doc, c, model);

                // Chap 2: Structuur en afwikkeling
                body.Append(OpenXmlHelper.GetChapterTitleParagraph($"{Texts["Title_StructuurEnAfwikkeling"]}", 1));
                body.Append(FunctionalityGenerator.GetChapter_StructureIntroduction(c));
                body.Append(FunctionalityGenerator.GetChapter_Perioden(c));
                body.Append(FunctionalityGenerator.GetChapter_SignaalGroepAfhandeling(doc, c));
                body.Append(FunctionalityGenerator.GetChapter_SignaalGroepInstellingen(doc, c));
                body.Append(FunctionalityGenerator.GetChapter_Groentijden(c));
                body.Append(FunctionalityGenerator.GetChapter_Modulestructuur(doc, c));

                // Chap 3: Detectoren
                body.Append(OpenXmlHelper.GetChapterTitleParagraph($"{Texts["Title_Detectoren"]}", 1));
                body.Append(FunctionalityGenerator.GetChapter_DetectieConfiguratie(doc, c));
                body.Append(FunctionalityGenerator.GetChapter_DetectieInstellingen(doc, c));
                body.Append(FunctionalityGenerator.GetChapter_DetectieRichtingGevoelig(c));
                body.Append(FunctionalityGenerator.GetChapter_DetectieStoring(doc, c));

                // Chap 4: Intersignaalgroep
                body.Append(OpenXmlHelper.GetChapterTitleParagraph($"{Texts["Title_Intersignaalgroep"]}", 1));
                body.Append(FunctionalityGenerator.GetChapter_Ontruimingstijden(c));
                body.Append(FunctionalityGenerator.GetChapter_OntruimingstijdenGarantie(c));
                body.Append(FunctionalityGenerator.GetChapter_Synchronisaties(c, doc));

                if (c.OVData.OVIngreepType != Models.Enumerations.OVIngreepTypeEnum.Geen && c.HasPTorHD())
                {
                    if (c.HasPT() && c.HasHD())
                    {
                        body.Append(OpenXmlHelper.GetChapterTitleParagraph($"{Texts["Title_OVHD"]}", 1));
                        body.Append(FunctionalityGenerator.GetChapter_OVHDIntro(c));
                    }
                    if (c.HasPT())
                    {
                        body.Append(OpenXmlHelper.GetChapterTitleParagraph($"{Texts["Title_OV"]}", c.HasHD() ? 2 : 1));
                        body.Append(FunctionalityGenerator.GetChapter_OV(c, doc, c.HasHD() ? 2 : 1));
                    }
                    if (c.HasHD())
                    {
                        body.Append(OpenXmlHelper.GetChapterTitleParagraph($"{Texts["Title_HD"]}", c.HasPT() ? 2 : 1));
                        body.Append(FunctionalityGenerator.GetChapter_HD(c, doc, c.HasHD() ? 2 : 1));
                    }
                }

                if (c.HalfstarData.IsHalfstar)
                {
                    body.Append(OpenXmlHelper.GetChapterTitleParagraph($"{Texts["Title_Halfstar"]}", 1));
                    body.Append((OpenXmlHelper.GetTextParagraph($"TODO: Hoofdstuk inzake halfstar regelen.", "TODO")));
                }

                if (model.SpecialsParagrafen.Any())
                {
                    body.Append(OpenXmlHelper.GetChapterTitleParagraph($"{Texts["Title_Specials"]}", 1));
                    foreach (var par in model.SpecialsParagrafen)
                    {
                        body.Append(OpenXmlHelper.GetChapterTitleParagraph(par.Titel, 2));
                        foreach (var parpar in par.Text.Split('\n'))
                        {
                            if (!string.IsNullOrWhiteSpace(parpar))
                            {
                                body.Append(OpenXmlHelper.GetTextParagraph(parpar));
                            }
                        }
                    }
                }

                body.Append(OpenXmlHelper.GetChapterTitleParagraph($"TODO", 1));
                body.Append((OpenXmlHelper.GetTextParagraph($"TODO: Hoofdstuk OV: details toevoegen, zoals: " +
                                                            $"lijnnummers, details rond in/uitmelden, inmelden koplus, .", "TODO")));
                body.Append((OpenXmlHelper.GetTextParagraph($"TODO: Overige punten, zoals: PTP, VA ontruimen, file ingrepen, rateltikkers, " +
                                                            $"ingangen, selectieve detectie, uitgestelde vaste aanvragen, hard meeverlengen, veiligheidsgroen, RoBuGrover, special van plugins zoals AFM, etc.", "TODO")));
                body.Append((OpenXmlHelper.GetTextParagraph($"TODO: Opnemen verwijzingen naar CCOL benaming van instellingen (?).", "TODO")));

                // TODO: signaalplannen

                // dan: afhandeling signaalgroepen (nalopen, gelijkstarten, etc)
                // tabel functies hiernaartoe verplaatsen (?)

                // dan: OV, HD

                // dan: overig: fixatie -> onderbrengen in H1 (intro) bij algemene instellingen

                //body.Append(FunctionalityGenerator.GetModulenChapter(doc, c));

                doc.Close();
                //foreach (var g in gensWithElems)
                //{
                //    if (g.Item2.Any())
                //    {
                //        AddChapterTitle(doc, $"{g.Item1.GetType().Name.ToString()}", 2);
                //        AddSettingsTable(doc, g.Item2);
                //    }
                //}
            }
        }