private void PerformImportFromZip(
            string sourceFilename,
            string destinationRootPath,
            string destinationServerUrl,
            IReportServerWriter writer,
            IBundleReader zipBundleReader,
            IItemImporter <DataSourceItem> dataSourceItemImporter,
            IItemImporter <FolderItem> folderItemImporter,
            IItemImporter <ReportItem> reportItemImporter,
            IFileSystem fileSystem)
        {
            DataSourceEditForm dataSourceEditForm = this.mKernel.Get <DataSourceEditForm>();

            ImportZipForm importzipForm = new ImportZipForm(
                sourceFilename,
                destinationRootPath,
                destinationServerUrl,
                dataSourceEditForm,
                zipBundleReader,
                writer,
                this.mLoggerFactory,
                dataSourceItemImporter,
                folderItemImporter,
                reportItemImporter,
                fileSystem);

            importzipForm.DebugForm = this.mDebugForm;
            importzipForm.Show();
        }
        private void PerformDirectMigrate(
            string sourceServerUrl,
            string sourceRootPath,
            string destinationServerUrl,
            string destinationRootPath,
            IReportServerReader reader,
            IReportServerWriter writer,
            PythonEngine engine)
        {
            DataSourceEditForm dataSourceEditForm = this.mKernel.Get <DataSourceEditForm>();

            //TODO This is dumb. Should be resolving all of the forms from the IoC kernel but I don't feel like refactoring atm...
            MigrateForm migrateForm = new MigrateForm(
                sourceRootPath,
                sourceServerUrl,
                destinationRootPath,
                destinationServerUrl,
                dataSourceEditForm,
                reader,
                writer,
                this.mLoggerFactory,
                engine);

            // If 'Execute Script' is checked, load script
            if (chkExecuteScript.Checked)
            {
                try
                {
                    string scriptFile = txtScriptPath.Text;

                    mLogger.Info("Loading script '{0}'...", scriptFile);

                    migrateForm.LoadScript(scriptFile);

                    mLogger.Info("Script '{0}' loaded!", scriptFile);
                }
                catch (Exception er)
                {
                    mLogger.Error(er, "Error loading script");

                    MessageBox.Show(er.Message,
                                    "Error Loading Script",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);

                    return;
                }
            }

            migrateForm.DebugForm = this.mDebugForm;
            migrateForm.Show();
        }
Beispiel #3
0
        public MigrateForm(
            string sourceRootPath,
            string sourceServerUrl,
            string destinationRootPath,
            string destinationServerUrl,
            DataSourceEditForm dataSourceEditForm,
            IReportServerReader reader,
            IReportServerWriter writer,
            ILoggerFactory loggerFactory,
            PythonEngine pythonEngine)
        {
            if (string.IsNullOrEmpty(sourceRootPath))
            {
                throw new ArgumentException("sourceRootPath");
            }

            if (string.IsNullOrEmpty(sourceServerUrl))
            {
                throw new ArgumentException("sourceServerUrl");
            }

            if (string.IsNullOrEmpty(destinationServerUrl))
            {
                throw new ArgumentException("destinationServerUrl");
            }

            if (string.IsNullOrEmpty(sourceServerUrl))
            {
                throw new ArgumentException("sourceServerUrl");
            }

            if (dataSourceEditForm == null)
            {
                throw new ArgumentNullException("dataSourceEditForm");
            }

            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException("loggerFactory");
            }

            if (pythonEngine == null)
            {
                throw new ArgumentNullException("pythonEngine");
            }

            InitializeComponent();

            this.mSourceRootPath       = sourceRootPath;
            this.mSourceServerUrl      = sourceServerUrl;
            this.mDestinationRootPath  = destinationRootPath;
            this.mDestinationServerUrl = destinationServerUrl;
            this.mDataSourceEditForm   = dataSourceEditForm;
            this.mReportServerReader   = reader;
            this.mReportServerWriter   = writer;
            this.mLoggerFactory        = loggerFactory;
            this.mEngine = pythonEngine;
            this.mLogger = mLoggerFactory.GetCurrentClassLogger();

            this.mLogger.Info("sourceRootPath: {0}", this.mSourceRootPath);
            this.mLogger.Info("sourceServerUrl: {0}", this.mSourceServerUrl);
            this.mLogger.Info("destinationRootPath: {0}", this.mDestinationRootPath);
            this.mLogger.Info("destinationServerUrl: {0}", this.mDestinationServerUrl);
            this.mSummaryForm = new SummaryForm();
        }
        public ImportZipForm(
            string sourceFileName,
            string destinationRootPath,
            string destinationServerUrl,
            DataSourceEditForm dataSourceEditForm,
            IBundleReader bundleReader,
            IReportServerWriter writer,
            ILoggerFactory loggerFactory,
            IItemImporter <DataSourceItem> dataSourceItemImporter,
            IItemImporter <FolderItem> folderItemImporter,
            IItemImporter <ReportItem> reportItemImporter,
            IFileSystem fileSystem)
        {
            if (string.IsNullOrEmpty(sourceFileName))
            {
                throw new ArgumentException("sourceFileName");
            }

            if (string.IsNullOrEmpty(destinationRootPath))
            {
                throw new ArgumentException("destinationRootPath");
            }

            if (string.IsNullOrEmpty(destinationServerUrl))
            {
                throw new ArgumentException("destinationServerUrl");
            }

            if (dataSourceEditForm == null)
            {
                throw new ArgumentNullException("dataSourceEditForm");
            }

            if (bundleReader == null)
            {
                throw new ArgumentNullException("bundleReader");
            }

            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException("loggerFactory");
            }

            if (dataSourceItemImporter == null)
            {
                throw new ArgumentNullException("dataSourceItemImporter");
            }

            if (folderItemImporter == null)
            {
                throw new ArgumentNullException("folderItemImporter");
            }

            if (reportItemImporter == null)
            {
                throw new ArgumentNullException("reportItemImporter");
            }

            if (fileSystem == null)
            {
                throw new ArgumentNullException("fileSystem");
            }

            InitializeComponent();

            this.mSourceFileName       = sourceFileName;
            this.mDestinationRootPath  = destinationRootPath;
            this.mDestinationServerUrl = destinationServerUrl;
            this.mDataSourceEditForm   = dataSourceEditForm;
            this.mBundleReader         = bundleReader;
            this.mReportServerWriter   = writer;
            this.mLoggerFactory        = loggerFactory;
            this.mLogger = this.mLoggerFactory.GetCurrentClassLogger();
            this.mDataSourceItemImporter = dataSourceItemImporter;
            this.mFolderItemImporter     = folderItemImporter;
            this.mReportItemImporter     = reportItemImporter;
            this.mFileSystem             = fileSystem;
            this.mSummaryForm            = new SummaryForm();
        }