Esempio n. 1
0
        public Models.MatriculaResponse CriarResponse(Models.TbAluno Aluno)
        {
            Models.MatriculaResponse Response = new MatriculaResponse();

            Response.IdAluno = Aluno.IdAluno;
            Response.DsRg    = Aluno.DsRg;
            Response.NmAluno = Aluno.NmAluno;

            if (Aluno.TbTurmaAluno.Count > 0)
            {
                Response.CdRa       = Aluno.TbTurmaAluno.FirstOrDefault().CdRa;
                Response.DsStatus   = Aluno.TbTurmaAluno.FirstOrDefault().TpStatus;
                Response.NmTurma    = Aluno.TbTurmaAluno.FirstOrDefault().IdTurmaNavigation.NmTurma;
                Response.TpPeriudo  = Aluno.TbTurmaAluno.FirstOrDefault().IdTurmaNavigation.TpPeriodo;
                Response.NmCurso    = Aluno.TbTurmaAluno.FirstOrDefault().IdTurmaNavigation.IdCursoNavigation.NmCurso;
                Response.TurmaAluno = Aluno.TbTurmaAluno.FirstOrDefault();
            }

            Response.Aluno       = Aluno;
            Response.Documentos  = Aluno.TbAlunoDocumentos.ToList();
            Response.Localizacao = Aluno.TbAlunoLocalizacao.ToList();
            Response.FichaMedica = Aluno.TbAlunoFichaMedica.ToList();
            Response.Responsavel = Aluno.TbAlunoResponsavel.ToList();


            return(Response);
        }
Esempio n. 2
0
 public void Alterar(Models.TbAluno nova)
 {
     Models.TbAluno alunos = db.TbAluno.FirstOrDefault(t => t.IdAluno == nova.IdAluno);
     alunos.NmAluno           = nova.NmAluno;
     alunos.DsCelular         = nova.DsCelular;
     alunos.DsComoConheceu    = nova.DsComoConheceu;
     alunos.DsCpf             = nova.DsCpf;
     alunos.DsEmail           = nova.DsEmail;
     alunos.DsEscolaridade    = nova.DsEscolaridade;
     alunos.DsEtinia          = nova.DsEtinia;
     alunos.DsObservacao      = nova.DsObservacao;
     alunos.DsOrgao           = nova.DsOrgao;
     alunos.DsRg              = nova.DsRg;
     alunos.DsSexo            = nova.DsSexo;
     alunos.DtEmissao         = nova.DtEmissao;
     alunos.DtInclusao        = nova.DtInclusao;
     alunos.DtNascimento      = nova.DtNascimento;
     alunos.DtUltimaAlteracao = nova.DtUltimaAlteracao;
     alunos.NmEscola          = nova.NmEscola;
     alunos.QtMoramCasa       = nova.QtMoramCasa;
     alunos.QtTrabalhamCasa   = nova.QtTrabalhamCasa;
     alunos.VlRenda           = nova.VlRenda;
     alunos.TpEscola          = nova.TpEscola;
     db.SaveChanges();
 }
Esempio n. 3
0
        public Models.TbAluno consultar(Models.TbAluno aluno)
        {
            Models.TbAluno consulta = db.TbAluno.FirstOrDefault(x => x.NmAluno == aluno.NmAluno);


            return(consulta);
        }
Esempio n. 4
0
        public void Remover(int id)
        {
            Models.TbAluno remover = db.TbAluno
                                     .FirstOrDefault(x => x.IdAluno == id);

            db.TbAluno.Remove(remover);
            db.SaveChanges();
        }
Esempio n. 5
0
        public void Deletar(int id)
        {
            Models.TbAluno remover = db.TbAluno.FirstOrDefault(t => t.IdAluno == id);

            if (remover != null)
            {
                db.Remove(remover);
                db.SaveChanges();
            }
        }
Esempio n. 6
0
        public void Alterar(Models.TbAluno aluno)
        {
            Models.TbAluno alterado = db.TbAluno
                                      .FirstOrDefault(x => x.IdAluno == aluno.IdAluno);
            alterado.NmAluno = aluno.NmAluno;
            alterado.DsEmail = aluno.DsEmail;
            alterado.DsSenha = aluno.DsSenha;

            db.SaveChanges();
        }
Esempio n. 7
0
// validações

        private void ValidacaoAluno(Models.TbAluno aluno)
        {
            Models.TbAluno Individuo = AlunoDB.Carregar(aluno);
            int            diferença = Convert.ToInt32(DateTime.Now.Year - aluno.DtNascimento.Year);

            if (aluno.NmAluno == string.Empty)
            {
                throw new ArgumentException("O campo de Nome é obrigatorio");
            }

            if (aluno.NmEscola == string.Empty)
            {
                throw new ArgumentException("O campo Escola é obrigatorio");
            }

            else if (aluno.DsCpf.Length != 14 && aluno.DsCpf == null)
            {
                throw new ArgumentException("Este CPF esta invalido");
            }

            else if (aluno.DsEmail.Contains("@") == false && aluno.DsEmail.Contains(".com") == false)
            {
                throw new ArgumentException("Este Email esta invalido");
            }

            else if (aluno.DsEmail == string.Empty)
            {
                throw new ArgumentException("O campo de Email é obrigatorio");
            }

            else if (aluno.DsRg.Length != 10)
            {
                throw new ArgumentException("O RG esta invalido");
            }

            else if (aluno.DsRg == string.Empty)
            {
                throw new ArgumentException("O campo de RG é obrigatorio");
            }

            else if (aluno.DtEmissao == null)
            {
                throw new ArgumentException("O campo de Emissão é obrigatorio");
            }

            else if (aluno.DtNascimento == null)
            {
                throw new ArgumentException("O campo de Data de Nascimento é obrigatorio");
            }

            else if (diferença <= 14 || diferença >= 25)
            {
                throw new ArgumentException("O individuo não tem a idade necessária para ingressar no curso");
            }
        }
Esempio n. 8
0
        public void Alterar(Models.TbAluno aluno)
        {
            if (aluno.NmAluno == string.Empty)
            {
                throw new Exception("Nome é obrigatório!!");
            }

            if (aluno.DsEmail == string.Empty)
            {
                throw new Exception("E-mail é obrigatório!!");
            }

            if (aluno.DsSenha == string.Empty)
            {
                throw new Exception("Senha é obrigatório!!");
            }

            db.Alterar(aluno);
        }
 public void Alterar(Models.TbAluno nova)
 {
     db.Alterar(nova);
 }
 public Models.TbAluno consular(Models.TbAluno aluno)
 {
     return(db.consultar(aluno));
 }
 public void inserir(Models.TbAluno aluno)
 {
     db.inserir(aluno);
 }
 public Models.TbAluno Carregar(Models.TbAluno aluno)
 {
     Models.TbAluno Model = db.Carregar(aluno);
     return(Model);
 }
 public void Inserir(Models.TbAluno aluno)
 {
     business.Inserir(aluno);
 }
 public void Alterar(Models.TbAluno aluno)
 {
     business.Alterar(aluno);
 }
Esempio n. 15
0
 public Models.TbAluno Carregar(Models.TbAluno aluno)
 {
     Models.TbAluno carregamento = db.TbAluno.FirstOrDefault(t => t.IdAluno == aluno.IdAluno);
     return(carregamento);
 }
 public void Inserir(Models.TbAluno aluno)
 {
     bus.inserir(aluno);
 }
 public void Deletar(Models.TbAluno aluno)
 {
     Models.TbAluno consulta = bus.consular(aluno);
     bus.Deletar(consulta.IdAluno);
 }
Esempio n. 18
0
 public void Inserir(Models.TbAluno aluno)
 {
     db.TbAluno.Add(aluno);
     db.SaveChanges();
 }
Esempio n. 19
0
 public Models.TbAluno Consulta(int id)
 {
     Models.TbAluno aluno = db.TbAluno
                            .FirstOrDefault(x => x.IdAluno == id);
     return(aluno);
 }