Example #1
0
    public static DataSet SelectContatos(int pes_cod)
    {
        DataSet ds = new DataSet();

        try
        {
            IDbConnection objConexao;
            IDbCommand    objComando;
            IDataAdapter  objDataAdapter;
            objConexao = Mapped.Connection();

            string sql = "select * from con_contato where pes_cod=?pes_cod;";

            objComando = Mapped.Command(sql, objConexao);
            objComando.Parameters.Add(Mapped.Parameter("?pes_cod", pes_cod));
            objDataAdapter = Mapped.Adapter(objComando);
            objDataAdapter.Fill(ds);
            objConexao.Close();
            objComando.Dispose();
            objConexao.Dispose();
            return(ds);
        }
        catch
        {
            return(ds = null);
        }
    }
Example #2
0
    public static DataSet SelectAdicinoalAdmin()
    {
        DataSet ds = new DataSet();

        try
        {
            IDbConnection objConexao;
            IDbCommand    objComando;
            IDataAdapter  objDataAdapter;
            objConexao = Mapped.Connection();

            string sql = "select * from mod_modulo where mod_padrao <> 1;";

            objComando     = Mapped.Command(sql, objConexao);
            objDataAdapter = Mapped.Adapter(objComando);
            objDataAdapter.Fill(ds);
            objConexao.Close();
            objComando.Dispose();
            objConexao.Dispose();
            return(ds);
        }
        catch
        {
            return(ds = null);
        }
    }
    public static DataSet SelectAll()
    {
        try
        {
            DataSet       ds = new DataSet();
            IDbConnection objConexao;
            IDbCommand    objCommand;
            IDataAdapter  dataAdapter;
            objConexao = Mapped.Connection();

            string query = "select * from usr_Usuario";
            objCommand  = Mapped.Command(query, objConexao);
            dataAdapter = Mapped.Adapter(objCommand);
            dataAdapter.Fill(ds);

            objConexao.Close();
            objConexao.Dispose();
            objCommand.Dispose();

            return(ds);
        }
        catch (Exception error)
        {
            return(null);
        }
    }
Example #4
0
    public static int selectAcessorio(string acessorio)
    {
        int status = 0;

        try
        {
            DataSet       ds = new DataSet();
            IDbConnection conexao;
            IDbCommand    command;
            IDataAdapter  dataAdapter;
            conexao = Mapped.Connection();
            string query = "select ace_id as id from acessorios where ace_nome = ?ace_nome;";

            command     = Mapped.Command(query, conexao);
            dataAdapter = Mapped.Adapter(command);

            command.Parameters.Add(Mapped.Parameter("?ace_nome", acessorio));

            dataAdapter.Fill(ds);
            conexao.Close();
            conexao.Dispose();
            command.Dispose();

            return(Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString()));
        }
        catch (Exception)
        {
            return(status = -1);
        }
    }
Example #5
0
    public static int deleteVeiculo_Acessorio_Relation(string id)
    {
        int status = 0;

        try
        {
            DataSet       ds = new DataSet();
            IDbConnection conexao;
            IDbCommand    command;
            IDataAdapter  dataAdapter;
            conexao = Mapped.Connection();
            string query = "delete from veiculo_acessorio where vei_id = ?vei_id;";

            command     = Mapped.Command(query, conexao);
            dataAdapter = Mapped.Adapter(command);
            command.Parameters.Add(Mapped.Parameter("?vei_id", id));


            dataAdapter.Fill(ds);
            conexao.Close();
            conexao.Dispose();
            command.Dispose();

            return(status);
        }
        catch (Exception ex)
        {
            return(status = -1);
        }
    }
Example #6
0
    public static DataSet SelectPerfilAud()
    {
        DataSet ds = new DataSet();

        try
        {
            IDbConnection objConexao;
            IDbCommand    objComando;
            IDataAdapter  objDataAdapter;
            objConexao = Mapped.Connection();

            string sql = "select aud_cod, aud_funcionario, pes_nome as funcionario, pes_sobrenome as sobrenome, " +
                         "fun_matricula as matricula, " +
                         "aud_tabela, aud_acao as acao, aud_campoNome as campo, aud_tabela as tabela, aud_data as dataAcao, aud_data as dataHora " +
                         "from aud_auditoria " +
                         "inner join fun_funcionario on fun_cod = aud_funcionario inner " +
                         "join pes_pessoa using (pes_cod)" +
                         "order by dataAcao desc LIMIT 4;";

            objComando     = Mapped.Command(sql, objConexao);
            objDataAdapter = Mapped.Adapter(objComando);
            objDataAdapter.Fill(ds);
            objConexao.Close();
            objComando.Dispose();
            objConexao.Dispose();
            return(ds);
        }
        catch
        {
            return(ds = null);
        }
    }
Example #7
0
        public DataSet BuscaCliente(int codigo, string busca)
        {
            DataSet       ds = new DataSet();
            IDbConnection objConexao;
            IDbCommand    objCommand;
            IDataAdapter  objDataAdapter;

            busca = "%" + busca + "%";

            string sql = "SELECT CASE P.PES_ATIVO WHEN 1 THEN 'ATIVO' WHEN 0 THEN 'DESATIVADO' END AS ATIVO,  concat(ifnull(P.PES_CPF, ''), ifnull(P.PES_cnpj,'')) AS DOCS, P.*, C.*, N.* FROM PES_PESSOA P INNER JOIN CON_CONTATO C ON (P.CON_CODIGO = C.CON_CODIGO) INNER JOIN NIV_NIVEL N ON(P.NIV_CODIGO = N.NIV_CODIGO) WHERE P.NIV_CODIGO in (3, 4) AND C.PES_CODIGO = ?codigo AND C.CON_NOME LIKE ?nome OR C.CON_CELULAR LIKE ?celular OR C.CON_TELEFONE LIKE ?telefone OR P.PES_CPF LIKE ?cpf OR P.PES_CNPJ LIKE ?cnpj;";

            objConexao     = Mapped.Connection();
            objCommand     = Mapped.Command(sql, objConexao);
            objDataAdapter = Mapped.Adapter(objCommand);
            objCommand.Parameters.Add(Mapped.Parameter("?codigo", codigo));
            objCommand.Parameters.Add(Mapped.Parameter("?nome", busca));
            objCommand.Parameters.Add(Mapped.Parameter("?celular", busca));
            objCommand.Parameters.Add(Mapped.Parameter("?telefone", busca));
            objCommand.Parameters.Add(Mapped.Parameter("?cpf", busca));
            objCommand.Parameters.Add(Mapped.Parameter("?cnpj", busca));
            objDataAdapter.Fill(ds);

            objConexao.Close();
            objCommand.Dispose();
            objConexao.Dispose();
            return(ds);
        }
Example #8
0
    public static DataSet SelectNomProcesso(string pes_nome)
    {
        DataSet       ds = new DataSet();
        IDbConnection objConexao;
        IDbCommand    objComando;
        IDataAdapter  objDataAdapter;

        objConexao = Mapped.Connection();

        string sql = "select pes.pes_nome, fun.fun_matricula, pro.pro_cod, pro.pro_numeroProcesso, pro.pro_numeroProtocolo, pro.pro_dataPedido, " +
                     "mrq.mrq_descricao, dpr.dpr_dataInicio, " +
                     "dpr.dpr_dataFinalizar, tra.tra_localAtual, sta.sta_valor from Pro_Processo as pro " +
                     "inner join Mrq_ModeloRequerimento as mrq on pro.mrq_cod = mrq.mrq_cod " +
                     "inner join Dpr_DetalheProcesso as dpr on dpr.pro_cod = pro.pro_cod " +
                     "inner join Tra_Tramitacao as tra on tra.pro_cod = pro.pro_cod " +
                     "inner join Sta_Status as sta on sta.sta_cod = pro.sta_cod " +
                     "inner join Fun_Funcionario as fun on fun.fun_cod = tra.fun_cod " +
                     "inner join Pes_Pessoa as pes on pes.pes_cod = fun.pes_cod " +
                     "where pes.pes_nome = ?pes_nome" +
                     " order by pro.pro_cod;";

        objComando = Mapped.Command(sql, objConexao);
        objComando.Parameters.Add(Mapped.Parameter("?pes_nome", pes_nome));
        objComando.ExecuteNonQuery();
        objDataAdapter = Mapped.Adapter(objComando);
        objDataAdapter.Fill(ds);
        objComando.Dispose();
        objConexao.Dispose();
        objConexao.Close();
        return(ds);
    }
Example #9
0
    public static DataSet SelectAllPendente()
    {
        DataSet       ds = new DataSet();
        IDbConnection objConexao;
        IDbCommand    objComando;
        IDataAdapter  objDataAdapter;

        objConexao = Mapped.Connection();

        string sql = @"select pro.pro_cod, concat(pep.pes_nome,' ', pep.pes_sobrenome) as redator, fup.fun_matricula as matriculaRedator, pro.pro_numeroProcesso as numeroProcesso, 
                        concat(per.pes_nome,' ', per.pes_sobrenome) as requerente, pro.pro_dataPedido as dataPedido, mrq.mrq_descricao as modelo, 
                            dpr.dpr_datafinalizar as dataFinalizar, concat(pes.pes_nome,' ', pes.pes_sobrenome) as portador, fun.fun_matricula as matriculaPortador, sta.sta_valor as situacao, tra.tra_localAtual as localAtual 
                                from pro_processo as pro inner join sta_status as sta on sta.sta_cod = pro.sta_cod 
                                    inner join mrq_modeloRequerimento as mrq on mrq.mrq_cod = pro.mrq_cod 
                                        inner join dpr_detalheProcesso as dpr on dpr.pro_cod = pro.pro_cod inner join tra_tramitacao as tra on tra.dpr_cod = dpr.dpr_cod 
                                            inner join fun_funcionario as fun on fun.fun_cod = tra.fun_cod 
                                                inner join pes_pessoa as pes on pes.pes_cod = fun.pes_cod inner join pro_fun as prf on prf.pro_cod = pro.pro_cod 
                                                    inner join fun_funcionario as fup on fup.fun_cod = prf.fun_cod inner join pes_pessoa as pep on pep.pes_cod = fup.pes_cod 
                                                        inner join req_requerente as req on req.req_cod = pro.req_cod inner join pes_pessoa as per on per.pes_cod = req.pes_cod 
															where sta.sta_valor = 'Pendente'
																order by pro.pro_cod desc;"                                                                ;

        objComando     = Mapped.Command(sql, objConexao);
        objDataAdapter = Mapped.Adapter(objComando);
        objDataAdapter.Fill(ds);
        objConexao.Close();
        objComando.Dispose();
        objConexao.Dispose();
        return(ds);
    }
Example #10
0
    public static DataSet SelectMenu(int fun_cod)
    {
        DataSet ds = null;

        try
        {
            ds = new DataSet();
            IDbConnection objConexao;
            IDbCommand    objComando;
            IDataAdapter  objDataAdapter;
            objConexao = Mapped.Connection();

            string sql = "select mod_descricao, mod_pagina from fun_funcionario inner join fun_mod using(fun_cod) " +
                         "inner join mod_modulo using (mod_cod) where fun_cod=?fun_cod; ";

            objComando = Mapped.Command(sql, objConexao);
            objComando.Parameters.Add(Mapped.Parameter("?fun_cod", fun_cod));
            objDataAdapter = Mapped.Adapter(objComando);
            objDataAdapter.Fill(ds);
            objConexao.Close();
            objComando.Dispose();
            objConexao.Dispose();
            return(ds);
        }
        catch
        {
            return(ds = null);
        }
    }
Example #11
0
    public static DataSet SelectIndex(string nome)
    {
        DataSet       ds = new DataSet();
        IDbConnection objConexao;
        IDbCommand    objComando;
        IDataAdapter  objDataAdapter;

        objConexao = Mapped.Connection();

        string sql = "select pro.pro_numeroProcesso as numeroProcesso, mrq.mrq_descricao as modelo, pes.pes_nome as redator, fun.fun_matricula as matriculaRed, " +
                     "sta.sta_valor as staValor, pep.pes_nome as portador from pro_processo as pro inner join mrq_modeloRequerimento as mrq using (mrq_cod) " +
                     "inner join pro_fun using (pro_cod) inner join fun_funcionario as fun using (fun_cod) inner join pes_pessoa as pes using (pes_cod) " +
                     "inner join sta_status as sta using (sta_cod) inner join dpr_detalheProcesso using (pro_cod) inner join tra_tramitacao as tra using (dpr_cod) " +
                     "inner join fun_funcionario as fup on fup.fun_cod = tra.fun_cod inner join pes_pessoa as pep on pep.pes_cod = fup.pes_cod " +
                     "where pep.pes_nome = ?nome;";

        objComando = Mapped.Command(sql, objConexao);
        objComando.Parameters.Add(Mapped.Parameter("?nome", nome));
        objDataAdapter = Mapped.Adapter(objComando);
        objComando.ExecuteNonQuery();
        objDataAdapter.Fill(ds);
        objConexao.Close();
        objComando.Dispose();
        objConexao.Dispose();
        return(ds);
    }
Example #12
0
        public DataSet SomaDespesa(DateTime data1, DateTime data2)
        {
            DataSet ds = new DataSet();

            System.Data.IDbConnection objConexao;
            System.Data.IDbCommand    objCommand;
            System.Data.IDataAdapter  objDataAdapter;

            string sql = "select sum(tbl_despesas.DES_CUSTO) as total from tbl_despesas inner join tbl_categoriadespesas on tbl_despesas.CAD_CODIGO = tbl_categoriadespesas.CAD_CODIGO where tbl_despesas.DES_DATADESPESA between ?data1 and ?data2";

            objConexao     = Mapped.Connection();
            objCommand     = Mapped.Command(sql, objConexao);
            objDataAdapter = Mapped.Adapter(objCommand);
            objCommand.Parameters.Add(Mapped.Parameter("?data1", data1));
            objCommand.Parameters.Add(Mapped.Parameter("?data2", data2));

            objDataAdapter.Fill(ds);

            objConexao.Close();

            objCommand.Dispose();
            objConexao.Dispose();

            return(ds);
        }
Example #13
0
        public DataSet SelectAllByState(int estado)
        {
            DataSet ds = new DataSet();

            System.Data.IDbConnection objConexao;
            System.Data.IDbCommand    objCommand;
            System.Data.IDataAdapter  objDataAdapter;

            objConexao = Mapped.Connection();
            string sql = "SELECT * FROM TBL_CIDADES WHERE EST_CODIGO=?codigo ORDER BY CID_DESCRICAO";

            objCommand = Mapped.Command(sql, objConexao);
            objCommand.Parameters.Add(Mapped.Parameter("?codigo", estado));


            objDataAdapter = Mapped.Adapter(objCommand);

            objDataAdapter.Fill(ds);

            objConexao.Close();

            objCommand.Dispose();
            objConexao.Dispose();

            return(ds);
        }
Example #14
0
    public static DataSet SelectContatoEmail(string box)
    {
        DataSet ds = new DataSet();

        try
        {
            IDbConnection objConexao;
            IDbCommand    objComando;
            IDataAdapter  objDataAdapter;
            objConexao = Mapped.Connection();

            string sql = "select con_valor from con_contato where con_valor = ?email;";

            objComando = Mapped.Command(sql, objConexao);
            objComando.Parameters.Add(Mapped.Parameter("?email", box));
            objDataAdapter = Mapped.Adapter(objComando);
            objDataAdapter.Fill(ds);
            objConexao.Close();
            objComando.Dispose();
            objConexao.Dispose();
            return(ds);
        }
        catch
        {
            return(ds = null);
        }
    }
Example #15
0
    public static int selectUser(Usuario user)
    {
        try
        {
            DataSet       ds = new DataSet();
            IDbConnection conexao;
            IDbCommand    command;
            IDataAdapter  dataAdapter;
            conexao = Mapped.Connection();
            string query = "select usu_id as id  from usuario where usu_senha = ?usu_senha and usu_email = ?usu_email;";

            command     = Mapped.Command(query, conexao);
            dataAdapter = Mapped.Adapter(command);
            command.Parameters.Add(Mapped.Parameter("?usu_senha", user.Usu_senha));
            command.Parameters.Add(Mapped.Parameter("?usu_email", user.Usu_email));


            dataAdapter.Fill(ds);
            conexao.Close();
            conexao.Dispose();
            command.Dispose();
            if (Convert.ToInt32(ds.Tables[0].Rows[0]["id"]) > 0)
            {
                return(Convert.ToInt32(ds.Tables[0].Rows[0]["id"]));
            }
            else
            {
                return(0);
            }
        }
        catch (Exception e)
        {
            return(0);
        }
    }
    public static DataSet SelectNaoPraticados(Pra_Pratica pra)
    {
        DataSet       ds = new DataSet();
        IDbConnection objConnection;
        IDbCommand    objCommand;
        IDataAdapter  objDataDadapter;

        objConnection = Mapped.Connection();
        string sql = "select esp_nome, esp_logo, esp_codigo from esp_esportes where esp_codigo";

        sql += " not in (select esp_codigo from pra_pratica where pef_codigo = ?pef_codigo );";

        objCommand = Mapped.Command(sql, objConnection);

        objCommand.Parameters.Add(Mapped.Parameter("?pef_codigo", pra.Pef_codigo.Pef_codigo));


        objDataDadapter = Mapped.Adapter(objCommand);
        objDataDadapter.Fill(ds);

        objConnection.Close();
        objCommand.Dispose();
        objConnection.Dispose();
        return(ds);
    }
Example #17
0
    public static DataSet SelectAll()
    {
        DataSet ds = new DataSet();

        try
        {
            IDbConnection objConexao;
            IDbCommand    objComando;
            IDataAdapter  objDataAdapter;
            objConexao = Mapped.Connection();

            string sql = "select aud_cod, aud_funcionario, pes_nome as funcionario, pes_sobrenome as sobrenome, " +
                         "fun_matricula as matricula, " +
                         "aud_tabela, aud_acao as acao, aud_campoNome as campo, aud_tabela as tabela, aud_data as dataAcao, aud_data as dataHora " +
                         "from aud_auditoria " +
                         "inner join fun_funcionario on fun_cod = aud_funcionario inner " +
                         "join pes_pessoa using (pes_cod)" +
                         "where aud_tabela <> 'Funcionário Processo' and aud_tabela <> " +
                         "'Detalhe Processo' and aud_tabela <> 'Funcionário Modulo' " +
                         "and aud_tabela <> 'Contato';";

            objComando     = Mapped.Command(sql, objConexao);
            objDataAdapter = Mapped.Adapter(objComando);
            objDataAdapter.Fill(ds);
            objConexao.Close();
            objComando.Dispose();
            objConexao.Dispose();
            return(ds);
        }
        catch
        {
            return(ds = null);
        }
    }
Example #18
0
    public static int BuscarQtdItensAtivos(Usuario usuario)
    {
        DataSet       ds = new DataSet();
        IDbConnection objConexao;
        IDbCommand    objCommand;
        IDataAdapter  dataAdapter;

        objConexao = Mapped.Connection();

        string query = "";

        query += " SELECT ";
        query += " 	COUNT(pro_id) qtd ";
        query += " FROM ";
        query += " 	produtos ";
        query += " WHERE ";
        query += " 	emp_id = ?emp_id ";
        query += " 	AND pro_status = ?status ";

        objCommand = Mapped.Command(query, objConexao);
        objCommand.Parameters.Add(Mapped.Parameter("?emp_id", usuario.Emp_id));
        objCommand.Parameters.Add(Mapped.Parameter("?status", StatusProdutoEnum.DISPONIVEL));
        dataAdapter = Mapped.Adapter(objCommand);
        dataAdapter.Fill(ds);

        objConexao.Close();
        objConexao.Dispose();
        objCommand.Dispose();

        int qtd = !ds.Tables[0].Rows[0]["qtd"].ToString().Equals("") ? Convert.ToInt32(ds.Tables[0].Rows[0]["qtd"]) : 0;

        return(qtd);
    }
Example #19
0
    public static DataSet SelectAll()
    {
        DataSet ds = new DataSet();

        try
        {
            IDbConnection objConexao;
            IDbCommand    objComando;
            IDataAdapter  objDataAdapter;
            objConexao = Mapped.Connection();

            string sql = "select * from car_cargo where car_descricao <> 'Administrador';";

            objComando     = Mapped.Command(sql, objConexao);
            objDataAdapter = Mapped.Adapter(objComando);
            objDataAdapter.Fill(ds);
            objConexao.Close();
            objComando.Dispose();
            objConexao.Dispose();
            return(ds);
        }
        catch
        {
            return(ds = null);
        }
    }
Example #20
0
    public static int BuscarQtdItensVendidos(Usuario usuario)
    {
        DataSet       ds = new DataSet();
        IDbConnection objConexao;
        IDbCommand    objCommand;
        IDataAdapter  dataAdapter;

        objConexao = Mapped.Connection();

        string query = "";

        query += " SELECT ";
        query += " 	 SUM(mov.mfi_qtdprod) qtd ";
        query += " FROM ";
        query += " 	movfinanceira mov ";
        query += " WHERE ";
        query += " 	mov.emp_id = ?emp_id ";

        objCommand = Mapped.Command(query, objConexao);
        objCommand.Parameters.Add(Mapped.Parameter("?emp_id", usuario.Emp_id));
        dataAdapter = Mapped.Adapter(objCommand);
        dataAdapter.Fill(ds);

        objConexao.Close();
        objConexao.Dispose();
        objCommand.Dispose();

        int qtd = !ds.Tables[0].Rows[0]["qtd"].ToString().Equals("") ? Convert.ToInt32(ds.Tables[0].Rows[0]["qtd"]) : 0;

        return(qtd);
    }
Example #21
0
    public static DataSet SelectAll()
    {
        DataSet ds = new DataSet();

        try
        {
            IDbConnection objConexao;
            IDbCommand    objComando;
            IDataAdapter  objDataAdapter;
            objConexao = Mapped.Connection();

            string sql = "select * from fun_funcionario;";

            objComando     = Mapped.Command(sql, objConexao);
            objDataAdapter = Mapped.Adapter(objComando);
            objDataAdapter.Fill(ds);
            objConexao.Close();
            objComando.Dispose();
            objConexao.Dispose();
            return(ds);
        }
        catch
        {
            return(ds = null);
        }
    }
Example #22
0
    public static DataSet BuscarCompradoresPorIdDoProduto(int id)
    {
        DataSet       ds = new DataSet();
        IDbConnection objConexao;
        IDbCommand    objCommand;
        IDataAdapter  dataAdapter;

        objConexao = Mapped.Connection();

        string query = "";

        query += " SELECT  ";
        query += " 	usu.usu_nome usu_nome, ";
        query += " 	seto.set_nome set_nome,";
        query += " 	mov.mfi_dhCompra mfi_data";
        query += " FROM ";
        query += " 	movfinanceira mov ";
        query += " 	JOIN usuario usu ON usu.usu_id = mov.usu_id ";
        query += " 	JOIN setor seto ON seto.set_id = usu.set_id ";
        query += " WHERE ";
        query += " 	mov.pro_id = ?pro_id ";

        objCommand = Mapped.Command(query, objConexao);
        objCommand.Parameters.Add(Mapped.Parameter("?pro_id", id));
        dataAdapter = Mapped.Adapter(objCommand);
        dataAdapter.Fill(ds);

        objConexao.Close();
        objConexao.Dispose();
        objCommand.Dispose();

        return(ds);
    }
Example #23
0
    public static int selectModelo(Veiculo vei)
    {
        int status = 0;

        try
        {
            DataSet       ds = new DataSet();
            IDbConnection conexao;
            IDbCommand    command;
            IDataAdapter  dataAdapter;
            conexao = Mapped.Connection();
            string query = "select mod_id as id from modelo where mod_marca = ?mod_marca and mod_nome = ?mod_nome;";

            command     = Mapped.Command(query, conexao);
            dataAdapter = Mapped.Adapter(command);
            command.Parameters.Add(Mapped.Parameter("?mod_marca", vei.Mod_marca));
            command.Parameters.Add(Mapped.Parameter("?mod_nome", vei.Mod_modelo));

            dataAdapter.Fill(ds);
            conexao.Close();
            conexao.Dispose();
            command.Dispose();

            return(Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString()));
        }
        catch (Exception)
        {
            return(status = -1);
        }
    }
Example #24
0
    public static string selectHashConf(int id)
    {
        try
        {
            DataSet       ds = new DataSet();
            IDbConnection conexao;
            IDbCommand    command;
            IDataAdapter  dataAdapter;
            conexao = Mapped.Connection();
            string query = "select usu_confirmacao as conf from usuario where usu_id = ?usu_id;";

            command = Mapped.Command(query, conexao);
            command.Parameters.Add(Mapped.Parameter("?usu_id", id));
            dataAdapter = Mapped.Adapter(command);



            dataAdapter.Fill(ds);
            conexao.Close();
            conexao.Dispose();
            command.Dispose();


            return(ds.Tables[0].Rows[0]["conf"].ToString());
        }
        catch (Exception e)
        {
            return("0");
        }
    }
Example #25
0
        /// <summary>
        /// Metodo que busca no banco todos as maquinas que estao ativas
        /// </summary>
        /// <returns>Dataset com todas as maquinas</returns>
        public DataSet SelectAll(bool ativado = false)
        {
            DataSet ds = new DataSet();

            System.Data.IDbConnection objConexao;
            System.Data.IDbCommand    objCommand;
            System.Data.IDataAdapter  objDataAdapter;

            objConexao = Mapped.Connection();
            if (ativado)
            {
                objCommand = Mapped.Command("SELECT * FROM TBL_MAQUINA WHERE MAQ_ATIVADO = 1", objConexao);
            }
            else
            {
                objCommand = Mapped.Command("SELECT * FROM TBL_MAQUINA", objConexao);
            }

            objDataAdapter = Mapped.Adapter(objCommand);
            objDataAdapter.Fill(ds);

            objConexao.Close();

            objCommand.Dispose();
            objConexao.Dispose();

            return(ds);
        }
Example #26
0
    public static Boolean selectUser2(string email)
    {
        DataSet       ds = new DataSet();
        IDbConnection conexao;
        IDbCommand    command;
        IDataAdapter  dataAdapter;

        conexao = Mapped.Connection();
        string  query = "select count(*) as existe from usuario where usu_email = ?usu_email;";
        Usuario auxu  = new Usuario();


        command     = Mapped.Command(query, conexao);
        dataAdapter = Mapped.Adapter(command);
        command.Parameters.Add(Mapped.Parameter("?usu_email", email));

        dataAdapter.Fill(ds);
        conexao.Close();
        conexao.Dispose();
        command.Dispose();

        if (Convert.ToInt32(ds.Tables[0].Rows[0]["existe"].ToString()) == 0)
        {
            return(false);
        }
        else
        {
            return(true);
        }
    }
Example #27
0
    public static DataSet ModuloUsuario(int fun_cod)
    {
        DataSet ds = new DataSet();

        try
        {
            IDbConnection objConexao;
            IDbCommand    objComando;
            IDataAdapter  objDataAdapter;
            objConexao = Mapped.Connection();

            string sql = "select * from mod_modulo inner join fun_mod using(mod_cod) where fun_cod=?fun_cod;";

            objComando = Mapped.Command(sql, objConexao);
            objComando.Parameters.Add(Mapped.Parameter("?fun_cod", fun_cod));
            objDataAdapter = Mapped.Adapter(objComando);
            objDataAdapter.Fill(ds);
            objConexao.Close();
            objComando.Dispose();
            objConexao.Dispose();
            return(ds);
        }
        catch
        {
            return(ds = null);
        }
    }
Example #28
0
    public static Boolean SelectInscricaoCaravana(int car_id, int usu_id)
    {
        DataSet       ds = new DataSet();
        IDbConnection conexao;
        IDbCommand    command;
        IDataAdapter  dataAdapter;

        conexao = Mapped.Connection();
        string query = "select count(*) as existe from cliente_caravana_status where car_id = ?car_id and cli_id = ?cli_id;";

        command     = Mapped.Command(query, conexao);
        dataAdapter = Mapped.Adapter(command);
        command.Parameters.Add(Mapped.Parameter("?car_id", car_id));
        command.Parameters.Add(Mapped.Parameter("?cli_id", usu_id));

        dataAdapter.Fill(ds);
        conexao.Close();
        conexao.Dispose();
        command.Dispose();

        if (Convert.ToInt32(ds.Tables[0].Rows[0]["existe"].ToString()) == 0)
        {
            return(false);
        }
        else
        {
            return(true);
        }
    }
Example #29
0
    public static Boolean ValidaEmail(string email)
    {
        DataSet       ds = new DataSet();
        IDbConnection objConnection;
        IDbCommand    objCommand;
        IDataAdapter  objDataAdapter;

        string sql = "select res_email from res_responsaveis where res_email = ?res_email;";

        objConnection = Mapped.Connection();
        objCommand    = Mapped.Command(sql, objConnection);

        objCommand.Parameters.Add(Mapped.Parameter("?res_email", email));

        objDataAdapter = Mapped.Adapter(objCommand);
        objDataAdapter.Fill(ds);

        objConnection.Close();
        objConnection.Dispose();
        objCommand.Dispose();

        Boolean controlador;

        if (ds.Tables[0].Rows.Count != 0)
        {
            controlador = false;
        }
        else
        {
            controlador = true;
        }

        return(controlador);
    }
Example #30
0
    public static DataSet SelectAllAtivo()
    {
        DataSet ds;

        try
        {
            ds = new DataSet();
            IDbConnection objConexao;
            IDbCommand    objComando;
            IDataAdapter  objDataAdapter;
            objConexao = Mapped.Connection();

            string sql = "select * from req_requerente inner join pes_pessoa using(pes_cod) where pes_ativo = 'Ativo';";

            objComando     = Mapped.Command(sql, objConexao);
            objDataAdapter = Mapped.Adapter(objComando);
            objDataAdapter.Fill(ds);
            objConexao.Close();
            objComando.Dispose();
            objConexao.Dispose();
            return(ds);
        }
        catch
        {
            return(ds = null);
        }
    }