Esempio n. 1
0
        public static DataSet ExecSql(String sql, BancoOracle bd, string datasource, string schema)
        {
            DataSet           dtResultado = new DataSet();
            OracleConnection  con         = null;
            OracleCommand     cm          = null;
            OracleDataAdapter odp         = null;

            try
            {
                con            = GetCon(schema, datasource);
                cm             = con.CreateCommand();
                cm.CommandText = sql;
                cm.CommandType = CommandType.Text;
                odp            = new OracleDataAdapter(cm);

                odp.Fill(dtResultado, "SqlTable");
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                cm.Dispose();
                odp.Dispose();
                con.Close();
            }
            return(dtResultado);
        }
Esempio n. 2
0
        public void salvar()
        {
            String SQl = "insert into filme(CodFilme,NomeFilme,Categoria,Duracao,Classificacao,PaisOrigem,CodigoDiretor,AnoDirecao)values(se_filmeS.nextval,'" + StrfNome + "','" + StrfCategoria + "'," + intDuracao + ",'" + StrClassificacao + "','" + StrPaisOrigem + "'," + intCodDiretor + "," + intAnoDirecao + ")";

            try{
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 3
0
        public void salvar()
        {
            String SQl = "insert into cinema(CodCinema,NomeCinema,Logradouro,Bairro,Numero,Cidade,Estado)values(se_cinemaS.nextval,'" + strNome + "','" + strRua + "','" + strBairro + "','" + intNumero + "','" + strCidade + "','" + strEstado + "')";

            try
            {
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 4
0
        public void excluir()
        {
            string SQl = "Delete from cinema where  CodCinema = " + intCodigo;

            try
            {
                BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 5
0
        public static DataTable BuscaFilmeRelatorio()
        {
            string SQl = "select f.NomeFilme as Filme,f.Categoria as Categoria,f.Classificacao as Classificação,f.PaisOrigem as Origem,d.NomeDiretor as Diretor,f.AnoDirecao as Ano,s.NumeroSala as Sala,s.DataExibicao as Exibição,to_char(s.Horario,'hh24:mi')Horário from filme f join diretor d on f.CodigoDiretor=d.IdDiretor join sessao s on s.CodigoFilme=f.CodFilme join cinema b on b.CodCinema=s.CodigoCinema";

            try
            {
                return(BancoOracle.GetInstancia().Consultar(SQl));
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao recuperar dados dos Cinemas" + ex.Message);
            }
        }
Esempio n. 6
0
        public void Alterar()
        {
            string SQL = "UPDATE ESTOQUE SET QTDE = '" + intQtde + "' WHERE CODIGOPRODUTO = '" + intCodProduto + "'";

            try
            {
                BancoOracle.GetInstancia().Persistir(SQL);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 7
0
        public void excluir()
        {
            string SQl = "Delete from artista where CodArtista = '" + IntCodigoA + "' ";

            try
            {
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 8
0
        public void salvar()
        {
            String SQl = "insert into artista(CodArtista,NomeArtista )values(se_artistaS.nextval,'" + strNome + "')";

            try
            {
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 9
0
        public void alterar()
        {
            string SQl = "UPDATE diretor  SET NomeDiretor = '" + strNome + "' where IdDiretor = '" + intCodDiretor + "' ";

            try
            {
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 10
0
        public void salvar()
        {
            String SQl = "insert into diretor(IdDiretor,NomeDiretor)values(se_diretorS.nextval,'" + strNome + "')";

            try
            {
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 11
0
        public void excluir()
        {
            string SQl = "Delete from cliente where IdCliente = " + intUCodigo;

            try
            {
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 12
0
        public void alterar()
        {
            string SQl = "UPDATE cliente  SET  NomeCliente = '" + strUNome + "', Email = '" + strEmail + "' WHERE  IdCliente = " + intUCodigo;

            try
            {
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 13
0
        public void salvar()
        {
            String SQl = "insert into cliente(IdCliente,NomeCliente,Email)values(se_clienteS.NEXTVAL,'" + strUNome + "','" + strEmail + "')";

            try
            {
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 14
0
        public void Alterar()
        {
            string SQL = "UPDATE pagamento SET STATUS = '" + strStatus + "', DATAPAGAMENTO = '" + strDataP + "' WHERE NPAGAMENTO = '" + intPagamento + "'";

            try
            {
                BancoOracle.GetInstancia().Persistir(SQL);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 15
0
        public void Salvar()
        {
            String SQl = "insert into PAGAMENTO (NPAGAMENTO, STATUS, CODCOMPRA, VALORPARCELA, DATAPAGAMENTO) values ( pagamento_seq1.nextval,'" + strStatus + "'," + intCodigoVenda + ", '" + strValorParcela + "', '" + strDataP + "') ";

            try
            {
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 16
0
        public void excluir()
        {
            string SQl = "Delete from diretor where IdDiretor = '" + intCodDiretor + "' ";

            try
            {
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 17
0
        public void Salvar()
        {
            String SQl = "insert into ESTOQUE (CODIGOPRODUTO, QTDE) values ('" + intCodProduto + "','" + intQtde + "')";

            try
            {
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 18
0
        public void alterar()
        {
            string SQl = "UPDATE artista  SET NomeArtista = '" + strNome + "' where CodArtista = '" + intCodigoA + "' ";

            try
            {
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 19
0
        public void Salvar()
        {
            String SQl = "insert into COMPRAPRODUTO (CODCOMPRA, CODPRODUTO, QTDE) values (" + intCodCompra + "," + intCodProduto + "," + intQtde + ") ";

            try
            {
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 20
0
        public static DataTable BuscaFilme()
        {
            string SQl = "select f.NomeFilme as filme,f.Categoria,f.Classificacao,f.PaisOrigem,d.NomeDiretor as diretor,f.AnoDirecao,s.NumeroSala as Sala from filme f,diretor d,sessao s,cinema t where f.CodigoDiretor = d.IdDiretor and s.CodigoFilme=f.CodFilme and t.CodigoSala=s.NumeroSala";

            try
            {
                return(BancoOracle.GetInstancia().Consultar(SQl));
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao recuperar dados dos Cinemas" + ex.Message);
            }
        }
Esempio n. 21
0
        public void salva()
        {
            String SQl = "insert into AtuaEm(Codigo_filme,IdArtista)values(" + intCodigoFilme + "," + intCodigoArtista + ")";

            try
            {
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 22
0
        public void alterar()
        {
            string SQl = "update atuaEM set Codigo_filme = " + intCodigoFilme + ",IdArtista = " + intCodigoArtista + " where Codigo_filme  =" + intCodigoFilme;

            try
            {
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 23
0
        public void Salvar()
        {
            String SQl = "insert into COMPRA (CODIGO, DATACOMPRA, VALOR, CODIGOCLI, CODFUNC, NUMPARCELAS, FORMPAGAMENTO, DESCONTO) values (compra_seq1.nextval,'" + strDataV + "','" + strValorCompra + "'," + intCodCli + "," + intCodigoVendedor + "," + intNumParcela + "," + intFormaPag + ",'" + strValorDesconto + "') ";

            try
            {
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 24
0
        public void Excluir()
        {
            String SQl = "delete from COMPRA where codigo =  " + intCodigoVenda + "";

            try
            {
                int numTuplas = BancoOracle.GetInstancia().Persistir(SQl);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 25
0
        public bool excluir()
        {
            String SQL = "delete from AtuaEm WHERE Codigo_filme = " + intCodigoFilme;

            try
            {
                BancoOracle.GetInstancia().Persistir(SQL);
                return(true);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 26
0
        public static DataTable recuperaProdutos()
        {
            string SQL = "SELECT  P.CODIGO, P.NOME, P.VALOR, E.QTDE  FROM PRODUTO P, ESTOQUE E WHERE P.CODIGO = E.CODIGOPRODUTO";

            try
            {
                return(BancoOracle.GetInstancia().Consultar(SQL));
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao recuperar todos os produtos cadastrados "
                                    + ex.Message);
            }
        }
Esempio n. 27
0
        public static DataTable recuperarTodos()
        {
            string SQL = "SELECT C.CODIGO as Código_Venda, C.DATACOMPRA as Data_Compra, C.VALOR as Valor_Compra, CLI.CODIGO, CLI.CPF, CLI.NOME as Cliente, F.NOME as Vendedor, C.NUMPARCELAS as Parcelas, P.NOME as Pagamento, C.DESCONTO as Desconto FROM COMPRA C, CLIENTE CLI, FUNCIONARIO F, FORMAPAGAMENTO P WHERE CLI.CODIGO = C.CODIGOCLI AND F.CODIGO = C.CODFUNC AND P.CODIGO = C.FORMPAGAMENTO ORDER BY C.CODIGO";

            try
            {
                return(BancoOracle.GetInstancia().Consultar(SQL));
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao recuperar todos os clientes cadastrados "
                                    + ex.Message);
            }
        }
Esempio n. 28
0
        public static DataTable recuperaVendas()
        {
            string SQL = "select codigo as codigovenda, datacompra as datavenda, codfunc as codigofuncionario, TO_NUMBER(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(VALOR,'R$ ',''),',','-'),'.','*'),'*',','),'-','.'),'9999.99') compra";

            try
            {
                return(BancoOracle.GetInstancia().Consultar(SQL));
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao recuperar todos os clientes cadastrados "
                                    + ex.Message);
            }
        }
Esempio n. 29
0
        // preencher o relatorio
        public static DataTable recuperaTodasVendas()
        {
            string SQL = "select f.codigo as codigofuncionario, f.nome as nomefuncionario, c.codigo as codigovenda, c.datacompra as datavenda, TO_NUMBER(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(c.VALOR,'R$ ',''),',','-'),'.','*'),'*',','),'-','.'),'9999.99') as valorvenda from funcionario f inner join compra c on c.codfunc = f.codigo";

            try
            {
                return(BancoOracle.GetInstancia().Consultar(SQL));
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao recuperar todos os clientes cadastrados "
                                    + ex.Message);
            }
        }
Esempio n. 30
0
        public static DataTable recuperarTodos()
        {
            string SQl = "Select CodArtista AS Id_Artista,NomeArtista AS Artista from artista";

            try
            {
                return(BancoOracle.GetInstancia().Consultar(SQl));
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao recuperar todos os cadastrados "
                                    + ex.Message);
            }
        }