Esempio n. 1
0
 public ActionResult Index(IndicatorInput input)
 {   
     if (!ModelState.IsValid)
     {
         return View(builder.RebuildInput(input));
     }
     fieldsetService.CreateIndicator(builder.BuildEntity(input));
     return View(builder.BuildInput(new Indicator {FieldsetId = input.FieldsetId}));
 }
Esempio n. 2
0
 public ActionResult Index(IndicatorInput input)
 {
     if (!ModelState.IsValid)
     {
         return(View(builder.RebuildInput(input)));
     }
     fieldsetService.CreateIndicator(builder.BuildEntity(input));
     return(View(builder.BuildInput(new Indicator {
         FieldsetId = input.FieldsetId
     })));
 }
Esempio n. 3
0
        public string AddChiTieuBaoCao()
        {
            var success   = 0;
            var fail1     = 0;
            var fail2     = 0;
            var dataYears = new List <int> {
                2018, 2019, 2020, 2021
            };
            var months = new List <int> {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
            };
            var periodIds = new List <int> {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
            };

            var officeCodes = new List <string> {
                "000-00-00-H40",
                "000-00-24-H40", "000-00-12-H40", "000-00-19-H40", "000-00-20-H40", "000-00-21-H40", "000-00-22-H40", "000-00-23-H40", "000-00-25-H40", "000-00-26-H40", "000-00-27-H40", "000-00-28-H40", "000-00-02-H40", "000-00-03-H40", "000-00-04-H40", "000-00-05-H40", "000-00-06-H40", "000-00-07-H40", "000-00-08-H40", "000-00-09-H40", "000-00-10-H40", "000-00-11-H40", "000-00-13-H40", "000-00-14-H40", "000-00-15-H40", "000-00-16-H40", "000-00-17-H40", "000-00-18-H40"
            };
            var indicatorCodes = new List <string> {
                "DH02010101",
                "DH02010102",
                "DH02010103",
                "DH02010104",
                "DH02010105",
                "DH02010201",
                "DH02010202",
                "DH02010203",
                "DH02010204",
                "DH02010301",
                "DH02010302",
                "DH02010303",
                "DH02010304",
                "DH02010305",
                "DH02010306",
                "DH02010401",
                "DH02010402",
                "DH02010501",
                "DH02010502",
                "DH020201",
                "DH020202",
                "DH020203"
            };

            foreach (var datayear in dataYears)
            {
                Console.WriteLine($"Year: {datayear}");
                for (var j = 0; j < months.Count; j++)
                {
                    var month    = months[j];
                    var periodId = periodIds[j];
                    Console.WriteLine($"Month: {month}");
                    foreach (var officeCode in officeCodes)
                    {
                        Console.WriteLine($"OfficeCode: {officeCode}");
                        foreach (var indicatorCode in indicatorCodes)
                        {
                            Console.WriteLine($"IndicatorCode: {indicatorCode}");
                            var indicatorInput = new IndicatorInput
                            {
                                IndicatorCode = indicatorCode,
                                Month         = month,
                                OfficeCode    = officeCode,
                                Year          = datayear
                            };

                            string filterResult = _httpService.Post(_urlFilter, null, indicatorInput);

                            if (string.IsNullOrEmpty(filterResult))
                            {
                                fail1++;
                                Console.WriteLine($"{indicatorCode} Fail1");
                                continue;
                            }

                            var indicatorOutput = JsonConvert.DeserializeObject <IndicatorOutput>(filterResult);
                            int value           = indicatorOutput.Value;

                            var oUDataItem = new OUDataItem
                            {
                                dataTypeId    = 3, // Thực hiện
                                dataYear      = datayear,
                                indicatorCode = indicatorCode,
                                officeCode    = officeCode,
                                periodId      = periodId,
                                value         = value,
                                textValue     = value.ToString()
                            };

                            string addResult = _httpService.Post("https://baocao.namdinh.gov.vn/_vti_bin/td.bc.dw/dwservice.svc/CapNhatChiTieuDonVi", null, oUDataItem);
                            if (string.IsNullOrEmpty(addResult))
                            {
                                fail2++;
                                Console.WriteLine(fail2);
                                continue;
                            }
                            success++;
                            Console.WriteLine("Success");
                        }
                    }
                }
            }
            return($"success: {success}, fail1: {fail1}, fail2: {fail2}");
        }
Esempio n. 4
0
        public void AddChiTieuBaoCao()
        {
            var dataYears = new List <int> {
                2019, 2020
            };
            var months = new List <int> {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
            };
            var periodIds = new List <int> {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
            };

            var officeCodes = new List <string> {
                "000-00-19-H40", "000-00-20-H40", "000-00-21-H40", "000-00-22-H40", "000-00-23-H40", "000-00-25-H40", "000-00-26-H40", "000-00-27-H40", "000-00-28-H40", "000-00-02-H40", "000-00-03-H40", "000-00-04-H40", "000-00-05-H40", "000-00-06-H40", "000-00-07-H40", "000-00-08-H40", "000-00-09-H40", "000-00-10-H40", "000-00-11-H40", "000-00-13-H40", "000-00-14-H40", "000-00-15-H40", "000-00-16-H40", "000-00-17-H40", "000-00-18-H40"
            };
            var indicatorCodes = new List <string> {
                "DH04010101",
                "DH04010102",
                "DH04010201",
                "DH04010202",
                "DH04010203",
                "DH04010204",
                "DH04010205",
                "DH04010206",
                "DH04010301",
                "DH04010302",
                "DH04010303",
                "DH04010304",
                "DH040201",
                "DH040202",
                "DH040203",
                "DH040204",
                "DH040301",
                "DH040302",
                "DH040303"
            };

            foreach (var datayear in dataYears)
            {
                for (var j = 0; j < months.Count; j++)
                {
                    var month    = months[j];
                    var periodId = periodIds[j];
                    foreach (var officeCode in officeCodes)
                    {
                        foreach (var indicatorCode in indicatorCodes)
                        {
                            var indicatorInput = new IndicatorInput
                            {
                                IndicatorCode = indicatorCode,
                                Month         = month,
                                OfficeCode    = officeCode,
                                Year          = datayear
                            };

                            string filterResult = _httpService.Post(_urlFilter, null, indicatorInput);

                            if (string.IsNullOrEmpty(filterResult))
                            {
                                continue;
                            }

                            var indicatorOutput = JsonConvert.DeserializeObject <IndicatorOutput>(filterResult);
                            int value           = indicatorOutput.Value;

                            var oUDataItem = new OUDataItem
                            {
                                dataTypeId    = 3, // Thực hiện
                                dataYear      = datayear,
                                indicatorCode = indicatorCode,
                                officeCode    = officeCode,
                                periodId      = periodId,
                                value         = value,
                                textValue     = value.ToString()
                            };

                            _httpService.Post(_urlUpdate, null, oUDataItem);
                        }
                    }
                }
            }
        }
Esempio n. 5
0
        public IActionResult AddChiTieu(string officeCode = null, int?month = 1, int?dataYear = 2020)
        {
            int result = 0;

            var indicatorCodes = new List <string> {
                "DH02010101",
                "DH02010102",
                "DH02010103",
                "DH02010104",
                "DH02010105",
                "DH02010201",
                "DH02010202",
                "DH02010203",
                "DH02010204",
                "DH02010301",
                "DH02010302",
                "DH02010303",
                "DH02010304",
                "DH02010305",
                "DH02010306",
                "DH02010401",
                "DH02010402",
                "DH02010501",
                "DH02010502",
                "DH020201",
                "DH020202",
                "DH020203"
            };

            var periodId = month;

            foreach (var indicatorCode in indicatorCodes)
            {
                var indicatorInput = new IndicatorInput
                {
                    IndicatorCode = indicatorCode,
                    Month         = month.Value,
                    OfficeCode    = officeCode,
                    Year          = dataYear.Value
                };

                string filterResult = _httpService.Post("https://baocao.namdinh.gov.vn/_vti_bin/td.bcdh/bcdhservice.svc/DVC/Loc", null, indicatorInput);

                if (string.IsNullOrEmpty(filterResult))
                {
                    continue;
                }

                var indicatorOutput = JsonConvert.DeserializeObject <IndicatorOutput>(filterResult);
                int value           = indicatorOutput.Value;

                if (value == 0)
                {
                    continue;
                }

                result++;

                var oUDataItem = new OUDataItem
                {
                    dataTypeId    = 3, // Thực hiện
                    dataYear      = dataYear.Value,
                    indicatorCode = indicatorCode,
                    officeCode    = officeCode,
                    periodId      = periodId.Value,
                    value         = value,
                    textValue     = value.ToString()
                };

                _httpService.Post("https://baocao.namdinh.gov.vn/_vti_bin/td.bc.dw/dwservice.svc/CapNhatChiTieuDonVi", null, oUDataItem);
            }

            return(Ok(result));
        }
Esempio n. 6
0
        public void AddChiTieuBaoCao()
        {
            var dataYears = new List <int> {
                2019, 2020
            };
            var months = new List <int> {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
            };
            var periodIds = new List <int> {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
            };

            var officeCodes = new List <string> {
                "000-00-12-H40"
            };
            var indicatorCodes = new List <string> {
                "DH070201",
                "DH070202",
                "DH070401",
                "DH070402",
                "DH070403",
                "DH070404",
                "DH070405",
                "DH070406",
                "DH070407"
            };

            foreach (var datayear in dataYears)
            {
                for (var j = 0; j < months.Count; j++)
                {
                    var month    = months[j];
                    var periodId = periodIds[j];
                    foreach (var officeCode in officeCodes)
                    {
                        foreach (var indicatorCode in indicatorCodes)
                        {
                            var indicatorInput = new IndicatorInput
                            {
                                IndicatorCode = indicatorCode,
                                Month         = month,
                                OfficeCode    = officeCode,
                                Year          = datayear
                            };

                            string filterResult = _httpService.Post(_urlFilter, null, indicatorInput);

                            if (string.IsNullOrEmpty(filterResult))
                            {
                                continue;
                            }

                            var indicatorOutput = JsonConvert.DeserializeObject <IndicatorOutput>(filterResult);
                            var value           = indicatorOutput.Value;

                            var oUDataItem = new OUDataItem
                            {
                                dataTypeId    = 3, // Thực hiện
                                dataYear      = datayear,
                                indicatorCode = indicatorCode,
                                officeCode    = officeCode,
                                periodId      = periodId,
                                value         = value,
                                textValue     = value.ToString()
                            };

                            _httpService.Post("https://baocao.namdinh.gov.vn/_vti_bin/td.bc.dw/dwservice.svc/CapNhatChiTieuDonVi", null, oUDataItem);
                        }
                    }
                }
            }
        }
Esempio n. 7
0
        public IActionResult AddChiTieu(string officeCode = null)
        {
            int result    = 0;
            var dataYears = new List <int> {
                2020
            };
            var months = new List <int> {
                9, 10, 11
            };
            var periodIds = new List <int> {
                9, 10, 11
            };

            var indicatorCodes = new List <string> {
                "DH03010101",
                "DH03010102",
                "DH03010103",
                "DH03010104",
                "DH03010201",
                "DH03010202",
                "DH03010203",
                "DH03010204",
                "DH03010205",
                "DH03010206",
                "DH03010207",
                "DH03010208",
                "DH03010209",
                "DH03010210",
                "DH03010301",
                "DH03010302",
                "DH03010401",
                "DH03010402",
                "DH03010403",
                "DH030301",
                "DH030302",
                "DH030303"
            };

            foreach (var datayear in dataYears)
            {
                for (var j = 0; j < months.Count; j++)
                {
                    var month    = months[j];
                    var periodId = periodIds[j];
                    foreach (var indicatorCode in indicatorCodes)
                    {
                        var indicatorInput = new IndicatorInput
                        {
                            IndicatorCode = indicatorCode,
                            Month         = month,
                            OfficeCode    = officeCode,
                            Year          = datayear
                        };

                        string filterResult = _httpService.Post("https://baocao.namdinh.gov.vn/_vti_bin/td.bcdh/bcdhservice.svc/PAKN/Loc", null, indicatorInput);

                        if (string.IsNullOrEmpty(filterResult))
                        {
                            continue;
                        }

                        var indicatorOutput = JsonConvert.DeserializeObject <IndicatorOutput>(filterResult);
                        var value           = indicatorOutput.Value;
                        if (value > 0)
                        {
                            result++;
                        }

                        var oUDataItem = new OUDataItem
                        {
                            dataTypeId    = 3, // Thực hiện
                            dataYear      = datayear,
                            indicatorCode = indicatorCode,
                            officeCode    = officeCode,
                            periodId      = periodId,
                            value         = value,
                            textValue     = value.ToString()
                        };

                        _httpService.Post("https://baocao.namdinh.gov.vn/_vti_bin/td.bc.dw/dwservice.svc/CapNhatChiTieuDonVi", null, oUDataItem);
                    }
                }
            }
            return(Ok(result));
        }
Esempio n. 8
0
        public void AddChiTieuBaoCao()
        {
            var dataYears = new List <int> {
                2020
            };
            var months = new List <int> {
                10, 11
            };
            var periodIds = new List <int> {
                10, 11
            };

            var officeCodes = new List <string> {
                // "000-00-00-H40",
                "000-00-19-H40", "000-00-20-H40", "000-00-21-H40", "000-00-22-H40", "000-00-23-H40", "000-00-25-H40", "000-00-26-H40", "000-00-27-H40", "000-00-28-H40", "000-00-02-H40", "000-00-03-H40", "000-00-04-H40", "000-00-05-H40", "000-00-06-H40", "000-00-07-H40", "000-00-08-H40", "000-00-09-H40", "000-00-10-H40", "000-00-11-H40", "000-00-13-H40", "000-00-14-H40", "000-00-15-H40", "000-00-16-H40", "000-00-17-H40", "000-00-18-H40", "000-30-24-H40", "000-24-24-H40", "000-34-24-H40"
            };
            var indicatorCodes = new List <string> {
                "DH03010101",
                "DH03010102",
                "DH03010103",
                "DH03010104",
                "DH03010201",
                "DH03010202",
                "DH03010203",
                "DH03010204",
                "DH03010205",
                "DH0301030101",
                "DH0301030102",
                "DH0301030201",
                "DH0301030202",
                "DH0301030203",
                "DH03010401",
                "DH03010402",
                "DH03010403",
                "DH030301",
                "DH030302",
                "DH030303"
            };

            foreach (var datayear in dataYears)
            {
                for (var j = 0; j < months.Count; j++)
                {
                    var month    = months[j];
                    var periodId = periodIds[j];
                    foreach (var officeCode in officeCodes)
                    {
                        foreach (var indicatorCode in indicatorCodes)
                        {
                            var indicatorInput = new IndicatorInput
                            {
                                IndicatorCode = indicatorCode,
                                Month         = month,
                                OfficeCode    = officeCode,
                                Year          = datayear
                            };

                            string filterResult = _httpService.Post(_urlFilter, null, indicatorInput);

                            if (string.IsNullOrEmpty(filterResult))
                            {
                                continue;
                            }

                            var indicatorOutput = JsonConvert.DeserializeObject <IndicatorOutput>(filterResult);
                            var value           = indicatorOutput.Value;

                            var oUDataItem = new OUDataItem
                            {
                                dataTypeId    = 3, // Thực hiện
                                dataYear      = datayear,
                                indicatorCode = indicatorCode,
                                officeCode    = officeCode,
                                periodId      = periodId,
                                value         = value,
                                textValue     = value.ToString()
                            };

                            _httpService.Post("https://baocao.namdinh.gov.vn/_vti_bin/td.bc.dw/dwservice.svc/CapNhatChiTieuDonVi", null, oUDataItem);
                        }
                    }
                }
            }
        }