コード例 #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Enabled = false;

            try{
                Zenfox_Software_OO.data.bd_postgres bd = new Zenfox_Software_OO.data.bd_postgres();
                bd.localdb();

                Zenfox_Software_OO.Cadastros.Empresa cmd = new Zenfox_Software_OO.Cadastros.Empresa();
                if (cmd.verifica_primeiro_acesso())
                {
                    inicial inicial = new inicial();
                    inicial.ShowDialog();
                    timer1.Enabled = true;
                }
                else
                {
                    this.Visible = false;
                    Dashboard dashboard = new Dashboard(1);
                    dashboard.Show();
                    atualizacao.RunWorkerAsync();
                }
            }
            catch (Exception ee)
            {
                // MessageBox.Show(ee.Message);
                Configura_Database c_database = new Configura_Database();
                c_database.ShowDialog();
                timer1.Enabled = true;
            }
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (System.IO.File.Exists("bd.txt"))
            {
                System.IO.File.Delete("bd.txt");
            }

            System.IO.File.WriteAllText("bd.txt", "SERVER=" + txt_ip.Text + ";PORT=" + txt_porta.Text);

            try
            {
                Zenfox_Software_OO.data.bd_postgres sql = new Zenfox_Software_OO.data.bd_postgres();
                sql.localdb();
                sql.AbrirConexao();
                sql.FechaConexao();
                MessageBox.Show("Conexão realizada com sucesso !");
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
            //SERVER="++";PORT=5433
        }
コード例 #3
0
        private void Configura_Database_Load(object sender, EventArgs e)
        {
            Boolean x = false;

            Zenfox_Software_OO.data.bd_postgres sql = new Zenfox_Software_OO.data.bd_postgres();

            // Porta 5432
            if (System.IO.File.Exists("bd.txt"))
            {
                System.IO.File.Delete("bd.txt");
            }
            System.IO.File.WriteAllText("bd.txt", "SERVER=localhost;PORT=5432");
            sql.localdb();
            try
            {
                sql.AbrirConexao();
                sql.FechaConexao();
                x = true;
                this.Close();
            }
            catch
            {
            }

            // Porta 5433
            if (!x)
            {
                if (System.IO.File.Exists("bd.txt"))
                {
                    System.IO.File.Delete("bd.txt");
                }
                System.IO.File.WriteAllText("bd.txt", "SERVER=localhost;PORT=5433");
                sql.localdb();
                try
                {
                    sql.AbrirConexao();
                    sql.FechaConexao();
                    x = true;
                    this.Close();
                }
                catch
                {
                }
            }

            // Porta 5434
            if (!x)
            {
                if (System.IO.File.Exists("bd.txt"))
                {
                    System.IO.File.Delete("bd.txt");
                }
                System.IO.File.WriteAllText("bd.txt", "SERVER=localhost;PORT=5434");
                sql.localdb();
                try
                {
                    sql.AbrirConexao();
                    sql.FechaConexao();
                    x = true;
                    this.Close();
                }
                catch
                {
                }
            }
        }