public void DoRemap()
        {
            var param = (ImportOrdinalsParam)View.CurrentObject;

            var csvStream = new MemoryStream();

            param.File.SaveToStream(csvStream);
            csvStream.Position = 0;

            var mapCreator = new FieldMapListCreator(csvStream);
            var fieldMaps  = param.OrdToFieldMaps;

            mapCreator.AppendFieldMaps(((XPObjectSpace)ObjectSpace).Session, fieldMaps);
        }
        public void DoRemap()
        {
            var param = (ImportHeadersParam)View.CurrentObject; // TODO: refactor for deduplication

            var csvStream = new MemoryStream();

            param.File.SaveToStream(csvStream);
            csvStream.Position = 0;

            var mapCreator = new FieldMapListCreator(csvStream);
            var fieldMaps  = param.HeaderToFieldMaps;

            mapCreator.AppendFieldMaps(((XPObjectSpace)ObjectSpace).Session, fieldMaps);
        }
Пример #3
0
        public void CreateFieldMapsFromStream()
        {
            var csvText = @"Description,Amount,MockLookupObject1,MockLookupObject2
Hello 1,10,Parent 1,Parent B1
Hello 2,11,Parent 2,Parent B2
Hello 3,12,Parent 3,Parent B3
Hello 4,13,Parent 4,Parent B4
";
            var param   = ObjectSpace.CreateObject <ImportHeadersParam>();

            param.ObjectTypeName = "MockFactObject";

            var csvStream = StringUtils.ConvertToCsvStream(csvText);

            var mapCreator = new FieldMapListCreator(csvStream);
            var fieldMaps  = param.HeaderToFieldMaps;

            mapCreator.AppendFieldMaps(ObjectSpace.Session, fieldMaps);

            Assert.AreEqual(4, fieldMaps.Count);
        }