Ejemplo n.º 1
0
 public Presenca(Aula aula, Aluno aluno, string statusPresenca)
     : this()
 {
     this.Aula = aula;
     this.Aluno = aluno;
     this.StatusPresenca = statusPresenca;
 }
Ejemplo n.º 2
0
 public AlunoDTO(Aluno aluno)
 {
     Id = aluno.Id;
     Descricao = aluno.ToString();
     TurmaId = aluno.Turma.Id;
     Bairro = aluno.Endereco.Bairro;
     Cep = aluno.Endereco.Cep;
     Localidade = aluno.Endereco.Localidade;
     Uf = aluno.Endereco.Uf;
 }
        public Aluno Add(Aluno entity)
        {
            try
            {
                Insert(SqlInsert, Take(entity));
            }
            catch (Exception te)
            {
                throw new Exception("Erro ao tentar adicionar um aluno!" + te.Message);
            }

            return entity;
        }
Ejemplo n.º 4
0
 public static Presenca CreatePresenca(Aluno aluno, Aula aula, string status)
 {
     return Builder<Presenca>.CreateNew()
       .WithConstructor(() =>
       new Presenca(aula, aluno, status)).Build();
 }
 private static object[] Take(Aluno aluno)
 {
     return new object[]
     {
         "Id", aluno.Id,
         "Nome", aluno.Nome,
         "Turma_Id", aluno.Turma.Id,
         "Endereco_Cep", aluno.Endereco.Cep,
         "Endereco_Localidade", aluno.Endereco.Localidade,
         "Endereco_Bairro", aluno.Endereco.Bairro,
         "Endereco_Uf", aluno.Endereco.Uf
     };
 }
        private static Aluno Make(IDataReader reader)
        {
            Aluno aluno = new Aluno();
            aluno.Id = Convert.ToInt32(reader["Id"]);
            aluno.Nome = Convert.ToString(reader["Nome"]);
            aluno.Turma = new Turma
            {
                Id = Convert.ToInt32(reader["Turma_Id"]),
                Ano = Convert.ToInt32(reader["Ano"])
            };
            aluno.Endereco = new Endereco
            {
                Cep = Convert.ToString(reader["Endereco_Cep"]),
                Localidade = Convert.ToString(reader["Endereco_Localidade"]),
                Bairro = Convert.ToString(reader["Endereco_Bairro"]),
                Uf = Convert.ToString(reader["Endereco_Uf"])
            };

            return aluno;
        }
        private static IEnumerable<Presenca> ComparaPresencas(Aluno entity, Aluno aluno)
        {
            var presencas = entity.Presencas.Where(x =>
            {
                var existing = aluno.Presencas
                    .FirstOrDefault(a => x.Id == a.Id
                        &&
                        x.StatusPresenca == a.StatusPresenca);

                if (existing != null)
                    return false;
                else
                    return true;
            });
            return presencas;
        }
        public void Update(Aluno entity)
        {
            try
            {
                var aluno = GetById(entity.Id);

                var presencas = ComparaPresencas(entity, aluno);

                if (presencas != null)
                {
                    RealizaChamada(presencas);
                }

                Update(SqlUpdate, Take(entity));
            }
            catch (Exception te)
            {
                throw new Exception("Erro ao tentar editar uma Aula!" + te.Message);
            }
        }
 public void Delete(Aluno entity)
 {
     try
     {
         Delete(SqlDelete, Take(entity));
     }
     catch (Exception te)
     {
         throw new Exception("Erro ao tentar deletar um aluno!" + te.Message);
     }
 }
Ejemplo n.º 10
0
 public Presenca()
 {
     Aluno = new Aluno();
     Aula  = new Aula();
 }
Ejemplo n.º 11
0
 public Presenca()
 {
     Aluno = new Aluno();
     Aula = new Aula();
 }
Ejemplo n.º 12
0
 public AlunoTests()
 {
     turma = new Turma(2005);
     aluno = new Aluno("Rech", turma);
 }