Esempio n. 1
0
        public List <Alunos> RecuperarAlunosOC(int codOc)
        {
            List <Alunos> lista = new List <Alunos>();

            _bd.Comando.Parameters.Clear();
            _bd.Comando.CommandText = @"select distinct a.alu_nome, a.alu_ra from ofertacurso o, ofertacursomodulo ocm, alunos_ofertacursomodulo ao, alunos a
                                        where 
                                        ocm.oc_cod = o.oc_cod and
                                        ao.ocm_cod = ocm.ocm_cod and
                                        a.alu_ra = ao.alu_ra and
                                        o.oc_cod = @cod";
            _bd.Comando.Parameters.Add("@cod", codOc);
            DataTable dt = _bd.ExecutarComando();

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow item in dt.Rows)
                {
                    Alunos alu = new Alunos()
                    {
                        _nome = item["alu_nome"].ToString(),
                        _ra   = Convert.ToInt32(item["alu_ra"]),
                    };
                    lista.Add(alu);
                }
            }
            return(lista);
        }
Esempio n. 2
0
        public List <Alunos> RecuperarCidades()
        {
            List <Alunos> Lista = new List <Alunos>();

            _bd.Comando.CommandText = @"select distinct alu_cidade from alunos";
            DataTable dt = _bd.ExecutarComando();

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow item in dt.Rows)
                {
                    Alunos a = new Alunos();
                    {
                        a.Cidade = item["alu_cidade"].ToString();
                    }
                    Lista.Add(a);
                }
            }
            return(Lista);
        }
Esempio n. 3
0
        public List <Alunos> PesqAlunos()
        {
            List <Alunos> ListaAlunos = new List <Alunos>();

            _bd.Comando.Parameters.Clear();
            _bd.Comando.CommandText = @"select alu_ra, alu_nome, alu_dtnasc from alunos
                                        where alu_nome like @nome";
            _bd.Comando.Parameters.Add("@nome", "%" + this._nome + "%");
            DataTable dt = _bd.ExecutarComando();

            foreach (DataRow item in dt.Rows)
            {
                Alunos alu = new Alunos()
                {
                    _ra     = Convert.ToInt32(item["alu_ra"]),
                    _nome   = item["alu_nome"].ToString(),
                    _dtNasc = Convert.ToDateTime(item["alu_dtnasc"])
                };
                ListaAlunos.Add(alu);
            }

            return(ListaAlunos);
        }