private void Form1_Load(object sender, EventArgs e) { // Si esta disponible una nueva version, actualizo la aplicacion. if (Utilidades.Actualizar_version()) { try { status_vr.Text = Utilidades.Version(); } catch (Exception ex) { // No se encuentra instaldo el archivo ClickOnce, no es posible cargar version en debugmode } // Cargo archivo de configuracion Config.start(); // Cargo configuracion SQL del sistema Sistema.load(); // Si estoy en mantenimiento, cierro aplicacion. if (Sistema.mantenimiento()) { Application.Exit(); } else { // Muestro Login ServiceCore.url = Util.AppConfigValue("IASERVER", "service"); showLogin(); } } }
public static void ping() { if (Sistema.mantenimiento()) { Application.Exit(); } else { string ver = Utilidades.Version(); host = Dns.GetHostEntry(Dns.GetHostName()).HostName.ToString(); Mysql sql = new Mysql(); string str = "select id,hostname,flag from pc where hostname = '" + host + "' limit 1"; DataTable rs = sql.Select(str); if (sql.rows) { DataRow r = rs.Rows[0]; flag = r["flag"].ToString(); id = r["id"].ToString(); switch (flag) { case "A": MessageBox.Show("El ADMINISTRADOR solicito actualizar el Control de Reparacion.", "ADMINISTRACION", MessageBoxButtons.OK, MessageBoxIcon.Information); sql.Ejecutar("Update `pc` set flag = '' where id = '" + id + "' limit 1"); Utilidades.Actualizar_version(); break; case "B": MessageBox.Show("El ADMINISTRADOR bloqueo el acceso de esta PC, pongase en contacto para mas informacion.", "ADMINISTRACION", MessageBoxButtons.OK, MessageBoxIcon.Information); Application.Exit(); break; default: sql.Ejecutar("Update `pc` set `vr` = '" + ver + "', fecha = NOW(), id_operador = '" + Operador.id + "' where id = '" + id + "' limit 1"); break; } } else { sql.Ejecutar("INSERT INTO `pc` (`hostname`, `vr`, `fecha`,`id_operador` ) VALUES ('" + host + "', '" + ver + "', NOW(), '" + Operador.id + "');"); } } }