Ejemplo n.º 1
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.º 2
0
        private void PasteRowAction_Execute(object sender, SingleChoiceActionExecuteEventArgs e)
        {
            logger = new SimpleImportLogger();
            var objName = View.ObjectTypeInfo.Name;

            // find param
            var pasteParam = ObjectSpace.FindObject <PasteParam>(CriteriaOperator.Parse(
                                                                     "IsDefault=? And ObjectTypeName=?",
                                                                     true,
                                                                     objName));

            switch (e.SelectedChoiceActionItem.Caption)
            {
            case pasteRowsCaption:
                PasteRowValues(pasteParam);
                break;

            case pasteRowsOfflineCaption:
                PasteOfflineRowValues(pasteParam, true);
                break;

            case pasteRowsCommitCaption:
                PasteCommitRowValues(pasteParam, true);
                break;

            case pasteColumnCaption:
                PasteColumnValues();
                break;

            case clearColumnCaption:
                ClearColumnValues();
                break;
            }
        }