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); }
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(); }
public Models.TbAluno consultar(Models.TbAluno aluno) { Models.TbAluno consulta = db.TbAluno.FirstOrDefault(x => x.NmAluno == aluno.NmAluno); return(consulta); }
public void Remover(int id) { Models.TbAluno remover = db.TbAluno .FirstOrDefault(x => x.IdAluno == id); db.TbAluno.Remove(remover); db.SaveChanges(); }
public void Deletar(int id) { Models.TbAluno remover = db.TbAluno.FirstOrDefault(t => t.IdAluno == id); if (remover != null) { db.Remove(remover); db.SaveChanges(); } }
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(); }
// 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"); } }
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); }
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); }
public void Inserir(Models.TbAluno aluno) { db.TbAluno.Add(aluno); db.SaveChanges(); }
public Models.TbAluno Consulta(int id) { Models.TbAluno aluno = db.TbAluno .FirstOrDefault(x => x.IdAluno == id); return(aluno); }