Beispiel #1
0
        public DataTable pesquPc(CadIPs cadIPs)
        {
            try
            {
                Abrirconexao();

                DataTable         dataTable         = new DataTable();
                SQLiteDataAdapter sQLiteDataAdapter = new SQLiteDataAdapter();

                //PARAMETROS QUE POSSIBILITA O SELECT COM LIKE NO BANCO
                comando = new SQLiteCommand("select * from cadips WHERE pc LIKE @pc", conexao);
                comando.Parameters.AddWithValue("@pc", "%" + cadIPs.pc + "%");
                sQLiteDataAdapter = new SQLiteDataAdapter(comando);
                dataTable         = new DataTable();
                sQLiteDataAdapter.Fill(dataTable);

                return(dataTable);
            }
            catch (Exception erro)
            {
                throw erro;
            }
            finally
            {
                FecharConexao();
            }
        }
Beispiel #2
0
        public void fkIps(CadIPs cadIPs)
        {
            try
            {
                Abrirconexao();

                comando = new SQLiteCommand("select * from cadips where ip = @ip and pc = @pc", conexao);

                comando.Parameters.AddWithValue("@ip", cadIPs.ip);
                comando.Parameters.AddWithValue("@pc", cadIPs.pc);

                SQLiteDataReader fkIps;

                fkIps = comando.ExecuteReader();

                if (fkIps.Read())
                {
                    cadIPs.id_ips = fkIps.GetInt32(0);
                    fkIps.Close();
                    //System.Windows.Forms.MessageBox.Show("fkIps GERADO" + cadIPs.id_ips);
                }
            }
            catch (Exception erro)
            {
                throw erro;
            }
            finally
            {
                FecharConexao();
            }
        }
Beispiel #3
0
 private void limparVariaves(CadIPs cadIPs)
 {
     cadIPs.id_ips      = 0;
     cadIPs.ip          = "";
     cadIPs.memoria     = "";
     cadIPs.processador = "";
     cadIPs.windos      = "";
     cadIPs.ant_viros   = "";
 }
        private void alterarIPs(CadIPs cadIPs)
        {
            cadIPs.pc          = textBoxPC.Text;
            cadIPs.ip          = textBoxIP.Text;
            cadIPs.memoria     = textBoxMemoria.Text;
            cadIPs.processador = textBoxProcessador.Text;
            cadIPs.windos      = textBoxWin.Text;
            cadIPs.ant_viros   = textBoxAntVirus.Text;
            cadIPs.tag         = Convert.ToInt32(textBoxTAG.Text);

            ipsBll.alterarIPs(cadIPs);
        }
Beispiel #5
0
        public void fkIps(CadIPs cadIPs)
        {
            try
            {
                ipsDao.fkIps(cadIPs);
            }
            catch (Exception erro)
            {
                System.Windows.Forms.MessageBox.Show("ERRO de conexao com a base de dados: " + erro, "Alerta", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Stop);

                throw erro;
            }
        }
Beispiel #6
0
        public DataTable pesquPc(CadIPs cadIPs)
        {
            try
            {
                DataTable dataTable = new DataTable();

                dataTable = ipsDao.pesquPc(cadIPs);

                return(dataTable);
            }
            catch (Exception erro)
            {
                throw erro;
            }
        }
Beispiel #7
0
        public void deletarIPs(CadIPs cadIPs)
        {
            try
            {
                ipsDao.deletarIPs(cadIPs);

                System.Windows.Forms.MessageBox.Show("Dados deletar com sucesso : ", "Alerta", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
            }
            catch (Exception erro)
            {
                System.Windows.Forms.MessageBox.Show("ERRO de conexao com a base de dados:" + erro, "Alerta", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Stop);

                throw erro;
            }
        }
Beispiel #8
0
        public void salvarIPs(CadIPs cadIPs)
        {
            try
            {
                Abrirconexao();

                if (cadIPs.id_ips != 0)
                {
                    comando = new SQLiteCommand("update cadips set pc = @pc, ip = @ip, memoria = @memoria, processador = @processador, windos = @windos, ant_viros = @ant_viros, tag = @tag where id_ips = @id_ips", conexao);

                    comando.Parameters.AddWithValue("@pc", cadIPs.pc);
                    comando.Parameters.AddWithValue("@ip", cadIPs.ip);
                    comando.Parameters.AddWithValue("@memoria", cadIPs.memoria);
                    comando.Parameters.AddWithValue("@processador", cadIPs.processador);
                    comando.Parameters.AddWithValue("@windos", cadIPs.windos);
                    comando.Parameters.AddWithValue("@ant_viros", cadIPs.ant_viros);
                    comando.Parameters.AddWithValue("@tag", cadIPs.tag);
                    comando.Parameters.AddWithValue("@id_ips", cadIPs.id_ips);
                }
                else if (cadIPs.id_ips == 0)
                {
                    comando = new SQLiteCommand("insert into cadips values( null, @pc, @ip, @memoria, @processador, @windos, @ant_viros, @tag)", conexao);

                    comando.Parameters.AddWithValue("@pc", cadIPs.pc);
                    comando.Parameters.AddWithValue("@ip", cadIPs.ip);
                    comando.Parameters.AddWithValue("@memoria", cadIPs.memoria);
                    comando.Parameters.AddWithValue("@processador", cadIPs.processador);
                    comando.Parameters.AddWithValue("@windos", cadIPs.windos);
                    comando.Parameters.AddWithValue("@ant_viros", cadIPs.ant_viros);
                    comando.Parameters.AddWithValue("@tag", cadIPs.tag);
                }

                comando.ExecuteNonQuery();
                limparVariaves(cadIPs);
            }
            catch (Exception erro)
            {
                throw erro;
            }
            finally
            {
                FecharConexao();
            }
        }
Beispiel #9
0
        public void salvarIPs(CadIPs cadIPs)
        {
            try
            {
                ipsDao.salvarIPs(cadIPs);

                if (cadIPs.id_ips != 0)
                {
                    System.Windows.Forms.MessageBox.Show("Dados alterados com sucesso : ", "Alerta", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Dados salvos com sucesso : ", "Alerta", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                }
            }
            catch (Exception erro)
            {
                System.Windows.Forms.MessageBox.Show("ERRO de conexao com a base de dados: " + erro, "Alerta", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Stop);

                throw erro;
            }
        }
Beispiel #10
0
        public void deletarIPs(CadIPs cadIPs)
        {
            try
            {
                Abrirconexao();

                comando = new SQLiteCommand("delete from cadips where id_ips = @id_ips", conexao);

                comando.Parameters.AddWithValue("@id_ips", cadIPs.id_ips);



                comando.ExecuteNonQuery();
                limparVariaves(cadIPs);
            }
            catch (Exception erro)
            {
                throw erro;
            }
            finally
            {
                FecharConexao();
            }
        }
 private void deletarIPs(CadIPs cadIPs)
 {
     ipsBll.deletarIPs(cadIPs);
     listarIPs();
 }
        private void pesquPc(CadIPs cadIPs)
        {
            dataGridViewListaCadIPs.DataSource = ipsBll.pesquPc(cadIPs);

            cadIPs.pc = textBoxPC.Text;
        }
 private void pesquIp(CadIPs cadIPs)
 {
     dataGridViewListaCadIPs.DataSource = ipsBll.pesquIp(cadIPs);
     cadIPs.ip = textBoxIP.Text;
 }