Пример #1
0
        public Retorno Listar(ParametrosOrdenacaoPaginacao parametros)
        {
            try
            {
                List <Jogo> Jogos = new List <Jogo>();

                CommandSQL = new StringBuilder();
                CommandSQL.AppendLine("SELECT ");
                CommandSQL.AppendLine("TB_JOGO.CODIGO, ");
                CommandSQL.AppendLine("TB_JOGO.DESCRICAO ");
                CommandSQL.AppendLine("FROM TB_JOGO ");

                CommandSQL.AppendLine("ORDER BY DESCRICAO ");
                CommandSQL.AppendLine("OFFSET @INICIO ROWS FETCH NEXT @QUANTIDADE ROWS ONLY ");

                Command = CriaComandoSQL(CommandSQL.ToString());
                Abrir();
                Command.Parameters.AddWithValue("@QUANTIDADE", parametros.Quantidade);
                Command.Parameters.AddWithValue("@INICIO", parametros.Inicio);
                Reader = Command.ExecuteReader();
                while (Reader.Read())
                {
                    Jogos.Add(FillEntity(Reader));
                }
                return(new Retorno(Jogos));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { Fechar(); }
        }
Пример #2
0
        public Retorno Pesquisar(Pessoa Entity, ParametrosOrdenacaoPaginacao parametros)
        {
            try
            {
                List <Pessoa> Pessoas = new List <Pessoa>();

                CommandSQL = new StringBuilder();
                CommandSQL.AppendLine("SELECT ");
                CommandSQL.AppendLine("TB_PESSOA.CODIGO, ");
                CommandSQL.AppendLine("TB_PESSOA.NOME, ");
                CommandSQL.AppendLine("TB_PESSOA.APELIDO ");
                CommandSQL.AppendLine("FROM TB_PESSOA ");
                CommandSQL.AppendLine("WHERE (TB_PESSOA.NOME LIKE '%" + Entity.Nome + "%' )");

                CommandSQL.AppendLine("ORDER BY NOME ");
                CommandSQL.AppendLine("OFFSET @INICIO ROWS FETCH NEXT @QUANTIDADE ROWS ONLY ");

                Command = CriaComandoSQL(CommandSQL.ToString());
                Abrir();
                Command.Parameters.AddWithValue("@QUANTIDADE", parametros.Quantidade);
                Command.Parameters.AddWithValue("@INICIO", parametros.Inicio);
                Reader = Command.ExecuteReader();
                while (Reader.Read())
                {
                    Pessoas.Add(FillEntity(Reader));
                }
                return(new Retorno(Pessoas));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { Fechar(); }
        }
Пример #3
0
 public Retorno Listar(ParametrosOrdenacaoPaginacao parametros)
 {
     try
     {
         return(new DataPessoaJogo().Listar(parametros));
     }
     catch (Exception ex)
     {
         return(Retorno.CriarRetornoExcecao(ex));
     }
 }
 public Retorno Pesquisar(Pessoa Entity, ParametrosOrdenacaoPaginacao parametros)
 {
     try
     {
         return(new DataPessoa().Pesquisar(Entity, parametros));
     }
     catch (Exception ex)
     {
         return(Retorno.CriarRetornoExcecao(ex));
     }
 }
Пример #5
0
        public Retorno Pesquisar(PessoaJogo Entity, ParametrosOrdenacaoPaginacao parametros)
        {
            try
            {
                List <PessoaJogo> PessoaJogos = new List <PessoaJogo>();



                CommandSQL = new StringBuilder();
                CommandSQL.AppendLine("SELECT ");
                CommandSQL.AppendLine("TB_PESSOA_JOGO.CODIGO AS CODIGO_PESSOA_JOGO, ");
                CommandSQL.AppendLine("TB_PESSOA_JOGO.DATA, ");
                CommandSQL.AppendLine("TB_PESSOA.CODIGO AS CODIGO_PESSOA, ");
                CommandSQL.AppendLine("TB_PESSOA.NOME, ");
                CommandSQL.AppendLine("TB_PESSOA.APELIDO, ");
                CommandSQL.AppendLine("TB_JOGO.CODIGO AS CODIGO_JOGO, ");
                CommandSQL.AppendLine("TB_JOGO.DESCRICAO ");
                CommandSQL.AppendLine("FROM TB_PESSOA_JOGO ");
                CommandSQL.AppendLine("INNER JOIN TB_PESSOA ON ");
                CommandSQL.AppendLine("TB_PESSOA_JOGO.CODIGO_PESSOA = TB_PESSOA.CODIGO ");
                CommandSQL.AppendLine("INNER JOIN TB_JOGO ON ");
                CommandSQL.AppendLine("TB_PESSOA_JOGO.CODIGO_JOGO = TB_JOGO.CODIGO ");
                CommandSQL.AppendLine("WHERE TB_PESSOA.NOME LIKE @NOME_PESSOA ");
                CommandSQL.AppendLine("AND TB_JOGO.DESCRICAO LIKE @DESCRICAO_JOGO ");

                CommandSQL.AppendLine("ORDER BY DESCRICAO ");
                CommandSQL.AppendLine("OFFSET @INICIO ROWS FETCH NEXT @QUANTIDADE ROWS ONLY ");

                Command = CriaComandoSQL(CommandSQL.ToString());
                Abrir();
                Command.Parameters.AddWithValue("@QUANTIDADE", parametros.Quantidade);
                Command.Parameters.AddWithValue("@INICIO", parametros.Inicio);
                Command.Parameters.AddWithValue("@NOME_PESSOA", "%" + Entity.Pessoa.Nome.Trim() + "%");
                Command.Parameters.AddWithValue("@DESCRICAO_JOGO", "%" + Entity.Jogo.Descricao.Trim() + "%");
                Reader = Command.ExecuteReader();
                while (Reader.Read())
                {
                    PessoaJogos.Add(FillEntity(Reader));
                }
                return(new Retorno(PessoaJogos));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { Fechar(); }
        }
Пример #6
0
        public Retorno Pesquisar(PessoaJogo Entity, ParametrosOrdenacaoPaginacao parametros)
        {
            try
            {
                var retorno = new DataPessoaJogo().Pesquisar(Entity, parametros);

                if (retorno.IsValido)
                {
                    retorno.Entity = ConverterParaResultadoDataTables <PessoaJogo>(retorno, new DataPessoaJogo().PesquisarQuantidadeTotal(Entity).Entity.ConverteValor(0));
                }

                return(retorno);
            }
            catch (Exception ex)
            {
                return(Retorno.CriarRetornoExcecao(ex));
            }
        }
        public Retorno Listar(ParametrosOrdenacaoPaginacao parametros)
        {
            try
            {
                var retorno = new DataPessoa().Listar(parametros);

                if (retorno.IsValido)
                {
                    retorno.Entity = ConverterParaResultadoDataTables <Pessoa>(retorno, RecuperarTotalRegistros("TB_PESSOA", "CODIGO", String.Empty).Entity.ConverteValor(0));
                }

                return(retorno);
            }
            catch (Exception ex)
            {
                return(Retorno.CriarRetornoExcecao(ex));
            }
        }
Пример #8
0
        public Retorno Pesquisar(Login Entity, ParametrosOrdenacaoPaginacao parametros)
        {
            try
            {
                List <Login> Logins = new List <Login>();

                CommandSQL = new StringBuilder();
                CommandSQL.AppendLine("SELECT ");
                CommandSQL.AppendLine("TB_LOGIN.CODIGO AS CODIGO_LOGIN, ");
                CommandSQL.AppendLine("TB_LOGIN.USUARIO, ");
                CommandSQL.AppendLine("TB_LOGIN.SENHA, ");
                CommandSQL.AppendLine("TB_PESSOA.CODIGO AS CODIGO_PESSOA, ");
                CommandSQL.AppendLine("TB_PESSOA.NOME, ");
                CommandSQL.AppendLine("TB_PESSOA.APELIDO ");
                CommandSQL.AppendLine("FROM TB_LOGIN ");
                CommandSQL.AppendLine("INNER JOIN TB_PESSOA ON ");
                CommandSQL.AppendLine("TB_LOGIN.CODIGO_PESSOA = TB_PESSOA.CODIGO ");
                CommandSQL.AppendLine("WHERE (TB_LOGIN.USUARIO LIKE '%" + Entity.Usuario + "%' )");

                CommandSQL.AppendLine("ORDER BY USUARIO ");
                CommandSQL.AppendLine("OFFSET @INICIO ROWS FETCH NEXT @QUANTIDADE ROWS ONLY ");

                Command = CriaComandoSQL(CommandSQL.ToString());
                Abrir();
                Command.Parameters.AddWithValue("@QUANTIDADE", parametros.Quantidade);
                Command.Parameters.AddWithValue("@INICIO", parametros.Inicio);
                Reader = Command.ExecuteReader();
                while (Reader.Read())
                {
                    Logins.Add(FillEntity(Reader));
                }
                return(new Retorno(Logins));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { Fechar(); }
        }