Exemplo n.º 1
0
        private static List <PessoaBean> SetInstance(OracleDataReader dr)
        {
            List <PessoaBean> list = new List <PessoaBean>();

            try
            {
                while (dr.Read())
                {
                    PessoaBean obj = new PessoaBean();
                    obj.idPessoa    = Convert.ToInt32(dr["id_pessoa"].ToString());
                    obj.nome        = dr["nome"].ToString();
                    obj.apelido     = dr["apelido"].ToString();
                    obj.numDoc      = dr["num_Doc"].ToString();
                    obj.tipoDoc     = dr["tipo_Doc"].ToString();
                    obj.tel1        = dr["tel1"].ToString();
                    obj.tel2        = dr["tel2"].ToString();
                    obj.tel3        = dr["tel3"].ToString();
                    obj.logradouro  = dr["logradouro"].ToString();
                    obj.numero      = dr["numero"].ToString();
                    obj.complemento = dr["complemento"].ToString();
                    obj.bairro      = dr["bairro"].ToString();
                    obj.cep         = dr["cep"].ToString();
                    obj.pontoRef    = dr["ponto_ref"].ToString();
                    obj.obs         = dr["obs"].ToString();

                    obj.grupoPessoa = GrupoPessoaDAO.getRecord(Convert.ToInt32(dr["id_grupo_pessoa"]));

                    list.Add(obj);
                }
            }

            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (!dr.IsClosed)
                {
                    dr.Close();
                }
            }
            return(list);
        }
Exemplo n.º 2
0
        private static bool SetInstance(OracleDataReader dr, PessoaBean bean)
        {
            try
            {
                if (dr.Read())
                {
                    bean.idPessoa    = Convert.ToInt32(dr["id_pessoa"].ToString());
                    bean.nome        = dr["nome"].ToString();
                    bean.apelido     = dr["apelido"].ToString();
                    bean.numDoc      = dr["num_Doc"].ToString();
                    bean.tipoDoc     = dr["tipo_Doc"].ToString();
                    bean.tel1        = dr["tel1"].ToString();
                    bean.tel2        = dr["tel2"].ToString();
                    bean.tel3        = dr["tel3"].ToString();
                    bean.logradouro  = dr["logradouro"].ToString();
                    bean.numero      = dr["numero"].ToString();
                    bean.complemento = dr["complemento"].ToString();
                    bean.bairro      = dr["bairro"].ToString();
                    bean.cep         = dr["cep"].ToString();
                    bean.pontoRef    = dr["ponto_ref"].ToString();
                    bean.obs         = dr["obs"].ToString();

                    bean.grupoPessoa = GrupoPessoaDAO.getRecord(Convert.ToInt32(dr["id_grupo_pessoa"]));
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (!dr.IsClosed)
                {
                    dr.Close();
                }
            }
        }