コード例 #1
0
        public void CreateStatusReport(Models.Register register, bool latestSavedDataReport = false)
        {
            if (latestSavedDataReport)
            {
                var mareanoRegistryId = Guid.Parse(GlobalVariables.MareanoRegistryId);
                var currentReport     = _dbContext.StatusReports.Where(s => s.Register.systemId == mareanoRegistryId && s.LatestSavedDataReport).FirstOrDefault();
                if (currentReport != null)
                {
                    _dbContext.Database.ExecuteSqlCommand("DELETE FROM RegisterItemStatusReports Where StatusReport_Id ='" + currentReport.Id + "'; DELETE FROM StatusReports WHERE Id = '" + currentReport.Id + "'");
                }
            }

            var statusReport = new StatusReport(latestSavedDataReport);

            statusReport.Register = register;
            foreach (var item in register.items)
            {
                if (item is Dataset dataset)
                {
                    var datasetStatuses = new DatasetStatusHistory(dataset);
                    statusReport.StatusRegisterItems.Add(datasetStatuses);
                }
            }

            foreach (var item in register.RegisterItems)
            {
                if (item is InspireDataset inspireDataset)
                {
                    var inspireDatasetStatuses = new InspireDatasetStatusReport(inspireDataset);
                    statusReport.StatusRegisterItems.Add(inspireDatasetStatuses);
                }
                if (item is InspireDataService inspireDataService)
                {
                    var inspireDataserviceStatuses = new InspireDataserviceStatusReport(inspireDataService);
                    statusReport.StatusRegisterItems.Add(inspireDataserviceStatuses);
                }

                if (item is GeodatalovDataset geodatalovDataset)
                {
                    var geodatalovDatasetStatuses = new GeodatalovDatasetStatusReport(geodatalovDataset);
                    statusReport.StatusRegisterItems.Add(geodatalovDatasetStatuses);
                }

                if (item is MareanoDataset mareanoDataset)
                {
                    var mareanoDatasetStatuses = new MareanoDatasetStatusReport(mareanoDataset);
                    statusReport.StatusRegisterItems.Add(mareanoDatasetStatuses);
                }
            }

            _dbContext.StatusReports.Add(statusReport);
            _dbContext.SaveChanges();
        }
コード例 #2
0
        public void CreateStatusReport(Models.Register register)
        {
            var statusReport = new StatusReport();

            statusReport.Register = register;
            foreach (var item in register.items)
            {
                if (item is Dataset dataset)
                {
                    var datasetStatuses = new DatasetStatusHistory(dataset);
                    statusReport.StatusRegisterItems.Add(datasetStatuses);
                }
            }

            foreach (var item in register.RegisterItems)
            {
                if (item is InspireDataset inspireDataset)
                {
                    var inspireDatasetStatuses = new InspireDatasetStatusReport(inspireDataset);
                    statusReport.StatusRegisterItems.Add(inspireDatasetStatuses);
                }
                if (item is InspireDataService inspireDataService)
                {
                    var inspireDataserviceStatuses = new InspireDataserviceStatusReport(inspireDataService);
                    statusReport.StatusRegisterItems.Add(inspireDataserviceStatuses);
                }

                if (item is GeodatalovDataset geodatalovDataset)
                {
                    var geodatalovDatasetStatuses = new GeodatalovDatasetStatusReport(geodatalovDataset);
                    statusReport.StatusRegisterItems.Add(geodatalovDatasetStatuses);
                }
            }

            _dbContext.StatusReports.Add(statusReport);
            _dbContext.SaveChanges();
        }