public static byte[] CreateTDGProvisionWorkbook()
        {
            SetupBasicLogging();

            //don't need act rn
            var actFraXml  = LegApiClient.GetActFromJustice("fra");
            var tdgFraActs = XML.XMLFunctions.ParseRegs(actFraXml, "Body", "441564");

            var actXml = LegApiClient.GetActFromJustice();
            var regXml = LegApiClient.GetRegulationFromJustice();

            //XML to "Regulation" class
            //act       = XMLFunctions.ParseRegs(actXml, "Body", "452135");
            tdgr      = XMLFunctions.ParseRegs(regXml, "Body", "1227365");
            schedule1 = XMLFunctions.ParseRegs(regXml, "Schedule", "1230876");
            schedule2 = XMLFunctions.ParseRegs(regXml, "Schedule", "1230890");
            schedule3 = XMLFunctions.ParseRegs(regXml, "Schedule", "1231645");

            //flag data we're interested in
            //TODO: can be added in the parsing to avoid an extra sweep
            act.PopulateDataFlags();
            tdgr.PopulateDataFlags();
            schedule1.PopulateDataFlags();
            schedule2.PopulateDataFlags();
            schedule3.PopulateDataFlags();

            //output List of Regulations to JSON
            XMLFunctions.SerializeRegulationsToFile(act, actFileName);
            XMLFunctions.SerializeRegulationsToFile(tdgr, regFileName);
            XMLFunctions.SerializeRegulationsToFile(schedule1, schedule1FileName);
            XMLFunctions.SerializeRegulationsToFile(schedule2, schedule2FileName);
            XMLFunctions.SerializeRegulationsToFile(schedule3, schedule3FileName);

            return(CreateExcelWorkbook());
        }
Exemplo n.º 2
0
        private static void ProcessTDGRegulations()
        {
            //ETLLogic.DeleteLegislation();


            //DIGITAL OVERSIGHT LEG AND REG API => // var regXml = LegApiClient.GetRegulation("672172E");


            //DOWNLOAD XML DIRECTLY FROM JUSTICE
            //using below because faster
            var regXml = LegApiClient.GetRegulationFromJustice();

            var tdgRegs = XML.XMLFunctions.ParseRegs(regXml, "Body", "1227365");

            tdgRegs.PopulateDataFlags();
            //var dtSchedule2 = XML.XMLFunctions.ParseRegs(regXml, "Schedule", "1230890");

            ETLLogic.ETLLegislationData(tdgRegs);

            //ETLLogic.ETLLegislationData(dtSchedule2);

            //string legislationFetchXml = GetLegislationFetchXml();
            ETLLogic.FetchLegislationData();



            //ETLLogic.DeleteLegislation();

            // ACT FROM LEGS AND REGS
            //var act = LegApiClient.GetActSerialized("T-19.01", "eng");
            //var max = act.Regs.Select((n, i) => (Reg: n.RegReg, Index: i)).Max();
            //var actDetails = LegApiClient.GetRegulation("452135");
            //var tdgAct = XML.XMLFunctions.ParseRegs(actDetails, "Body", "452135");
            //ETLLogic.ETLLegislationData(tdgAct);

            // TDG REGULATIONS
            //var regXml = LegApiClient.GetRegulationFromJustice();
            //var tdgRegs = XML.XMLFunctions.ParseRegs(regXml, "Body", "1227365");
            //ETLLogic.ETLLegislationData(tdgRegs);

            var actXml  = LegApiClient.GetActFromJustice("fra");
            var tdgActs = XML.XMLFunctions.ParseRegs(actXml, "Body", "441564");

            ETLLogic.ETLLegislationData(tdgActs);

            //schedule
            //var dtSchedule2 = XML.XMLFunctions.ParseRegs(regXml, "Schedule", "1230890");
            //ETLLogic.ETLLegislationData(dtSchedule2);

            //string legislationFetchXml = GetLegislationFetchXml();
            //ETLLogic.FetchLegislationData(legislationFetchXml);
        }