Exemplo n.º 1
0
        public void UpdateItem()
        {
            using (TransactionScope scope = new TransactionScope())
            {
                if (MappingController.DeleteAllMappings())
                {
                    if (MappingController.DeleteAllMappingSystems())
                    {
                        if (MappingController.DeleteAllMappingPropertyAssociations())
                        {
                            if (MappingController.DeleteAllMappingClassAssociations())
                            {
                                Mapping item = PopulateMappingItem();
                                item.SourceValue = "Original";
                                item.Id          = MappingController.SaveMapping(item);
                                item             = GetItem(item.Id);
                                //change a value
                                item.SourceValue = "Updated";

                                MappingController.SaveMapping(item);
                                item = GetItem(item.Id);
                                Assert.IsTrue(item.SourceValue == "Updated");
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets the up destination value drop down control.
        /// </summary>
        /// <param name="dropDownListDestinationProperty">The drop down list destination property.</param>
        private void SetUpDestinationValueDropDownControl(DropDownList dropDownListDestinationProperty)
        {
            int mappingPropertyAssociationId = Convert.ToInt32(dropDownListDestinationProperty.SelectedValue);

            Dictionary <string, string> lookupItems =
                MappingController.GetMappingLookup(mappingPropertyAssociationId);

            DropDownList dropDownDestinationValue = GetControl <DropDownList>("DropDownListDestinationValue", PageFormView);
            TextBox      textBoxDestinationValue  = GetControl <TextBox>("TextBoxDestinationValue", PageFormView);

            dropDownDestinationValue.Visible = (lookupItems.Count > 0);
            textBoxDestinationValue.Visible  = (lookupItems.Count == 0);
            //if (dropDownDestinationValue.Visible)
            //{
            //       validation.AddValidation("DropDownListDestinationValue", "DestinationValue");
            //}

            if (dropDownDestinationValue.Visible)
            {
                dropDownDestinationValue.Items.Clear();
                if (lookupItems.Count != 1)
                {
                    dropDownDestinationValue.Items.Add(new ListItem(null, null));
                }
                //dropDownDestinationValue.DataSource = lookupItems;
                //dropDownDestinationValue.DataBind();
                foreach (KeyValuePair <string, string> kvp in lookupItems)
                {
                    dropDownDestinationValue.Items.Add(new ListItem(kvp.Value, kvp.Key));
                }
            }
        }
Exemplo n.º 3
0
        public void ConcurrencyTest()
        {
            using (TransactionScope scope = new TransactionScope())
            {
                MappingController.DeleteAllMappings();
                MappingController.DeleteAllMappingSystems();
                MappingController.DeleteAllMappingPropertyAssociations();
                MappingController.DeleteAllMappingClassAssociations();

                try
                {
                    Mapping item = PopulateMappingItem();
                    item.Id = MappingController.SaveMapping(item);
                    //change a value
                    item.MappingPropertyAssociation.DestinationProperty = "Updated";

                    MappingController.SaveMapping(item);
                }
                catch (DiscoveryException e)
                {
                    Assert.IsInstanceOfType(typeof(ConcurrencyException), e.InnerException);
                    throw e;
                }
            }
        }
Exemplo n.º 4
0
        public void GetMappingLookup()
        {
            using (TransactionScope scope = new TransactionScope())
            {
                if (MappingController.DeleteAllMappings())
                {
                    if (MappingController.DeleteAllMappingSystems())
                    {
                        if (MappingController.DeleteAllMappingPropertyAssociations())
                        {
                            if (MappingController.DeleteAllMappingClassAssociations())
                            {
                                Mapping mapping = PopulateMappingItem();
                                if (MappingController.SaveMapping(mapping) != -1)
                                {
                                    //we have set the lookup table to be route so we should add a route and then when we get the lookup list
                                    //back it should include the RouteCode we save in the routing table

                                    Route route = RouteTests.PopulateNewItem();
                                    if (RouteTests.SaveItem(route) != -1)
                                    {
                                        //get a list of route codes from the route table
                                        Dictionary <string, string> lookupList = MappingController.GetMappingLookup(mapping.MappingPropertyAssociationId);
                                        //so the count should be >0
                                        Assert.IsTrue(lookupList.Count > 0);
                                        //check for our new id
                                        Assert.IsTrue(lookupList.ContainsValue(route.Description));
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
        public void GetAllSourceMappingSystems()
        {
            using (TransactionScope scope = new TransactionScope())
            {
                if (MappingController.DeleteAllMappings())
                {
                    if (MappingController.DeleteAllMappingSystems())
                    {
                        MappingSystem mappingSystem = PopulateNewSourceMappingSystem();
                        mappingSystem.Id = MappingController.SaveMappingSystem(mappingSystem);
                        if (mappingSystem.Id != -1)
                        {
                            //retrieve all mapping Systems and the one we saved should return at least
                            List <MappingSystem> mappingSystems = MappingController.GetMappingSourceSystems();

                            //so the count should be >0
                            Assert.IsTrue(mappingSystems.Count > 0);
                            //check for our new id
                            Assert.IsTrue(mappingSystems.Find(delegate(MappingSystem currentItem)
                            {
                                return(currentItem.Id == mappingSystem.Id);
                            }) != null);
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Populates the destination type drop down control.
        /// </summary>
        private void PopulateDestinationTypeDropDownControl()
        {
            DropDownList dropDownListSourceType      = GetDropDownListSourceTypeControl();
            DropDownList dropdownListDestinationType = GetDropDownListDestinationTypeControl();

            List <MappingClassAssociation> dataSource =
                MappingController.GetMappingClassAssociationsBySourceType(dropDownListSourceType.SelectedValue);

            dropdownListDestinationType.Items.Clear();

            if (dataSource.Count != 1)
            {
                dropdownListDestinationType.Items.Add(new ListItem(null, null));
            }
            foreach (MappingClassAssociation association in dataSource)
            {
                dropdownListDestinationType.Items.Add(new ListItem(association.DestinationType, association.Id.ToString()));
            }
            //dropdownListDestinationType.DataSource = dataSource;
            //dropdownListDestinationType.DataBind();
            if (dropdownListDestinationType.SelectedValue != null && dropdownListDestinationType.SelectedValue != "")
            {
                PopulateSourcePropertyDropDownControl(dropdownListDestinationType);
                PopulateDestinationPropertyDropDownControl(GetDropDownListDestinationPropertyControl());
            }
        }
Exemplo n.º 7
0
        internal bool DeleteItem(int Id)
        {
            Mapping mapping = new Mapping();

            mapping.Id = Id;
            return(MappingController.DeleteMapping(mapping));
        }
Exemplo n.º 8
0
 public void GetItems()
 {
     using (TransactionScope scope = new TransactionScope())
     {
         if (MappingController.DeleteAllMappings())
         {
             if (MappingController.DeleteAllMappingSystems())
             {
                 if (MappingController.DeleteAllMappingPropertyAssociations())
                 {
                     if (MappingController.DeleteAllMappingClassAssociations())
                     {
                         Mapping mapping = PopulateMappingItem();
                         mapping.Id = MappingController.SaveMapping(mapping);
                         if (mapping.Id != -1)
                         {
                             List <Mapping> mappings = MappingController.GetMappings();
                             //so the count should be >0
                             Assert.IsTrue(mappings.Count > 0);
                             //check for our new id
                             Assert.IsTrue(mappings.Find(delegate(Mapping currentItem)
                             {
                                 return(currentItem.Id == mapping.Id);
                             }) != null);
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 9
0
        public void Map(bool createDataBase, string stopRevision)
        {
            MappingController mapping = GetConfiguredType <MappingController>();

            mapping.CreateDataBase = createDataBase;
            mapping.StopRevision   = stopRevision;

            Map(mapping);
        }
Exemplo n.º 10
0
 public void DeleteAllMappingSystems()
 {
     using (TransactionScope scope = new TransactionScope())
     {
         if (MappingController.DeleteAllMappings())
         {
             Assert.IsTrue(MappingController.DeleteAllMappingSystems());
         }
     }
 }
Exemplo n.º 11
0
        public void GetAllSubClasses()
        {
            List <Type> types = MappingController.GetAllMapableTypes();

            Assert.Greater(types.Count, 0);
            Console.WriteLine(types.Count.ToString() + " Types were returned");
            foreach (Type type in types)
            {
                Console.WriteLine(type);
            }
        }
Exemplo n.º 12
0
        public void GetClassesPropertiesReadable()
        {
            List <Type> types = MappingController.GetAllMapableTypes();

            if (types.Count > 0)
            {
                List <PropertyInfo> properties = MappingController.GetClassesPropertiesReadable(types[0].FullName);
                Assert.Greater(properties.Count, 0);
                Console.WriteLine(properties.Count.ToString() + " Properties were returned");
            }
        }
        public void Setup()
        {
            target            = new Mock <IUnityContainer>();
            mappingFactory    = new Mock <ITypeMappingFactory>();
            internalContainer = new Mock <IUnityContainer>();
            mappingHandler    = new Mock <ITypeMappingHandler>();

            internalContainer.Setup(c => c.Resolve(typeof(ITypeMappingHandler), null, It.IsAny <ResolverOverride[]>())).Returns(mappingHandler.Object);
            controller = new MappingController(target.Object, mappingFactory.Object, internalContainer.Object);
            TestableUnityConfigProvider.Reset();
        }
Exemplo n.º 14
0
        /// <summary>
        /// Migrate all prefabs
        /// </summary>
        /// <param name="destinationProjectPath"></param>
        /// <param name="originalProjectPath"></param>
        /// <param name="onComplete"></param>
        public void MigrateAllPrefabs(string destinationProjectPath, string originalProjectPath = null,
                                      Action onComplete = null, List <ScriptMapping> scriptMappings = null)
        {
            if (originalProjectPath == null)
            {
                ThreadUtility.RunWaitMainTask(() =>
                {
                    originalProjectPath =
                        EditorUtility.OpenFolderPanel("Export all prefabs in folder", destinationProjectPath, "");
                }
                                              );
            }

            if (string.IsNullOrEmpty(originalProjectPath))
            {
                Debug.Log("Copy prefabs aborted, no path given.");
                return;
            }

            //Deserialize the ScriptMappings
            if (scriptMappings == null && File.Exists(destinationProjectPath + constants.RelativeScriptMappingPath))
            {
                scriptMappings =
                    MappingController.DeserializeMapping(destinationProjectPath + constants.RelativeScriptMappingPath);
            }

            List <PrefabModel> prefabs = prefabController.ExportPrefabs(originalProjectPath + "/Assets");

            for (var i = 0; i < prefabs.Count; i++)
            {
                PrefabModel prefab = prefabs[i];
                MigrationWindow.DisplayProgressBar("Migrating prefab (" + (i + 1) + "/" + prefabs.Count + ")",
                                                   info: "Migrating prefab: " + prefab.Path.Substring(originalProjectPath.Length),
                                                   progress: (float)(i + 1) / prefabs.Count);
                ThreadUtility.RunWaitTask(() =>
                {
                    MigratePrefab(prefab.Path, originalProjectPath, destinationProjectPath, prefabs,
                                  prefab.Guid, scriptMappings);
                }
                                          );
                GC.Collect();
            }

            MigrationWindow.ClearProgressBar();

            ThreadUtility.RunMainTask(() => { AssetDatabase.Refresh(); });
            Debug.Log("Migrated all prefabs");

            if (onComplete != null)
            {
                onComplete.Invoke();
            }
        }
Exemplo n.º 15
0
        private void DoLines(PersistableBusinessObject sourceObject, PersistableBusinessObject destinationObject,
                             string sourceSystem, string destinationSystem)
        {
            List <ShipmentLine> lines = ((TDCShipment)destinationObject).ShipmentLines;

            for (int i = 0; i < lines.Count; i++)
            {
                TDCShipmentLine newline = new TDCShipmentLine();
                MappingController.Map(lines[i], newline, sourceSystem, destinationSystem, null);
                lines[i] = newline;
            }
        }
Exemplo n.º 16
0
        private void Map(MappingController mapping)
        {
            using (ConsoleTimeLogger.Start("mapping time"))
            {
                mapping.OnRevisionMapping += (r, n) => Console.WriteLine(
                    "mapping of revision {0}{1}",
                    r,
                    r != n ? string.Format(" ({0})", n) : ""
                    );

                mapping.Map(data);
            }
        }
Exemplo n.º 17
0
 public void SaveDestinationMappingSystemConstraint()
 {
     using (TransactionScope scope = new TransactionScope())
     {
         MappingController.DeleteAllMappings();
         MappingController.DeleteAllMappingSystems();
         MappingSystem system = PopulateNewDestinationMappingSystem();
         if (MappingController.SaveMappingSystem(system) != -1)
         {
             MappingController.SaveMappingSystem(system);
         }
     }
 }
Exemplo n.º 18
0
 public void SaveDestinationMappingSystem()
 {
     using (TransactionScope scope = new TransactionScope())
     {
         if (MappingController.DeleteAllMappings())
         {
             if (MappingController.DeleteAllMappingSystems())
             {
                 Assert.IsTrue(MappingController.SaveMappingSystem(PopulateNewDestinationMappingSystem()) != -1);
             }
         }
     }
 }
        public void MappingControllerGetUsesMappingProvider()
        {
            var         mock  = new Mock <IMappingProvider>();
            MappingData value = new MappingData();

            mock.Setup(x => x.GetCurrentMapping()).Returns(value);

            var controller = new MappingController(mock.Object);

            var result     = controller.Get();
            var resultData = result.As <JsonResult>();

            resultData.StatusCode.Should().Equals(200);
            resultData.Value.Should().Equals(value);
        }
Exemplo n.º 20
0
        public void DeleteAllMappings()
        {
            using (TransactionScope scope = new TransactionScope())
            {
                MappingController.DeleteAllMappings();
                MappingController.DeleteAllMappingSystems();
                MappingController.DeleteAllMappingPropertyAssociations();
                MappingController.DeleteAllMappingClassAssociations();

                Mapping mapping = PopulateMappingItem();
                int     id      = MappingController.SaveMapping(mapping);
                Assert.IsTrue(id != -1);
                Assert.IsTrue(MappingController.DeleteAllMappings());
            }
        }
Exemplo n.º 21
0
        public void SaveMappingTestConstraint()
        {
            using (TransactionScope scope = new TransactionScope())
            {
                MappingController.DeleteAllMappings();
                MappingController.DeleteAllMappingSystems();
                MappingController.DeleteAllMappingPropertyAssociations();
                MappingController.DeleteAllMappingClassAssociations();
                Mapping mapping = PopulateMappingItem();

                MappingController.SaveMapping(mapping);

                MappingController.SaveMapping(mapping);
            }
        }
Exemplo n.º 22
0
        public void SaveDestinationMappingClassAssociationConstraint()
        {
            using (TransactionScope scope = new TransactionScope())
            {
                MappingController.DeleteAllMappings();
                MappingController.DeleteAllMappingSystems();
                MappingController.DeleteAllMappingPropertyAssociations();
                MappingController.DeleteAllMappingClassAssociations();

                MappingClassAssociation classAssociation = PopulateNewMappingClassAssocation();

                MappingController.SaveMappingClassAssociation(classAssociation);
                MappingController.SaveMappingClassAssociation(classAssociation);
            }
        }
Exemplo n.º 23
0
        private MappingPropertyAssociation PopulateNewMappingPropertyAssocation()
        {
            MappingPropertyAssociation propertyAssociation = new MappingPropertyAssociation();

            //setup the class association which defines the source and destination types the source and destination properties will belong to
            propertyAssociation.MappingClassAssociation    = PopulateNewMappingClassAssocation();
            propertyAssociation.MappingClassAssociation.Id = MappingController.SaveMappingClassAssociation(propertyAssociation.MappingClassAssociation);
            propertyAssociation.MappingClassAssociationId  = propertyAssociation.MappingClassAssociation.Id;

            propertyAssociation.DestinationProperty      = "RouteCode";
            propertyAssociation.SourceProperty           = "RouteCode";
            propertyAssociation.LookupTableName          = "Discovery_Route";
            propertyAssociation.LookUpTableDisplayColumn = "Description";

            return(propertyAssociation);
        }
Exemplo n.º 24
0
 public void SaveMappingPropertyAssociation()
 {
     using (TransactionScope scope = new TransactionScope())
     {
         if (MappingController.DeleteAllMappings())
         {
             if (MappingController.DeleteAllMappingSystems())
             {
                 if (MappingController.DeleteAllMappingPropertyAssociations())
                 {
                     if (MappingController.DeleteAllMappingClassAssociations())
                     {
                         Assert.IsTrue(MappingController.SaveMappingPropertyAssociation(PopulateNewMappingPropertyAssocation()) != -1);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 25
0
        public void PartialMap(string startRevision, IPathSelector[] pathSelectors)
        {
            MappingController mapping = GetConfiguredType <MappingController>();

            mapping.StartRevision = startRevision;
            mapping.RegisterMapper(GetConfiguredType <CommitMapperForExistentRevision>());
            var fileMapper = GetConfiguredType <ProjectFileMapper>();

            fileMapper.PathSelectors = pathSelectors;
            mapping.RegisterMapper(fileMapper);
            mapping.KeepOnlyMappers(new Type[]
            {
                typeof(Commit),
                typeof(ProjectFile),
                typeof(Modification),
                typeof(CodeBlock)
            });

            Map(mapping);
        }
Exemplo n.º 26
0
        public void GetItem()
        {
            using (TransactionScope scope = new TransactionScope())
            {
                if (MappingController.DeleteAllMappings())
                {
                    if (MappingController.DeleteAllMappingSystems())
                    {
                        if (MappingController.DeleteAllMappingPropertyAssociations())
                        {
                            if (MappingController.DeleteAllMappingClassAssociations())
                            {
                                int id = MappingController.SaveMapping(PopulateMappingItem());

                                Assert.IsNotNull(GetItem(id));
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// Populates the source property drop down control.
        /// </summary>
        /// <param name="dropDownListDestinationType">Type of the drop down list destination.</param>
        private void PopulateSourcePropertyDropDownControl(DropDownList dropDownListDestinationType)
        {
            List <MappingPropertyAssociation> dataSource = new List <MappingPropertyAssociation>();

            try
            {
                int mappingClassAssociationId = Convert.ToInt32(dropDownListDestinationType.SelectedValue);
                dataSource =
                    MappingController.GetMappingPropertyAssociationsByClassAssociationId(mappingClassAssociationId);
            }
            catch (Exception ex)
            {
                if (ExceptionPolicy.HandleException(ex, "User Interface"))
                {
                    DisplayMessage("Failed to retrieve data");
                }
            }

            DropDownList dropDownListSourceProperty = GetDropDownListSourcePropertyControl();


            dropDownListSourceProperty.Items.Clear();
            if (dataSource.Count != 1)
            {
                dropDownListSourceProperty.Items.Add(new ListItem(null, null));
            }
            foreach (MappingPropertyAssociation association in dataSource)
            {
                if (dropDownListSourceProperty.Items.FindByText(association.SourceProperty) == null)
                {
                    dropDownListSourceProperty.Items.Add(new ListItem(association.SourceProperty, association.SourceProperty));
                }
            }
            //dropDownListSourceProperty.DataSource = dataSource;
            //dropDownListSourceProperty.DataBind();
            if (dropDownListSourceProperty.SelectedValue != null && dropDownListSourceProperty.SelectedValue != "")
            {
                PopulateDestinationPropertyDropDownControl(GetDropDownListDestinationPropertyControl());
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// Populates the destination property drop down control.
        /// </summary>
        /// <param name="dropDownListDestinationProperty">The drop down list destination property.</param>
        private void PopulateDestinationPropertyDropDownControl(DropDownList dropDownListDestinationProperty)
        {
            string sourceProperty = GetDropDownListSourcePropertyControl().SelectedValue.ToString();
            List <MappingPropertyAssociation> dataSource = null;

            try
            {
                dataSource = MappingController.GetMappingPropertyAssociations(sourceProperty, Convert.ToInt32(GetDropDownListDestinationTypeControl().SelectedValue));
            }
            catch (Exception ex)
            {
                if (ExceptionPolicy.HandleException(ex, "User Interface"))
                {
                    DisplayMessage("Failed to retrieve data");
                }
            }

            dropDownListDestinationProperty.Items.Clear();
            if (dataSource.Count != 1)
            {
                dropDownListDestinationProperty.Items.Add(new ListItem(null, null));
            }
            foreach (MappingPropertyAssociation association in dataSource)
            {
                //if the item does not already exist then add it
                if (dropDownListDestinationProperty.Items.FindByText(association.DestinationProperty) == null)
                {
                    dropDownListDestinationProperty.Items.Add(new ListItem(association.DestinationProperty, association.Id.ToString()));
                }
            }
            //dropDownListDestinationProperty.DataSource = dataSource;
            //dropDownListDestinationProperty.DataBind();
            if (dropDownListDestinationProperty.SelectedValue != null &&
                dropDownListDestinationProperty.SelectedValue != "")
            {
                SetUpDestinationValueDropDownControl(dropDownListDestinationProperty);
            }
        }
Exemplo n.º 29
0
        internal Mapping PopulateMappingItem()
        {
            Mapping mapping = new Mapping();

            //Add two mapping systems
            mapping.DestinationSystem    = PopulateNewDestinationMappingSystem();
            mapping.DestinationSystem.Id = MappingController.SaveMappingSystem(mapping.DestinationSystem);
            mapping.DestinationSystemId  = mapping.DestinationSystem.Id;


            mapping.SourceSystem    = PopulateNewSourceMappingSystem();
            mapping.SourceSystem.Id = MappingController.SaveMappingSystem(mapping.SourceSystem);
            mapping.SourceSystemId  = mapping.SourceSystem.Id;

            //add a mapping property association, which describes when properties can be mapped on the above type
            mapping.MappingPropertyAssociation    = PopulateNewMappingPropertyAssocation();
            mapping.MappingPropertyAssociation.Id = MappingController.SaveMappingPropertyAssociation(mapping.MappingPropertyAssociation);
            mapping.MappingPropertyAssociationId  = mapping.MappingPropertyAssociation.Id;

            mapping.DestinationValue = "Test";
            mapping.SourceValue      = "test";
            mapping.UpdatedBy        = "test";
            return(mapping);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Add the pk data to the SAS input, already subset by the UI options
        /// </summary>
        /// <param name="data"></param>
        private void addPharmacokineticsToDataset(DataSet data, StudySettings study)
        {
            var pharmacokinetics = new DataTable("pharmacokinetics");

            pharmacokinetics.Columns.Add("Selected", typeof(string));
            pharmacokinetics.Columns.Add("Result", typeof(double));
            pharmacokinetics.Columns.Add("Parameter", typeof(string));
            pharmacokinetics.Columns.Add("Treatment", typeof(string));
            pharmacokinetics.Columns.Add("Specimen", typeof(string));
            pharmacokinetics.Columns.Add("Analyte", typeof(string));
            pharmacokinetics.Columns.Add("Period", typeof(string));
            pharmacokinetics.Columns.Add("Arm", typeof(string));
            pharmacokinetics.Columns.Add("Cohort", typeof(string));
            pharmacokinetics.Columns.Add("Subject", typeof(string));

            // Load individual concentration from xml file
            var fullStudy = new MappingController().LoadStudy(study.NDAName, study.ProfileName,
                                                              study.SupplementNumber, study.StudyCode, null, true);

            // Find the subset of selected pk
            string period   = this.Settings.SelectedPeriod;
            string specimen = this.Settings.SelectedPpSpecimen;

            if (period == "noPeriod")
            {
                period = null;
            }
            if (specimen == "noSpecimen")
            {
                specimen = null;
            }
            var selectedSections = fullStudy.Pharmacokinetics.Sections.Where(s =>
                                                                             s.Cohort == this.Settings.SelectedCohort &&
                                                                             s.Analyte == this.Settings.SelectedPpAnalyte &&
                                                                             s.Period == period && s.Specimen == specimen);

            // Create a dictionary of pk parameter mappings
            var pkParameterMappings = new Dictionary <string, List <string> >();

            addParameterSelectionToTable(pkParameterMappings, this.Settings.SelectedAuct, "AUCT");
            addParameterSelectionToTable(pkParameterMappings, this.Settings.SelectedAucInfinity, "AUCI");
            addParameterSelectionToTable(pkParameterMappings, this.Settings.SelectedCmax, "CMAX");
            addParameterSelectionToTable(pkParameterMappings, this.Settings.SelectedThalf, "THALF");
            addParameterSelectionToTable(pkParameterMappings, this.Settings.SelectedTmax, "TMAX");

            // Add the pk data to the table
            foreach (PkDataSection section in selectedSections)
            {
                foreach (PkDataSubSection subsection in section.SubSections)
                {
                    foreach (IndividualPk individual in subsection.Individual)
                    {
                        // Add each value to the dataset
                        foreach (var pkValue in individual.PkValues)
                        {
                            // Add one row for each selection of the pk parameter or one row with empty selection
                            List <string> selections;
                            if (!pkParameterMappings.TryGetValue(pkValue.Parameter, out selections))
                            {
                                selections = new List <string> {
                                    ""
                                }
                            }
                            ;
                            string suffix = ""; int i = 1;
                            foreach (var selection in selections)
                            {
                                pharmacokinetics.Rows.Add(
                                    selection,
                                    pkValue.Value.HasValue ? (object)pkValue.Value.Value : DBNull.Value,
                                    pkValue.Parameter + suffix,
                                    section.TreatmentOrGroup,
                                    section.Specimen ?? "",
                                    section.Analyte,
                                    subsection.Period ?? section.Period ?? "",
                                    subsection.Arm ?? "",
                                    section.Cohort,
                                    individual.Subject);

                                suffix = "__" + i++;
                            }
                        }
                    }
                }
            }

            data.Tables.Add(pharmacokinetics);
        }
Exemplo n.º 31
0
        private void Map(MappingController mapping)
        {
            using (ConsoleTimeLogger.Start("mapping time"))
            {
                mapping.OnRevisionMapping += (r, n) => Console.WriteLine(
                    "mapping of revision {0}{1}",
                    r,
                    r != n ? string.Format(" ({0})", n) : ""
                );

                mapping.Map(data);
            }
        }