Exemple #1
0
        //###############End Properties

        //####################Procedimento de banco################################

        public void conectorPDV_find_consultaNome()
        {
            texto  = " select idcliente as Codigo, nome,cpf, nascimento from fisica where nome like concat('";
            texto += nome;
            texto += "' ,'%') ";
            try
            {
                auxConsistencia = 0;
                banco.abreConexao();
                banco.singleTransaction(texto);
                banco.procedimentoSet();
            }
            catch (Exception erro)
            {
                auxConsistencia = 1;
                msgInfo msg = new msgInfo("Caro Cliente - " + erro.Message); msg.ShowDialog();
            }
            finally
            {
                if (auxConsistencia == 0)
                {
                    dgvConsultaNome.DataSource = banco.retornaSet().Tables[0].DefaultView;
                }
                banco.fechaConexao();
                //MessageBox.Show("Carrega...", "Caro Usúario", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemple #2
0
        //######################################################END Controle de objetos#######################################################
        //######################################################Procedimento de banco#########################################################
        public int conector_verifica_exits_contrato(string store, string client)
        {
            auxConsistencia = 0;
            int result = -1;

            try
            {
                banco.abreConexao();
                banco.singleTransaction("select count(*) from crediario where idLoja=?store and idCliente=?id and status not in(1,5)");
                banco.addParametro("?store", store);
                banco.addParametro("?id", client);
                banco.procedimentoRead();
                if (banco.retornaRead().Read() == true)
                {
                    result = Convert.ToInt32(banco.retornaRead().GetString(0));
                }
            }
            catch (Exception e)
            {
                auxConsistencia = 1;
                throw new Exception("ERRO BANCO DE DADOS: " + e.Message.ToString());
            }
            finally
            {
                banco.fechaConexao();
                if (auxConsistencia == 1)
                {
                    result = -1;
                }
            }
            return(result);
        }
Exemple #3
0
        //######################################End Variaveis ###########################################################
        //######################################Procedimento de banco de dados###########################################


        public void conector_find_entrada()
        {
            dgvConsultaNota.Rows.Clear();
            dgvConsultaNota.AllowUserToAddRows = false;

            auxConsistencia = 0;

            texto  = " select ";
            texto += " idEntrada as chave, ";
            texto += " nr_nota, ";
            texto += " Serie, ";
            texto += " cfop, ";
            texto += " entrada.idCliente as Fornecedor, ";
            texto += " juridica.razao, ";
            texto += " emissao, ";
            texto += " valorTotalNota ";
            texto += " from ";
            texto += " entrada ";
            texto += " inner join juridica on(entrada.idCliente=juridica.idCliente)";
            texto += " where";
            texto += " nr_nota= " + auxNota + " and serie = " + auxSerie + " and";
            texto += " entrada.idLoja = " + auxIdLoja + " and  entrada.idCliente = " + auxIdFornecedor;
            try
            {
                banco.abreConexao();
                banco.singleTransaction(texto);
                banco.procedimentoSet();
            }
            catch (Exception erro)
            { MessageBox.Show(erro.Message, "Caro Usúario", MessageBoxButtons.OK, MessageBoxIcon.Warning); auxConsistencia = 1; }
            finally
            {
                if (auxConsistencia == 0)
                {
                    countField = banco.retornaSet().Tables[0].Columns.Count;
                    countRows  = banco.retornaSet().Tables[0].DefaultView.Count;
                    if (countRows > 0)
                    {
                        for (i = 0; i < countRows; i++)
                        {
                            dgvConsultaNota.Rows.Add();
                            for (j = 0; j < countField; j++)
                            {
                                dgvConsultaNota.Rows[i].Cells[j].Value = Convert.ToString(banco.retornaSet().Tables[0].Rows[i][j]);
                            }
                        }
                    }
                    else if (dgvConsultaNota.RowCount < 1)
                    {
                        dgvConsultaNota.Rows.Add();
                    }
                }
                else if (dgvConsultaNota.RowCount < 1)
                {
                    dgvConsultaNota.Rows.Add();
                }
                banco.fechaConexao();
            }
        }
Exemple #4
0
        public void carrega_infor(string store)
        {
            int retorno = 0;

            try
            {
                banco1 = new dados();
                banco1.abreConexao();
                if (banco1.statusSchema() == 1)
                {
                    banco1.singleTransaction("select versaoBanco, versaoSystem, conectorServer, localMachini from system");
                    banco1.procedimentoRead();
                    if (banco1.retornaRead().Read() == true)
                    {
                        VersaoBanco    = banco1.retornaRead().GetString(0);
                        VersaoSystem   = banco1.retornaRead().GetString(1);
                        ConectorServer = banco1.retornaRead().GetString(2);
                        LocalMonitor   = banco1.retornaRead().GetString(3);
                    }
                    else
                    {
                        retorno = 0;
                    }
                }
                else
                {
                    msgInfo msg = new msgInfo(1, "IMPOSSÍVEL ESTABELECER CONEXÃO"); msg.ShowDialog();
                    retorno = 0;
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                if (banco1 != null)
                {
                    banco1.fechaConexao();
                }
            }
        }
Exemple #5
0
        //###############End Properties

        //####################Procedimento de banco################################
        public void conectorPDV_find_consulta()
        {
            texto  = " select ";
            texto += " tab.idCliente AS Codigo, ";
            texto += " if(tab.idtipoPessoa != 3, if(tab.idtipoPessoa=1,(tab1.nome),tab2.razao),tab3.nome) as 'Nome', ";
            texto += " mid(tab6.ddd,1,4) as DDD, ";
            texto += " tab6.telefone as Telefone ";
            texto += " from ";
            texto += " conectorPDV.cliente tab ";
            texto += " left join conectorPDV.fone tab6 on(tab.idCliente = tab6.idCliente) ";
            texto += " left join conectorPDV.fisica tab1 on(tab.idcliente = tab1.idcliente) ";
            texto += " left join conectorPDV.juridica tab2 on(tab.idcliente = tab2.idcliente) ";
            texto += " left join (select rural.idcliente,rural.cpf as cpf_1,rural.nome,rural.nascimento,rural.ie,rural.idsexo,rural.identidade,rural.idcivil,sexo.descricao as sexo1,civil.descricao as civil1 from conectorPDV.rural ";
            texto += " inner join conectorPDV.sexo on(rural.idsexo = sexo.idsexo) ";
            texto += " inner join conectorPDV.civil on(rural.idcivil = civil.idcivil)) as tab3 ";
            texto += " on(tab.idcliente = tab3.idcliente) ";
            texto += " where tab6.telefone = ";
            texto += fone;
            try
            {
                banco.abreConexao();
                banco.singleTransaction(texto);
                banco.procedimentoSet();
            }
            catch (Exception erro)
            {
                msgInfo msg = new msgInfo("Caro Cliente - " + erro.Message); msg.ShowDialog(); auxConsistencia = 1;
            }
            finally
            {
                if (auxConsistencia == 0)
                {
                    dgvConsultaFone.DataSource = banco.retornaSet().Tables[0].DefaultView;
                }

                banco.fechaConexao();
                //MessageBox.Show("Carrega...", "Caro Usúario", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }