Exemplo n.º 1
0
        public IEnumerable <EmpresaDto> GetAll(int?idCliente)
        {
            _conexao.ExecuteProcedure(Procedures.GKSSP_SelEmpresas);
            _conexao.AddParameter("IdCliente", idCliente);

            var empresa = new List <EmpresaDto>();

            using (var r = _conexao.ExecuteReader())
                while (r.Read())
                {
                    empresa.Add(new EmpresaDto
                    {
                        Id             = r.GetValue <int>("Id"),
                        Cnpj           = r.GetValue <decimal>("Cnpj"),
                        RazaoSocial    = r.GetValue <string>("RazaoSocial"),
                        NomeFantasia   = r.GetValue <string>("NomeFantasia"),
                        DataInativacao = r.GetValue <DateTime>("DataInativacao"),
                        Ddd            = r.GetValue <byte>("Ddd"),
                        Numero         = r.GetValue <int>("Numero"),
                        Cep            = r.GetValue <int>("Cep"),
                        NomEndereco    = r.GetValue <string>("NomEndereco"),
                        NumEndereco    = r.GetValue <int>("NumEndereco"),
                        Bairro         = r.GetValue <string>("Bairro"),
                        Complemento    = r.GetValue <string>("Complemento"),
                        Cidade         = r.GetValue <string>("Cidade"),
                        Uf             = r.GetValue <string>("Uf"),
                        NomCliente     = r.GetValue <string>("NomCliente")
                    });
                }
            return(empresa);
        }
Exemplo n.º 2
0
        public IEnumerable <ChamadoDto> Get(int?idEmpresa)
        {
            _conexao.ExecuteProcedure(Procedures.GKSSP_SelChamados);
            _conexao.AddParameter("@IdEmpresa", idEmpresa);

            var chamados = new List <ChamadoDto>();

            using (var r = _conexao.ExecuteReader())
                while (r.Read())
                {
                    chamados.Add(new ChamadoDto
                    {
                        Id              = r.GetValue <int>("Id"),
                        IdStatus        = r.GetValue <byte>("IdStatus"),
                        NumeroChamado   = r.GetValue <int>("NumeroChamado"),
                        NomeEmpresa     = r.GetValue <string>("NomeEmpresa"),
                        NomeClienteCad  = r.GetValue <string>("NomeClienteCad"),
                        NomeProblema    = r.GetValue <string>("NomeProblema"),
                        NomeCriticidade = r.GetValue <string>("NomeCriticidade"),
                        NomeTipoStatus  = r.GetValue <string>("NomeTipoStatus"),
                        DataCadastro    = r.GetValue <DateTime>("DataCadastro")
                    });
                }
            return(chamados);
        }
        public IEnumerable <TipoChamadoDto> Get()
        {
            var tiposChamado = new List <TipoChamadoDto>();

            _conexao.ExecuteProcedure(Procedures.GKSSP_SelChamadoTipos);
            using (var r = _conexao.ExecuteReader())
                while (r.Read())
                {
                    tiposChamado.Add(new TipoChamadoDto
                    {
                        Id   = r.GetValue <byte>("Id"),
                        Nome = r.GetValue <string>("Nome")
                    });
                }
            return(tiposChamado);
        }
        public IEnumerable <ChamadoTipoStatusDto> Get()
        {
            _conexao.ExecuteProcedure(Procedures.GKSSP_ChamadoTipoStatus);
            var tipoStatus = new List <ChamadoTipoStatusDto>();

            using (var r = _conexao.ExecuteReader())
                while (r.Read())
                {
                    tipoStatus.Add(new ChamadoTipoStatusDto
                    {
                        Id   = r.GetValue <byte>("Id"),
                        Nome = r.GetValue <string>("Nome")
                    });
                }

            return(tipoStatus);
        }
Exemplo n.º 5
0
 public ClienteDto Get(decimal cpf)
 {
     _conexao.ExecuteProcedure(Procedures.GKSSP_SelCliente);
     _conexao.AddParameter("Cpf", cpf);
     using (var r = _conexao.ExecuteReader())
     {
         return(!r.Read()
             ? null
             : new ClienteDto
         {
             Id = r.GetValue <int>("Id"),
             Cpf = r.GetValue <decimal>("Cpf"),
             NomeEmpresa = r.GetValue <string>("NomeEmpresa"),
             Nome = r.GetValue <string>("Nome"),
             DataCadastro = r.GetValue <DateTime>("DataCadastro"),
             NomeColaboradorCad = r.GetValue <string>("NomeColaboradorCad"),
             DataAlteracao = r.GetValue <DateTime>("DataAlteracao"),
             NomeColaboradorAlt = r.GetValue <string>("NomeColaboradorAlt"),
             DataInativacao = r.GetValue <DateTime>("DataInativacao")
         });
     }
 }