public void CreateTestAction(IWQDefaultValueProvider wqDefaultValueProvider)
        {

            grandActionData = new Hatfield.EnviroData.Core.Action();
            grandActionData.ActionID = 3;

            childActionData = new Hatfield.EnviroData.Core.Action();
            childActionData.RelatedActions = new List<RelatedAction>();
            childActionData.ActionID = 2;
                        
            rootActionData = new Hatfield.EnviroData.Core.Action();
            rootActionData.RelatedActions = new List<RelatedAction>();
            rootActionData.ActionID = 1;

            var grandChildRelation = new RelatedAction();
            grandChildRelation.CV_RelationshipType = new CV_RelationshipType { 
                Name = wqDefaultValueProvider.ActionRelationshipTypeSubVersion
            };
            grandChildRelation.Action1 = grandActionData;
            childActionData.RelatedActions.Add(grandChildRelation);

            var childRelation = new RelatedAction();
            childRelation.CV_RelationshipType = new CV_RelationshipType
            {
                Name = wqDefaultValueProvider.ActionRelationshipTypeSubVersion
            };
            childRelation.Action1 = childActionData;
            rootActionData.RelatedActions.Add(childRelation);            
        }
        public static void Link(Core.Action action, RelatedAction relatedAction)
        {
            action.RelatedActions.Add(relatedAction);

            relatedAction.Action   = action;
            relatedAction.ActionID = action.ActionID;
        }
Exemplo n.º 3
0
        public void CreateTestAction(IWQDefaultValueProvider wqDefaultValueProvider)
        {
            grandActionData          = new Hatfield.EnviroData.Core.Action();
            grandActionData.ActionID = 3;

            childActionData = new Hatfield.EnviroData.Core.Action();
            childActionData.RelatedActions = new List <RelatedAction>();
            childActionData.ActionID       = 2;

            rootActionData = new Hatfield.EnviroData.Core.Action();
            rootActionData.RelatedActions = new List <RelatedAction>();
            rootActionData.ActionID       = 1;

            var grandChildRelation = new RelatedAction();

            grandChildRelation.CV_RelationshipType = new CV_RelationshipType {
                Name = wqDefaultValueProvider.ActionRelationshipTypeSubVersion
            };
            grandChildRelation.Action1 = grandActionData;
            childActionData.RelatedActions.Add(grandChildRelation);

            var childRelation = new RelatedAction();

            childRelation.CV_RelationshipType = new CV_RelationshipType
            {
                Name = wqDefaultValueProvider.ActionRelationshipTypeSubVersion
            };
            childRelation.Action1 = childActionData;
            rootActionData.RelatedActions.Add(childRelation);
        }
        public static void Link(Core.Action action, RelatedAction relatedAction)
        {
            action.RelatedActions.Add(relatedAction);

            relatedAction.Action = action;
            relatedAction.ActionID = action.ActionID;
        }
Exemplo n.º 5
0
        public Core.Action Map(ESDATModel esdatModel, ChemistryFileData chemistry)
        {
            var entity = Draft(esdatModel, chemistry);

            // Feature Actions
            var featureAction = _chemistryFactory.FeatureActionMapper.Map(esdatModel, chemistry);

            ODM2EntityLinker.Link(entity, featureAction);

            // Sampling Feature
            var samplingFeature = _chemistryFactory.SamplingFeatureMapper.Map(esdatModel, chemistry);

            ODM2EntityLinker.Link(featureAction, samplingFeature);

            // Result
            // Each Feature Action contains 1 Result (Chemistry)
            {
                var result = _chemistryFactory.ResultMapper.Map(esdatModel, chemistry);
                ODM2EntityLinker.Link(featureAction, result);

                // Unit
                var unit = _chemistryFactory.UnitMapper.Map(esdatModel, chemistry);
                ODM2EntityLinker.Link(result, unit);

                // Variable
                var variable = _chemistryFactory.VariableMapper.Map(esdatModel, chemistry);
                ODM2EntityLinker.Link(result, variable);

                // Datasets Result
                {
                    var datasetsResult = _chemistryFactory.DatasetsResultMapper.Map(esdatModel);
                    ODM2EntityLinker.Link(result, datasetsResult);

                    var dataset = _chemistryFactory.DatasetMapper.Map(esdatModel);
                    ODM2EntityLinker.Link(datasetsResult, dataset);
                }

                // Processing Level
                var processingLevel = _chemistryFactory.ProcessingLevelMapper.Map(esdatModel);
                ODM2EntityLinker.Link(result, processingLevel);

                // Measurement Result
                {
                    var measurementResult = _chemistryFactory.MeasurementResultMapper.Map(esdatModel, chemistry);
                    ODM2EntityLinker.Link(result, measurementResult);

                    ODM2EntityLinker.Link(measurementResult, unit);

                    var measurementResultValue = _chemistryFactory.MeasurementResultValueMapper.Map(esdatModel, chemistry);
                    ODM2EntityLinker.Link(measurementResult, measurementResultValue);
                }

                // Result Extension Property Values
                {
                    var properties = new Dictionary <string, string>();

                    properties[ESDATChemistryConstants.ResultExtensionPropertyValueKeySampleCode]      = chemistry.SampleCode;
                    properties[ESDATChemistryConstants.ResultExtensionPropertyValueKeyPrefix]          = chemistry.Prefix;
                    properties[ESDATChemistryConstants.ResultExtensionPropertyValueKeyTotalOrFiltered] = chemistry.TotalOrFiltered;
                    properties[ESDATChemistryConstants.ResultExtensionPropertyValueKeyResultType]      = chemistry.ResultType;
                    properties[ESDATChemistryConstants.ResultExtensionPropertyValueKeyEQL]             = chemistry.EQL.ToString();
                    properties[ESDATChemistryConstants.ResultExtensionPropertyValueKeyEQLUnits]        = chemistry.EQLUnits;
                    properties[ESDATChemistryConstants.ResultExtensionPropertyValueKeyComments]        = chemistry.Comments;
                    properties[ESDATChemistryConstants.ResultExtensionPropertyValueKeyUCL]             = chemistry.UCL.ToString();
                    properties[ESDATChemistryConstants.ResultExtensionPropertyValueKeyLCL]             = chemistry.LCL.ToString();

                    foreach (var property in properties)
                    {
                        var extensionProperty = _chemistryFactory.ExtensionPropertyMapper.Map(property.Key);

                        var propertyID    = extensionProperty.PropertyID;
                        var propertyValue = property.Value;
                        var resultExtensionPropertyValue = _chemistryFactory.ResultExtensionPropertyValueMapper.Map(propertyID, propertyValue);

                        ODM2EntityLinker.Link(result, resultExtensionPropertyValue);
                    }
                }
            }

            // Action Bies
            {
                ActionBy actionBy = _chemistryFactory.ActionByMapper.Map(esdatModel);
                ODM2EntityLinker.Link(entity, actionBy);

                var person = _chemistryFactory.PersonMapper.Map(esdatModel);
                _chemistryFactory.AffiliationMapper.Person = person;

                var affiliation = _chemistryFactory.AffiliationMapper.Map(esdatModel);

                ODM2EntityLinker.Link(actionBy, affiliation);
            }

            // Method
            {
                var method = _chemistryFactory.MethodMapper.Map(esdatModel, chemistry);
                ODM2EntityLinker.Link(entity, method);

                _chemistryFactory.OrganizationMapper.SampleFileData = SampleFileData;
                var organization = _chemistryFactory.OrganizationMapper.Map(esdatModel, chemistry);
                ODM2EntityLinker.Link(method, organization);
            }

            // Related Actions
            _chemistryFactory.RelatedActionMapper.SetRelationship(entity, _WQDefaultValueProvider.ActionRelationshipTypeCVChemistry, ParentAction);
            RelatedAction relatedAction = _chemistryFactory.RelatedActionMapper.Map(esdatModel);

            ODM2EntityLinker.Link(entity, relatedAction);

            return(entity);
        }
        private IQualityCheckingResult GenerateCorrectChemistryDataNewVersion(Core.Action action, ChemistryValueCheckingRuleItem ruleItem)
        {
            var newVersionOfData = CorrectChemistryData(action, ruleItem);

            var newRelationAction = new RelatedAction();

            newRelationAction.Action = action;
            newRelationAction.Action1 = newVersionOfData;
            newRelationAction.RelationshipTypeCV = QualityAssuranceConstants.SubVersionRelationCVType;
            newRelationAction.CV_RelationshipType = _relationShipTypeCVRepository.GetAll()
                .Where(x => x.Name == QualityAssuranceConstants.SubVersionRelationCVType).FirstOrDefault();

            action.RelatedActions.Add(newRelationAction);

            return new QualityCheckingResult("Create new version for correction data.", false, QualityCheckingResultLevel.Info);
        }
        private IQualityCheckingResult GenerateCorrectSampleMatrixTypeDataNewVersion(Hatfield.EnviroData.Core.Action sampleActionData,
                                                                                     StringCompareCheckingRule rule)
        {
            var newVersionOfData = CorrectSampleMatrixTypeData(sampleActionData, rule);


            var relationActionOfNewVersion = new RelatedAction();
            relationActionOfNewVersion.Action = sampleActionData;
            relationActionOfNewVersion.Action1 = newVersionOfData;
            relationActionOfNewVersion.RelationshipTypeCV = QualityAssuranceConstants.SubVersionRelationCVType;
            var relationShipCV = _relationShipTypeCVRepository.GetAll()
                                    .Where(x => x.Name == QualityAssuranceConstants.SubVersionRelationCVType)
                                    .FirstOrDefault();
            relationActionOfNewVersion.CV_RelationshipType = relationShipCV;

            sampleActionData.RelatedActions.Add(relationActionOfNewVersion);

            return new QualityCheckingResult("Create new version for correction data.", false, QualityCheckingResultLevel.Info);
        }