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

            var csvStream = new MemoryStream();

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

            var             xpoMapper = new Xafology.ExpressApp.Xpo.ValueMap.XpoFieldMapper();
            ICsvToXpoLoader loader    = null;

            if (param.ImportActionType == ImportActionType.Insert)
            {
                loader = new OrdCsvToXpoInserter(param, csvStream, xpoMapper, null);
            }
            else if (param.ImportActionType == ImportActionType.Update)
            {
                loader = new OrdCsvToXpoUpdater(param, csvStream, xpoMapper, null);
            }
            else
            {
                throw new ArgumentException("Invalid Import Action Type", "ImportActionType");
            }

            loader.Execute();
        }
Ejemplo n.º 2
0
        public void DoImport()
        {
            var param = (ImportOrdinalsParam)View.CurrentObject;

            var csvStream = new MemoryStream();

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

            var             xpoMapper = new Xafology.ExpressApp.Xpo.ValueMap.XpoFieldMapper();
            ICsvToXpoLoader loader    = null;
            var             logger    = new SimpleImportLogger();

            if (param.ImportActionType == ImportActionType.Insert)
            {
                loader = new OrdCsvToXpoInserter(param, csvStream, xpoMapper, logger);
            }
            else if (param.ImportActionType == ImportActionType.Update)
            {
                loader = new OrdCsvToXpoUpdater(param, csvStream, xpoMapper, logger);
            }
            else
            {
                throw new ArgumentException("Invalid Import Action Type", "ImportActionType");
            }

            loader.Execute();

            new Xafology.ExpressApp.SystemModule.GenericMessageBox(logger.LogMessage, "Import SUCCESSFUL");
        }
Ejemplo n.º 3
0
 public HeadCsvToXpoUpdater(ImportHeadersParam param, Stream stream,
                            Xafology.ExpressApp.Xpo.ValueMap.XpoFieldMapper xpoFieldMapper, Xafology.ExpressApp.Xpo.ValueMap.IImportLogger logger)
 {
     csvReader           = GetCsvReaderFromStream(stream, true);
     objTypeInfo         = param.ObjectTypeInfo;
     this.param          = param;
     this.xpoFieldMapper = xpoFieldMapper;
     this.logger         = logger;
     recordMapper        = new HeadCsvToXpoRecordMapper(xpoFieldMapper, param.HeaderToFieldMaps, csvReader);
     FieldMapsUtil.ValidateParameters(param);
 }