private void ImportBlog() { string fileLocation = @"C:\Users\Kloss\Documents\Projects\XBlog\test.xml"; List <WPPost> listWordpressPosts = ImportManager.Import(fileLocation, false, false, false); BlogHome bh = new BlogHome(); bh.InnerItem.Editing.BeginEdit(); bh.BlogName = "meh"; bh.Name = "meh"; bh.InnerItem.Editing.EndEdit(); ImportManager.ImportPosts(bh, listWordpressPosts); }
private static void ImportModule(string modulePath, string userName) { try { string moduleName = GetModuleName(modulePath); using (var transaction = new CMSTransactionScope()) { // Execute before.sql ExecuteSqlScript(SQL_BEFORE_PATH); // Import .zip package with export data if (!System.IO.File.Exists(modulePath)) { throw new ArgumentException("[ModuleExportPackageImporter.Import] File on given path '" + modulePath + "' does not exist.", "modulePath"); } var settings = CreateImportSettings(modulePath, userName); ImportManager importManager = new ImportManager(settings); importManager.Import(null); // Execute after.sql ExecuteSqlScript(SQL_AFTER_PATH); // Commit the module installation if the transaction succeeded transaction.Commit(); } // Perform finish actions FinishModuleInstallation(modulePath); CoreServices.EventLog.LogEvent("I", "ModuleInstaller", "MODULEINSTALLED", $"Module '{moduleName}' from path {modulePath} has been installed (restart could be required)."); } catch (Exception ex) { Console.Error.WriteLine(ex.ToString()); } }
private void DataExportWizard_OnExecute(object sender, WizardEventArgs e2) { var d = sender as DataExportWizard; var dfExport = new DataFactory(d.Destination); dfExport.TestConnection(); var selectedTables = d.SelectedTables; if (d.Source.Provider == DatabaseProvider.Unspecified) { // use ImportManager to import a file via the connection string var ds = ImportManager.Import(d.Source.Filename, d.Source.Options); foreach (DataTable dt in ds.Tables) { if (Array.IndexOf <string>(selectedTables, dt.TableName) < 0) { continue; } dfExport.CreateTable(dt.TableName, dt); } } else { var dfImport = new DataFactory(d.Source); dfImport.TestConnection(); foreach (var item in selectedTables) { var dt = dfImport.FillTable("select * from [" + item + "]"); dfExport.CreateTable(item, dt); } } }
static void Main(string[] args) { ImportManager.Import(); }
public void Execute(IJobExecutionContext context) { ImportManager.Import(); }
protected override void ProcessRecord() { var importer = new ImportManager(); importer.Import(SharePointSiteUrl, SharePointUserName, SharePointPassword, ImportConfig, ImportPath); }
public static void Main(string[] args) { ProductsManager.StartApi(false); ImportManager.Import(typeof(DescendantOfAdamAndEveImporter)); }
void import() { bool result = true; string fileName = ""; if (_NeedFileDialog) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.CheckFileExists = true; openFileDialog.InitialDirectory = ""; openFileDialog.RestoreDirectory = true; result = openFileDialog.ShowDialog() == DialogResult.OK; fileName = openFileDialog.FileName; } if (result) { object[] services = null; ImportType importType; try { if (_NeedFileDialog) { importType = ImportManager.FileImportType(fileName); if (_ImportFormType != ImportType.All) { if (importType != _ImportFormType) { ShowMessageError(string.Format(GetLocalized("ImportFileNotContainData"), ImportManager.ImportName(_ImportFormType))); return; } } } else { importType = _ImportFormType; } ImportManager importManager = createImportManager(); switch (importType) { case ImportType.Country: case ImportType.Absence: case ImportType.Feast: case ImportType.WorkingDays: services = new object[] { _CountryService }; break; case ImportType.Region: services = new object[] { _CountryService, _RegionService }; break; case ImportType.Store: services = new object[] { _CountryService, _RegionService, _StoreService }; break; case ImportType.World: case ImportType.HWGR: case ImportType.WGR: case ImportType.ActualBusinessVolume: case ImportType.TargetBusinessVolume: case ImportType.CashRegisterReceipt: services = new object[] { _StoreService }; break; case ImportType.Employee: case ImportType.LongTimeAbsence: case ImportType.TimePlanning: case ImportType.TimeRecording: services = new object[] { _EmployeeService }; break; default: ShowMessage(string.Format(GetLocalized("msgImportTypeNotRealized"), importType.ToString())); break; } if (services != null) { _CanClose = false; enableControls(false); importManager.Import(fileName, importType, services); } } catch (SameColumnsInImportFile) { ShowMessageError(GetLocalized("msgSameColumns")); } catch (UnknownImportFile) { ShowMessageError(GetLocalized("msgImportFileUnknown")); } } }
private DataSet LoadChildDataSet() { #region Check cache for previous settings if (prevChildString == Step1.ToString() && prevChildDataSet != null) { return(prevChildDataSet); } prevChildString = Step1.ToString(); #endregion DataSet ds = null; dcm.ClearRelations(); if (Step1.InputDataSource == InputDataSourceType.File && !Step1.FileSupportsTables(Step1.Filename)) { // load a sample from file // TODO: Need to implemen a way to import sample XXX records var options = new ConverterOptionList(); options["ImportMaxRows"] = MAX_SAMPLE.ToString(); // currently, the following file types support the ImportMaxRows feature: // 1) any delimiter derived class (csv, tab) // 2) dbase 4 #pragma warning disable 0618 ds = prevChildDataSet = ImportManager.Import(Step1.Filename, options); #pragma warning restore 0618 } else { // load a sample from database ds = new DataSet("ChildDataSet"); DataTable dt = null; int nr = 0; var df = new DataFactory(Step1.Provider, Step1.ConnectionString); string query = string.Format("select * from [{0}]", Step1.Tablename); #region Load a sample of XXX records foreach (DataRow dr in df.ExecuteReader(query)) { if (nr++ == 0) { // create a data table dt = dr.Table.Copy(); dt.TableName = Step1.Tablename; ds.Tables.Add(dt); } DataRow drNew = dt.NewRow(); DataUtil.CopyRow(dr, drNew); dt.Rows.Add(drNew); if (nr == MAX_SAMPLE) { break; } } #endregion ds = prevChildDataSet = ds; } return(ds); }