public static void Main(string[] args) { var dbContext = new ODM2Entities(); var relationActionTypeRepository = new Repository<CV_RelationshipType>(dbContext); var wqDataRepository = new WQDataRepository(dbContext); var staticWQDefaultValueProvider = new StaticWQDefaultValueProvider(); staticWQDefaultValueProvider.Init(); Console.WriteLine("Start Quality Checking Process..."); var qcChainConfiguration = ConfigureQualityCheckingChain(true, wqDataRepository, "Test", false, "Water"); var versioningHelper = new DataVersioningHelper(staticWQDefaultValueProvider); var factory = new DataQualityCheckingToolFactory(versioningHelper, relationActionTypeRepository); var qualiltyChecker = new WaterQualityDataQualityChecker(qcChainConfiguration, factory, wqDataRepository); var qcResults = qualiltyChecker.Check(); foreach(var result in qcResults) { Console.WriteLine(string.Format("{0}: {1}", result.Level, result.Message)); } Console.WriteLine("Press any keys to continue..."); Console.ReadLine(); }
public static ProcessingLevel GetOdm2ProcessingLevel(Hatfield.EnviroData.DataProfile.WQ.Models.ProcessingLevel level, ODM2Entities dbContext) { var foundLevel = dbContext.ProcessingLevels.FirstOrDefault(x => x.ProcessingLevelCode == level.ToString()); if(foundLevel == null) { throw new KeyNotFoundException(string.Format("System can not find matched processing level for {0}", level)); } return foundLevel; }
//Commment this out so auto-build would not run this unit test //[Test] public void DBTest() { var dbContext = new ODM2Entities(); var duplicateChecker = new ODM2DuplicateChecker(dbContext); var esdatModel = extractEsdatModel(); var WQDefaultValueProvider = new StaticWQDefaultValueProvider(); var wayToHandleNewData = WayToHandleNewData.CreateInstanceForNewData; var results = new List<IResult>(); var sampleCollectionFactory = new ESDATSampleCollectionMapperFactory(duplicateChecker, WQDefaultValueProvider, wayToHandleNewData, results); var chemistryFactory = new ESDATChemistryMapperFactory(duplicateChecker, WQDefaultValueProvider, wayToHandleNewData, results); var mapper = new SampleCollectionActionMapper(duplicateChecker, sampleCollectionFactory, WQDefaultValueProvider, chemistryFactory, wayToHandleNewData, results); var converter = new ESDATConverter(mapper); var action = converter.Map(esdatModel); dbContext.Add(action); dbContext.SaveChanges(); }
//Commment this out so auto-build would not run this unit test //[Test] public void DBTest() { var dbContext = new ODM2Entities(); var duplicateChecker = new ODM2DuplicateChecker(dbContext); var esdatModel = extractEsdatModel(); var WQDefaultValueProvider = new StaticWQDefaultValueProvider(); var wayToHandleNewData = WayToHandleNewData.CreateInstanceForNewData; var results = new List <IResult>(); var sampleCollectionFactory = new ESDATSampleCollectionMapperFactory(duplicateChecker, WQDefaultValueProvider, wayToHandleNewData, results); var chemistryFactory = new ESDATChemistryMapperFactory(duplicateChecker, WQDefaultValueProvider, wayToHandleNewData, results); var mapper = new SampleCollectionActionMapper(duplicateChecker, sampleCollectionFactory, WQDefaultValueProvider, chemistryFactory, wayToHandleNewData, results); var converter = new ESDATConverter(mapper); var action = converter.Map(esdatModel); dbContext.Add(action); dbContext.SaveChanges(); }
public void Init() { _dbContext = new ODM2Entities(); _wqDataProfile = new WaterQualityDataProfile(_dbContext); siteList = new List<Hatfield.EnviroData.DataProfile.WQ.Models.Site> { new Hatfield.EnviroData.DataProfile.WQ.Models.Site { Id = 1, Name = "C1", Latitude = 49.2827, Longitude = 123.1207 }, new Hatfield.EnviroData.DataProfile.WQ.Models.Site { Id = 2, Name = "C2", Latitude = 49.2827, Longitude = 123.1207 }, new Hatfield.EnviroData.DataProfile.WQ.Models.Site { Id = 3, Name = null, Latitude = 49.2827, Longitude = 111.1111 }, new Hatfield.EnviroData.DataProfile.WQ.Models.Site { Id = 4, Name = "S01", Latitude = 49.2827, Longitude = 123.1207 } }; }
public void Init() { _dbContext = new ODM2Entities(); _wqDataProfile = new WaterQualityDataProfile(_dbContext); siteList = new List <Hatfield.EnviroData.DataProfile.WQ.Models.Site> { new Hatfield.EnviroData.DataProfile.WQ.Models.Site { Id = 1, Name = "C1", Latitude = 49.2827, Longitude = 123.1207 }, new Hatfield.EnviroData.DataProfile.WQ.Models.Site { Id = 2, Name = "C2", Latitude = 49.2827, Longitude = 123.1207 }, new Hatfield.EnviroData.DataProfile.WQ.Models.Site { Id = 3, Name = null, Latitude = 49.2827, Longitude = 111.1111 }, new Hatfield.EnviroData.DataProfile.WQ.Models.Site { Id = 4, Name = "S01", Latitude = 49.2827, Longitude = 123.1207 } }; }
public static ProcessingLevel GetOdm2ProcessingLevel(Hatfield.EnviroData.DataProfile.WQ.Models.ProcessingLevel level, ODM2Entities dbContext) { var foundLevel = dbContext.ProcessingLevels.FirstOrDefault(x => x.ProcessingLevelCode == level.ToString()); if (foundLevel == null) { throw new KeyNotFoundException(string.Format("System can not find matched processing level for {0}", level)); } return(foundLevel); }