Ejemplo n.º 1
0
        public string GetCovidSingleSummary(string summaryName)
        {
            var xpath = summaryName switch
            {
                "SamplesTested" => NodeUrlHelper.SampleTestedNode,
                "ConfirmedCases" => NodeUrlHelper.ConfirmedCasesNode,
                "ActiveCases" => NodeUrlHelper.ActiveCasesNode,
                "DischargedCases" => NodeUrlHelper.DischargedCasesNode,
                "Deaths" => NodeUrlHelper.DeathsNode,
                _ => ""
            };
            var page = GetNcdcHtmlData();


            var summaryResult =
                page.OwnerDocument.DocumentNode.SelectSingleNode(xpath).InnerText;

            return(NodeUrlHelper.GetJustNumbers(summaryResult));
        }
Ejemplo n.º 2
0
        public DataSummary GetCovidSummaryByNode()
        {
            var page = GetNcdcHtmlData();


            var samplesTested   = NodeUrlHelper.GetJustNumbers(page.OwnerDocument.DocumentNode.SelectSingleNode(NodeUrlHelper.SampleTestedNode).InnerText);
            var confirmedCases  = NodeUrlHelper.GetJustNumbers(page.OwnerDocument.DocumentNode.SelectSingleNode(NodeUrlHelper.ConfirmedCasesNode).InnerText);
            var activeCases     = NodeUrlHelper.GetJustNumbers(page.OwnerDocument.DocumentNode.SelectSingleNode(NodeUrlHelper.ActiveCasesNode).InnerText);
            var dischargedCases = NodeUrlHelper.GetJustNumbers(page.OwnerDocument.DocumentNode.SelectSingleNode(NodeUrlHelper.DischargedCasesNode).InnerText);
            var deaths          = NodeUrlHelper.GetJustNumbers(page.OwnerDocument.DocumentNode.SelectSingleNode(NodeUrlHelper.DeathsNode).InnerText);


            var model = new DataSummary
            {
                ActiveCases     = activeCases,
                ConfirmedCases  = confirmedCases,
                DischargedCases = dischargedCases,
                Deaths          = deaths,
                SamplesTested   = samplesTested
            };

            return(model);
        }