public static WPExportDTO RunAllQueries( WPConfigurationSourceDTO configurationSource, WPConfigurationPluginExportDTO configurationPlugin) { MySQLEngine engine = new MySQLEngine( configurationSource.DB_HOST, configurationSource.DB_NAME, configurationSource.DB_USER, configurationSource.DB_PASSWORD ); WPQuery queries = new WPQuery(configurationSource.TABLE_PREFIX); WPExportDTO result = new WPExportDTO(); result.WPPosts = engine.Select <WPPostDTO>(queries.GetWPPosts); result.WPPostChildren = engine.Select <WPPostDTO>(queries.GetWPPostChildren); result.WPTags = engine.Select <WPTagDTO>(queries.GetWPTags); result.WPCategories = engine.Select <WPCategoryDTO>(queries.GetWPCategories); result.WPUsers = engine.Select <WPUserDTO>(queries.GetWPUsers); result.WPPostsMeta = engine.Select <WPPostMetaDTO>(queries.GetWPPostMeta); if (configurationPlugin.WooCommerce) { result.WPProducts = engine.Select <WPProductDTO>(queries.GetWPProducts); result.WPProductChildren = engine.Select <WPProductDTO>(queries.GetWPProductChildren); } return(result); }
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; } }
public BaseWPExportData(WPExportDTO export) { this._export = export; MappingPost mappingPost = new MappingPost(); this.MapperPost = mappingPost.Get; MappingProducts mappingProducts = new MappingProducts(); this.MapperProduct = mappingProducts.Get; MappingCategory mappingCategory = new MappingCategory(); this.MapperCategory = mappingCategory.Get; MappingTag mappingTag = new MappingTag(); this.MapperTag = mappingTag.Get; MappingUser mappingUser = new MappingUser(); this.MapperUser = mappingUser.Get; }
public DirtyWPToJson(WPExportDTO export) : base(export) { }
public WPToJson(WPExportDTO export) : base(export) { ExportSeoWithYoast = false; }