public string DoWork() { WPConfigurationSourceDTO configurationSource = new WPConfigurationSourceDTO() { DB_HOST = this._wpToJsonDTO.WPSourceDBHost, DB_NAME = this._wpToJsonDTO.WPSourceDBName, DB_PASSWORD = this._wpToJsonDTO.WPSourceDBPassword, DB_USER = this._wpToJsonDTO.WPSourceDBUser, TABLE_PREFIX = this._wpToJsonDTO.WPSourceDBTablePrefix, }; WPConfigurationPluginExportDTO configurationPluginExport = new WPConfigurationPluginExportDTO() { WooCommerce = (Array.IndexOf(this._wpToJsonDTO.PluginExport, ListOfPlugin.WooCommerce) != -1), Yoast = (Array.IndexOf(this._wpToJsonDTO.PluginExport, ListOfPlugin.Yoast) != -1) }; WPExportDTO exportDTO = WPExportEngine.RunAllQueries(configurationSource, configurationPluginExport); Newtonsoft.Json.Formatting formatting = Newtonsoft.Json.Formatting.None; if (this._wpToJsonDTO.JSONIndented) { formatting = Newtonsoft.Json.Formatting.Indented; } WPToJson wPToJson = new WPToJson(exportDTO) { ExportSeoWithYoast = configurationPluginExport.Yoast }; return(wPToJson.CreateJSON(formatting)); }
public void DoWork() { WPExportDTO exportDTO = WPExportEngine.RunAllQueries( _wpSource, _wpConfigurationPluginExportDTO); string json = string.Empty; if (string.IsNullOrEmpty(_configurationOUTFile.DirtyExportFile) == false) { DirtyWPToJson dirtyWPToJson = new DirtyWPToJson(exportDTO); json = dirtyWPToJson.CreateJSON(Newtonsoft.Json.Formatting.None); FileHelper.WriteToFile(_configurationOUTFile.DirtyExportFile, json); } WPToJson wPToJson = new WPToJson(exportDTO) { ExportSeoWithYoast = _wpConfigurationPluginExportDTO.Yoast }; json = wPToJson.CreateJSON(Newtonsoft.Json.Formatting.Indented); if (string.IsNullOrEmpty(_configurationOUTFile.ExportFile) == false) { FileHelper.WriteToFile(_configurationOUTFile.ExportFile, json); } WPExportResult wp = Newtonsoft.Json.JsonConvert.DeserializeObject <WPExportResult>(json); ISQLEngine engine = null; if (string.IsNullOrEmpty(_configurationOUTFile.SQLServerConnection) == false) { engine = new SQLServerEngine(_configurationOUTFile.SQLServerConnection); ExportToDatabase export = new ExportToDatabase(engine); var result = export.Run(wp).Result; } if (string.IsNullOrEmpty(_configurationOUTFile.MySQLServerConnection) == false) { engine = new MySQLEngine(_configurationOUTFile.MySQLServerConnection); ExportToDatabase export = new ExportToDatabase(engine); var result = export.Run(wp).Result; } }