private void button1_Click(object sender, EventArgs e) { Connect conn = new Connect(); string response = conn.ping(); Console.WriteLine("respuesta = {0}.", response); }
// This method will be called when the thread is started. public void DoPing() { int i = 0; while (!_shouldStop) { Console.WriteLine("Ping thread: working..."); Thread.Sleep(60000); // send request ping to server DteBridge Connect conn = new Connect(); string response = conn.ping(); Console.WriteLine("respuesta = {0}. iteracion {1}", response, i); i++; } Console.WriteLine("Ping thread: terminating gracefully."); }
public void procesoContingencia() { while (!_shouldStop) { //Thread.Sleep(60000); // Duerme 10 minutos Thread.Sleep(6000); // un minuto //Thread.Sleep(120000); // 20 minutos Console.WriteLine("ProcessContingencia thread: working..."); Connect conn = new Connect(); Log log = new Log(); String ping = conn.ping(); String envunit = String.Empty; String pdft = String.Empty; String pdfc = String.Empty; String jsonName = String.Empty; String filecliente = String.Empty; String filefactura = String.Empty; if (ping == "{\"status\":\"Ok\"}") { ReenvioSql reenv = new ReenvioSql(); // saco el nombres de los archivos json, enviomasivo.xml pdfT y pdfC List <String> listaReenvio = new List <string>(); listaReenvio = reenv.sgteReenvio(); // cargo clase Documento Documento doc = new Documento(); TxtReader json = new TxtReader(); int i = 0; foreach (var reenvio in listaReenvio) { i++; switch (i) { case 1: { doc = json.lectura(reenvio, false, @"" + Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\Iat", "unidadIat", null).ToString() + ":/IatFiles/fileprocess/"); jsonName = reenvio; } break; case 2: envunit = reenvio; break; case 3: pdft = reenvio; break; case 4: pdfc = reenvio; break; case 5: filecliente = reenvio; break; case 6: filefactura = reenvio; break; } } // llamo clase connect para reenviar if (listaReenvio.Count() > 0) { conn.sendInvoice(doc, pdft, pdfc, envunit, filecliente, filefactura, "S"); // Cambio estado del registro de reenvio reenv.cambioEstadoReenvio("PROCESADO", jsonName); } } else { log.addLog("ERROR Proceso Contingencia Ping no responde Json:" + jsonName, "ERROR"); } } }