public static void InsertMysqlService() { ConectarTedef(); string query = "select * from ts_nomenclador where ruc = '20494306043' and flag = '0' order by codigo"; OleDbCommand commandselect = new OleDbCommand(query, Conex); OleDbDataReader reader = commandselect.ExecuteReader(); while (reader.Read()) { if (!CategoryServiceExists(reader)) { ConnectionMySQL.Connect(); ConnectionMySQL.InsertCategoryService(Helper.SplitPoints(reader.GetString(1))); ConnectionMySQL.Disconnect(); } if (!SubCategoryServiceExists(reader)) { ConnectionMySQL.Connect(); ConnectionMySQL.InsertSubCategoryService(Helper.SplitPoints(reader.GetString(1))); ConnectionMySQL.Disconnect(); } ConnectionMySQL.Connect(); ConnectionMySQL.InsertService(Helper.SplitPoints(reader.GetString(1)), reader.GetString(2), reader.GetString(3), reader.GetString(4)); ConnectionMySQL.Disconnect(); UpdateAfterInsert("ts_nomenclador", "CODIGO", 1, reader); } Desconectar(); FinalMessage(); }
public static void InsertMysqlPrice() { ConectarTarifario(); string query = "select * from tarifario where codigo <> 0 and flag = '0' order by codigo"; OleDbCommand commandselect = new OleDbCommand(query, Conex); OleDbDataReader reader = commandselect.ExecuteReader(); ConnectionMySQL.Connect(); while (reader.Read()) { if (!ServiceExists(reader)) { ConnectionMySQL.Connect(); ConnectionMySQL.InsertService(Helper.SuavizatingCode(reader.GetValue(0).ToString()), reader.GetString(1), "", ""); ConnectionMySQL.Disconnect(); } ConnectionMySQL.IncludePrice(reader.GetValue(0).ToString(), reader.GetValue(2).ToString(), Convert.ToInt16(reader.GetValue(3).ToString())); UpdateAfterInsert("tarifario", "codigo", 0, reader); } ConnectionMySQL.Disconnect(); FinalMessage(); }