Beispiel #1
0
        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();
                }
            }
        }
Beispiel #2
0
        public void setConfig()
        {
            Mysql.errorDebug = false;

            // Si esta disponible una nueva version, actualizo la aplicacion.
            if (Utilidades.Actualizar_version())
            {
                // Cargo archivo de configuracion
                Config.start();

                errores_desde.Value = Config.config_limite_error;
                lineaid.Value       = Config.config_linea;
                hrCamx.Value        = Config.camx;
                txtCM.Text          = Config.CM_pt200;
                txtLNB.Text         = Config.NPM_LNB;
                txtAdmin.Text       = Config.adminPass;

                txtHost.Text = Config.server;
                txtDb.Text   = Config.db;
                txtUser.Text = Config.user;
                txtPass.Text = Config.pass;

                moduloNPM.Checked = false;
                moduloCM.Checked  = false;

                switch (Config.config_modulo)
                {
                case "npm":
                    moduloNPM.Checked = true;
                    break;

                case "cm":
                    moduloCM.Checked = true;
                    break;
                }

                Log.msg("------------------");
                Log.msg("Linea: " + Config.config_linea);
                Log.msg("Modulo:" + Config.config_modulo);
                Log.msg("Limite error:" + Config.config_limite_error);
                Log.msg("------------------");

                iniciarTimer();
            }
        }
Beispiel #3
0
        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 + "');");
                }
            }
        }
Beispiel #4
0
        public static void ping(string linea, string maquina)
        {
            Mysql  sql   = new Mysql();
            string query = "";

            string ver  = Utilidades.Version();
            string host = Dns.GetHostEntry(Dns.GetHostName()).HostName.ToString();

            query = @"select id,flag from `npmpicker`.`ping` where id_linea = '" + linea + "' and maquina = '" + maquina + "' limit 1";
            DataTable dt = sql.Select(query);

            if (dt.Rows.Count > 0)
            {
                query = @"update `npmpicker`.`ping` set  
                ping = NOW(),
                hostname = '" + host + @"',
                version = '" + ver + @"' 
                where id_linea = '" + linea + "'  and maquina = '" + maquina + "' limit 1";
                bool rs = sql.Ejecutar(query);

                Log.msg("[+] UPDATE PING");

                DataRow r    = dt.Rows[0];
                string  flag = r["flag"].ToString();
                string  id   = r["id"].ToString();
                if (flag.Equals("U"))
                {
                    sql.Ejecutar("Update `ping` set flag = null where id = '" + id + "' limit 1");
                    Log.msg("[+] EL administrador solicita actualizar el sistema!");
                    Utilidades.Actualizar_version();
                    Tray.restartAplicacion();
                }
            }
            else
            {
                query = @"INSERT INTO `npmpicker`.`ping` (`id_linea`, `maquina`, `ping`, `hostname`, `version`) VALUES (" + linea + ", '" + maquina + "', NOW(), '" + host + "', '" + ver + "');";
                bool rs = sql.Ejecutar(query);

                Log.msg("[+] INSERT PING");
            }
        }