Exemplo n.º 1
0
        public void MappingIfContainsKey(string inputEntityLogicalName, Dictionary <string, List <Item <EntityReference, EntityReference> > > inputMapping, Dictionary <string, Dictionary <Guid, Guid> > inputMapper, Form parentForm)
        {
            using (var mappingDialog = new MappingList(inputMapping[inputEntityLogicalName])
            {
                StartPosition = FormStartPosition.CenterParent
            })
            {
                if (parentForm != null)
                {
                    mappingDialog.ShowDialog(parentForm);
                }

                var mapList     = mappingDialog.GetMappingList(inputEntityLogicalName);
                var guidMapList = mappingDialog.GetGuidMappingList();

                if (mapList.Count == 0)
                {
                    inputMapping.Remove(inputEntityLogicalName);
                    inputMapper.Remove(inputEntityLogicalName);
                }
                else
                {
                    inputMapping[inputEntityLogicalName] = mapList;
                    inputMapper[inputEntityLogicalName]  = guidMapList;
                }
            }
        }
        private void btnMappings_Click(object sender, EventArgs e)
        {
            var entities      = Entities.ToArray();
            var mappingDialog = new MappingList(entities, settings[organisationid].Mappings);

            mappingDialog.ShowDialog(ParentForm);
            settings[organisationid].Mappings = mappingDialog.GetMappingList();
            InitMappings();
        }
Exemplo n.º 3
0
        public void GetMappingListEmptyEntityLogicalName()
        {
            string entityLogicalName = string.Empty;

            using (var systemUnderTest = new MappingList(mappings))
            {
                var actual = systemUnderTest.GetMappingList(entityLogicalName);

                actual.Count.Should().Be(0);
            }
        }
Exemplo n.º 4
0
        public void GetMappingListPopulatedEntityLogicalName()
        {
            var entityLogicalName = "Acoount";
            var entityRef         = new EntityReference(entityLogicalName);

            var mapping = new Item <EntityReference, EntityReference>(entityRef, entityRef);

            mappings.Add(mapping);

            using (var systemUnderTest = new MappingList(mappings))
            {
                systemUnderTest.PopulateMappingGrid();

                var actual = systemUnderTest.GetMappingList(entityLogicalName);

                actual.Count.Should().Be(1);
            }
        }
Exemplo n.º 5
0
        public void MappingIfKeyDoesNotExist(string inputEntityLogicalName, Dictionary <string, List <Item <EntityReference, EntityReference> > > inputMapping, Dictionary <string, Dictionary <Guid, Guid> > inputMapper, Form parentForm)
        {
            var mappingReference = new List <Item <EntityReference, EntityReference> >();

            using (var mappingDialog = new MappingList(mappingReference)
            {
                StartPosition = FormStartPosition.CenterParent
            })
            {
                if (parentForm != null)
                {
                    mappingDialog.ShowDialog(parentForm);
                }

                var mapList     = mappingDialog.GetMappingList(inputEntityLogicalName);
                var guidMapList = mappingDialog.GetGuidMappingList();

                if (mapList.Count > 0)
                {
                    inputMapping.Add(inputEntityLogicalName, mapList);
                    inputMapper.Add(inputEntityLogicalName, guidMapList);
                }
            }
        }