コード例 #1
0
        static void Main(string[] args)
        {
            var appAluno = new AlunoAplicacao();

            Console.Write("Digite o nome do aluno: ");
            string nome = Console.ReadLine();

            Console.Write("Digite o nome da mãe do aluno: ");
            string mae = Console.ReadLine();

            Console.Write("Digite a data de nascimento do aluno: ");
            string data = Console.ReadLine();

            var aluno1 = new Aluno
                            {
                                Nome = nome,
                                Mae = mae,
                                DataNascimento = DateTime.Parse(data)
                            };

            appAluno.Salvar(aluno1);

            var dados = appAluno.ListarTodos();

            foreach (var aluno in dados)
            {
                Console.WriteLine("Id:{0}, Nome:{1}, Mae:{2}, DataNascimento:{3}", aluno.Id, aluno.Nome, aluno.Mae, aluno.DataNascimento);
            }
        }
コード例 #2
0
ファイル: Presenca.cs プロジェクト: thiagosartor/newBack
 public Presenca(Aula aula, Aluno aluno, string statusPresenca)
     : this()
 {
     this.Aula = aula;
     this.Aluno = aluno;
     this.StatusPresenca = statusPresenca;
 }
コード例 #3
0
        static void Main(string[] args)
        {
            try
            {
                var appAluno = AlunoAplicacaoConstrutor.AlunoAplicacaoADO();

                Console.Write("Digite o nome do aluno: ");
                string nome = Console.ReadLine();

                Console.Write("Digite o nome da mãe do aluno: ");
                string mae = Console.ReadLine();

                Console.Write("Digite a data de nascimento do aluno: ");
                string data = Console.ReadLine(); //Data formato americano

                var aluno = new Aluno() { Nome = nome, Mae = mae, DataNascimento = Convert.ToDateTime(data) };

                appAluno.Salvar(aluno);

                foreach (var aluno1 in appAluno.ListarTodos())
                {
                    Console.WriteLine("Id: {0}, Nome: {1}, Mãe: {2}, Mãe: DataNascimento: {3}", aluno1.Id, aluno1.Nome, aluno1.Mae, aluno1.DataNascimento);
                }
            }
            catch (Exception ex)
            {
                Console.Write("Erro: " + ex.Message);
            }

            Console.Read();
        }
コード例 #4
0
 public Pagamento(int pId, float pValor, Status pStatus, Mes pMes, Aluno pAluno)
 {
     id = pId;
     valor = pValor;
     status = pStatus;
     mes = pMes;
     aluno = pAluno;
 }
コード例 #5
0
 public Aluno AtualizarAluno(Aluno aluno)
 {
     using (MyCompanyContext db = new MyCompanyContext())
     {
         db.Entry(aluno).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return aluno;
     }
 }
コード例 #6
0
        public Aluno CriarAluno(Aluno aluno)
        {
            using (MyCompanyContext db = new MyCompanyContext())
            {
                db.Aluno.Add(aluno);
                db.SaveChanges();
                return aluno;
            }

        }
コード例 #7
0
        public void Alterar(Aluno aluno)
        {
            try
            {
                Aluno alunoAux = new Aluno();
                alunoAux.ID = aluno.ID;

                List<Aluno> resultado = this.Consultar(alunoAux, TipoPesquisa.E);

                if (resultado == null || resultado.Count == 0)
                    throw new AlunoNaoAlteradoExcecao();

                alunoAux = resultado[0];
                alunoAux.Alergico = aluno.Alergico;
                alunoAux.Bairro = aluno.Bairro;
                alunoAux.Cep = aluno.Cep;
                alunoAux.Cidade = aluno.Cidade;
                alunoAux.ComplementoEndereco = aluno.ComplementoEndereco;
                alunoAux.Contato = aluno.Contato;

                alunoAux.DescricaoMedica = aluno.DescricaoMedica;
                alunoAux.Email = aluno.Email;
                alunoAux.FatorRh = aluno.FatorRh;
                alunoAux.FoneAluno = aluno.FoneAluno;
                alunoAux.FoneEmergencia = aluno.FoneEmergencia;
                alunoAux.FoneMedico = aluno.FoneMedico;
                alunoAux.FoneResidencia = aluno.FoneResidencia;
                alunoAux.GrupoSanguineo = aluno.GrupoSanguineo;
                alunoAux.Hospital = aluno.Hospital;
                alunoAux.Imagem = aluno.Imagem;
                alunoAux.Login = aluno.Login;
                alunoAux.Logradouro = aluno.Logradouro;
                alunoAux.Nacionalidade = aluno.Nacionalidade;
                alunoAux.Nascimento = aluno.Nascimento;
                alunoAux.Naturalidade = aluno.Naturalidade;
                alunoAux.Nome = aluno.Nome;
                alunoAux.NomeMedico = aluno.NomeMedico;
                alunoAux.PerfilID = aluno.PerfilID;
                alunoAux.PlanoSaude = aluno.PlanoSaude;
                alunoAux.Senha = aluno.Senha;
                alunoAux.Sexo = aluno.Sexo;
                alunoAux.SituacaoEspecial = aluno.SituacaoEspecial;
                alunoAux.Status = aluno.Status;
                alunoAux.Uf = aluno.Uf;
                alunoAux.SerieAtual = aluno.SerieAtual;
                alunoAux.Edificio = aluno.Edificio;

                Confirmar();
            }
            catch (Exception)
            {

                throw new AlunoNaoAlteradoExcecao();
            }
        }
コード例 #8
0
 public void Salvar(Aluno aluno)
 {
     if (aluno.Id > 0)
     {
         Alterar(aluno);
     }
     else
     {
         Inserir(aluno);
     }
 }
コード例 #9
0
        public void Inserir(Aluno aluno)
        {
            
            sql = string.Format(@"INSERT INTO ALUNOS (NOME, CARGO, DATANASCIMENTO) VALUES ('{0}','{1}','{2}')",
                aluno.Nome, aluno.Cargo, aluno.DataNasc);

            using (contexto = new Contexto())
            {
                contexto.ExecutaComando(sql);
            }
        }
コード例 #10
0
ファイル: CrudAluno.cs プロジェクト: Programacao8/Academia
 public void Altera(Aluno aluno)
 {
     using (OdbcConnection conexao = ConexaoPadrao.CreateConnection())
     {
         string sql = "update Aluno set [id] = ?";
         OdbcCommand comando = new OdbcCommand(sql, conexao);
         comando.Parameters.AddWithValue("@nome", aluno.id);
         conexao.Open();
         comando.ExecuteNonQuery();
     }
 }
コード例 #11
0
ファイル: CrudAluno.cs プロジェクト: Programacao8/Academia
 public void Insere(Aluno aluno)
 {
     using (OdbcConnection conexao = ConexaoPadrao.CreateConnection())
     {
         string sql = "insert into Aluno(id) values (?, ?, ?, ?, ?)";
         OdbcCommand comando = new OdbcCommand(sql, conexao);
         comando.Parameters.AddWithValue("@nome", aluno.id);
         conexao.Open();
         comando.ExecuteNonQuery();
     }
 }
コード例 #12
0
 public FormAddAluno(IAlunoRepositorio repositorio, Aluno aluno)
     : this(repositorio)
 {
     editMode = true;
     _aluno = aluno;
     cbxTurma.Text = _aluno.Turma.ToString();
     txtNome.Text = _aluno.Nome;
     txtSobrenome.Text = _aluno.Sobrenome;
     txtIdade.Text = _aluno.Idade.ToString();
     txtIdade.Text = _aluno.Nota.ToString();
     cbxTurma.Text = _aluno.Status.ToString();
 }
コード例 #13
0
ファイル: Program.cs プロジェクト: ekizaki/fried-sausage
 /// <summary>
 /// Distribui os alunos contidos no array "Aluno[] alunosRandomizados" nas listas
 /// contidas no array de "List<Aluno> lista".
 /// </summary>
 /// <param name="qntGrupo">Recebe a quantidade de listas existentes.</param>
 /// <param name="alunosRandomizados">Recebe um array contendo os alunos randomizados pelo 
 /// método "AlunoOperation.RandomizarAlunos".</param>
 /// <param name="lista">Recebe o array de listas de alunos para distribuição dos alunos
 /// contidos em "alunosRandomizados".</param>
 private static void DistribuirAlunos(int qntGrupo, Aluno[] alunosRandomizados, List<Aluno>[] lista)
 {
     int count = 0;
     foreach (Aluno termo in alunosRandomizados)
     {
         lista[count].Add(termo);
         count++;
         if (count == qntGrupo)
         {
             count = 0;
         }
     }
 }
コード例 #14
0
 public frmMatriculaControlar(Usuario user)
 {
     InitializeComponent();
     status = "Ambas";
     formapgmto = "Ambas";
     this.user = user;
     mat = new Matricula();
     mod = new Modalidade();
     alu = new Aluno();
     rbAtivasInativas.Checked = true;
     rbDiaristaMensalista.Checked = true;
     btnBuscar_Click(this, null);
     atualizaInfos();
 }
コード例 #15
0
ファイル: AlunoService.cs プロジェクト: thiagosartor/Diario
        public void Add(AlunoDTO alunoDto)
        {
            Turma turma = _turmaRepository.GetById(alunoDto.TurmaId);

            Aluno aluno = new Aluno(alunoDto.Descricao.Split(':')[0], turma??new Turma(2007));//todo: turma vem null

            aluno.Endereco.Bairro = alunoDto.Bairro;
            aluno.Endereco.Cep = alunoDto.Cep;
            aluno.Endereco.Localidade = alunoDto.Localidade;
            aluno.Endereco.Uf = alunoDto.Uf;

            _alunoRepository.Add(aluno);

            _unitOfWork.Commit();
        }
コード例 #16
0
        public void Alterar(Aluno aluno)
        {
            StringBuilder _sql = new StringBuilder();

            _sql.Append("UPDATE ALUNOS SET ");
            _sql.Append(String.Format(" NOME = '{0}', ", aluno.Nome));
            _sql.Append(String.Format(" CARGO = '{0}', ", aluno.Cargo));
            _sql.Append(String.Format(" DATANASCIMENTO = '{0}' ", aluno.DataNasc));
            _sql.Append(String.Format(" WHERE ALUNOID  = {0}", aluno.Id));

            using (contexto = new Contexto())
            {
                contexto.ExecutaComando(_sql.ToString());
            }
        }
コード例 #17
0
 private List<Aluno> TranformaReaderEmLista(SqlDataReader reader)
 {
     var lista = new List<Aluno>();
     while (reader.Read())
     {
         Aluno aluno = new Aluno()
         {
             Id = Convert.ToInt32(reader["AlunoId"]),
             Nome = reader["nome"].ToString(),
             Cargo = reader["cargo"].ToString(),
             DataNasc = Convert.ToDateTime(reader["DataNascimento"])
         };
         lista.Add(aluno);
     }
     reader.Close();
     return lista;
 }
コード例 #18
0
 /// <summary>
 /// Realiza a "randomização" dos alunos inseridos pelo método "AdicionarAluno()".
 /// </summary>
 /// <returns>Retorna um array com os termos da lista de alunos "RelacaoAluno" randomizados. </returns>
 public static Aluno[] RandomizarAlunos()
 {
     int count=0;
     int verificador;
     Random rdm = new Random();
     Aluno[] AlunosNaoRepetidos = new Aluno[RelacaoAluno.Count];
     while (count < RelacaoAluno.Count)
     {
         verificador = rdm.Next(RelacaoAluno.Count);
         if (AlunosNaoRepetidos.Contains(RelacaoAluno[verificador]) == false)
         {
             AlunosNaoRepetidos[count] = RelacaoAluno[verificador];
             count++;
         }
     }
     return (AlunosNaoRepetidos);
 }
コード例 #19
0
 public void cadastraAluno(Aluno aluno)
 {
     alunoRepositorio.cadastraAluno(aluno);
 }
コード例 #20
0
 public void Insert(Aluno obj)
 {
     _context.Add(obj);
     _context.SaveChanges();
 }
コード例 #21
0
 public ActionResult EditarTodos(Aluno aluno)
 {
     aluno.Alterar(aluno);
     //return View();
     return(RedirectToAction("ListaTodos"));
 }
コード例 #22
0
        //List<Aluno> TabelaAlunos = new List<Aluno>();

        public void inserir(Aluno novoAluno)
        {
            contexto.Alunos.Add(novoAluno);
            contexto.SaveChanges();
            //TabelaAlunos.Add(a);
        }
コード例 #23
0
 public async Task <Aluno> AdicionarAsync(Aluno aluno)
 {
     return((await _contexto.Alunos.AddAsync(aluno)).Entity);
 }
コード例 #24
0
 public static bool Inserir(Aluno novo)
 {
     return(AlunoDAL.Inserir(novo));
 }
コード例 #25
0
 public void TestInitialize()
 {
     avaliador = new AvaliadorProva();
     maria = new Aluno(1, "Maria");
     jose = new Aluno(2, "José");
     joao = new Aluno(3, "João");
     luis = new Aluno(4, "Luis");
     pedro = new Aluno(5, "Pedro");
     rafael = new Aluno(6, "Rafael");
 }
コード例 #26
0
        public List<Aluno> Consultar(Aluno aluno, TipoPesquisa tipoPesquisa)
        {
            List<Aluno> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (aluno.ID != 0)
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.ID == aluno.ID
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.Nascimento.HasValue && aluno.Nascimento.Value != default(DateTime))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Nascimento.HasValue && a.Nascimento.Value == aluno.Nascimento.Value
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Alergico))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Alergico.Contains(aluno.Alergico)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Bairro))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Bairro.Contains(aluno.Bairro)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Cep))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Cep.Contains(aluno.Cep)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Cidade))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Cidade.Contains(aluno.Cidade)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.ComplementoEndereco))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.ComplementoEndereco.Contains(aluno.ComplementoEndereco)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.DescricaoMedica))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.DescricaoMedica.Contains(aluno.DescricaoMedica)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Email))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Email.Contains(aluno.Email)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.FatorRh.HasValue)
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.FatorRh.HasValue && a.FatorRh.Value == aluno.FatorRh.Value
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.FoneAluno))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.FoneAluno.Contains(aluno.FoneAluno)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.FoneEmergencia))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.FoneEmergencia.Contains(aluno.FoneEmergencia)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.FoneMedico))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.FoneMedico.Contains(aluno.FoneMedico)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.FoneResidencia))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.FoneResidencia.Contains(aluno.FoneResidencia)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.GrupoSanguineo))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.GrupoSanguineo.Contains(aluno.GrupoSanguineo)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Hospital))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Hospital.Contains(aluno.Hospital)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Login))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Login.Contains(aluno.Login)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Logradouro))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Logradouro.Contains(aluno.Logradouro)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Nacionalidade))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Nacionalidade.Contains(aluno.Nacionalidade)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.Nascimento.HasValue && aluno.Nascimento.Value != default(DateTime))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Nascimento.HasValue && a.Nascimento.Value == aluno.Nascimento
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Naturalidade))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Naturalidade.Contains(aluno.Naturalidade)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Nome))
                        {

                            resultado = ((from a in resultado
                                          where
                                           a.Nome.ToUpper().Contains(aluno.Nome.ToUpper())
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.NomeMedico))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.NomeMedico.Contains(aluno.NomeMedico)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.PerfilID != 0 && aluno.PerfilID != null)
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.PerfilID == aluno.PerfilID
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.PlanoSaude))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.PlanoSaude.Contains(aluno.PlanoSaude)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Senha))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Senha.Contains(aluno.Senha)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.Sexo.HasValue)
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Sexo.HasValue && a.Sexo.Value == aluno.Sexo.Value
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.SituacaoEspecial))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.SituacaoEspecial.Contains(aluno.SituacaoEspecial)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Uf))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Uf.Contains(aluno.Uf)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Contato))
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Contato.Contains(aluno.Contato)
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.Status.HasValue)
                        {

                            resultado = ((from a in resultado
                                          where
                                          a.Status.HasValue && a.Status.Value == aluno.Status.Value
                                          select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (aluno.ID != 0)
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.ID == aluno.ID
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.Nascimento.HasValue && aluno.Nascimento.Value != default(DateTime))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Nascimento.HasValue && a.Nascimento.Value == aluno.Nascimento.Value
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Alergico))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Alergico.Contains(aluno.Alergico)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Bairro))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Bairro.Contains(aluno.Bairro)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Cep))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Cep.Contains(aluno.Cep)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Cidade))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Cidade.Contains(aluno.Cidade)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.ComplementoEndereco))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.ComplementoEndereco.Contains(aluno.ComplementoEndereco)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.DescricaoMedica))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.DescricaoMedica.Contains(aluno.DescricaoMedica)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Email))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Email.Contains(aluno.Email)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.FatorRh.HasValue)
                        {
                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.FatorRh.HasValue && a.FatorRh.Value == aluno.FatorRh.Value
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.FoneAluno))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.FoneAluno.Contains(aluno.FoneAluno)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.FoneEmergencia))
                        {
                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.FoneEmergencia.Contains(aluno.FoneEmergencia)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.FoneMedico))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.FoneMedico.Contains(aluno.FoneMedico)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.FoneResidencia))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.FoneResidencia.Contains(aluno.FoneResidencia)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.GrupoSanguineo))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.GrupoSanguineo.Contains(aluno.GrupoSanguineo)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Hospital))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Hospital.Contains(aluno.Hospital)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Login))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Login.Contains(aluno.Login)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Logradouro))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Logradouro.Contains(aluno.Logradouro)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Nacionalidade))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Nacionalidade.Contains(aluno.Nacionalidade)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.Nascimento.HasValue && aluno.Nascimento.Value != default(DateTime))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Nascimento.HasValue && a.Nascimento.Value == aluno.Nascimento
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Naturalidade))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Naturalidade.Contains(aluno.Naturalidade)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Nome))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Nome.ToUpper().Contains(aluno.Nome.ToUpper())
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.NomeMedico))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.NomeMedico.Contains(aluno.NomeMedico)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.PerfilID != 0 && aluno.PerfilID != null)
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.PerfilID == aluno.PerfilID
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.PlanoSaude))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.PlanoSaude.Contains(aluno.PlanoSaude)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Senha))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Senha.Contains(aluno.Senha)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.Sexo.HasValue)
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Sexo.HasValue && a.Sexo.Value == aluno.Sexo.Value
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.SituacaoEspecial))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.SituacaoEspecial.Contains(aluno.SituacaoEspecial)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Uf))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Uf.Contains(aluno.Uf)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(aluno.Contato))
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Contato.Contains(aluno.Contato)
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (aluno.Status.HasValue)
                        {

                            resultado.AddRange((from a in Consultar()
                                                where
                                                a.Status.HasValue && a.Status.Value == aluno.Status.Value
                                                select a).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion

                default:
                    break;
            }

            return resultado;
        }
コード例 #27
0
 public Aluno Put(int id, [FromBody] Aluno a)
 {
     return(repo.Alterar(id, a));
 }
コード例 #28
0
 public Aluno Post([FromBody] Aluno a)
 {
     return(repo.Cadastrar(a));
 }
コード例 #29
0
 //método para atualizar o aluno
 public void AtualizarAluno(Aluno aluno)
 {
     repository.Update(aluno);
 }
コード例 #30
0
        public CadastrarAluno()
        {
            alunoService = new AlunoService(new RepositorioBase <Aluno>(new Contexto()));

            Console.Clear();
            Console.WriteLine("Universidade Ecológica do Sitio do Caqui" +
                              "\n---------------------------------------------------------\n" +
                              "Cadastro de Aluno" +
                              "\n---------------------------------------------------------");


            var aluno = new Aluno();

            var nomeInvalido = true;

            while (nomeInvalido)
            {
                Console.Write("Nome: ");

                var nome = Console.ReadLine();

                if (string.IsNullOrWhiteSpace(nome))
                {
                    Console.Clear();
                    Console.WriteLine("Preencha o nome.\n Aperte qualquer tecla para continuar.\n");
                    Console.ReadLine();
                }

                if (!Regex.IsMatch(nome, @"[\p{L}]+$"))
                {
                    Console.Clear();
                    Console.WriteLine("O nome deve conter apenas letras.\n Aperte qualquer tecla para continuar.\n");
                    Console.ReadLine();
                }
                else
                {
                    nomeInvalido = false;
                    aluno.Nome   = nome;
                }
                Console.Clear();
            }


            var sobrenomeInvalido = true;

            while (sobrenomeInvalido)
            {
                Console.Clear();
                Console.Write("Sobrenome: ");

                var sobrenome = Console.ReadLine();

                if (string.IsNullOrWhiteSpace(sobrenome))
                {
                    Console.Clear();
                    Console.WriteLine("Preencha o sobrenome.\n Aperte qualquer tecla para continuar.\n");
                    Console.ReadLine();
                }
                else
                {
                    sobrenomeInvalido = false;
                    aluno.Sobrenome   = sobrenome;
                }
            }

            Console.Clear();
            Console.WriteLine("Espere um pouco...");

            var alunoExistente = alunoService.BuscarPorNomeSobrenome(aluno.Nome, aluno.Sobrenome);

            Console.Clear();

            if (alunoExistente != null)
            {
                Console.Clear();
                Console.WriteLine("Universidade Ecológica do Sitio do Caqui" +
                                  "\n---------------------------------------------------------\n" +
                                  "Cadastro de Aluno" +
                                  "\n---------------------------------------------------------\n" +
                                  "Nome: " + alunoExistente.Nome + "\n" +
                                  "Sobrenome: " + alunoExistente.Sobrenome + "\n" +
                                  "Data de Nascimento: " + alunoExistente.DataDeNascimento.ToShortDateString() + "\n" +
                                  "CPF: " + alunoExistente.Cpf + "\n" +
                                  "Curso: " + alunoExistente.Curso + "\n" +
                                  "\n---------------------------------------------------------\n" +
                                  "01 - Voltar | 02 - Salvar | 03 - Excluir" +
                                  "\n---------------------------------------------------------");

                do
                {
                    var opcao = Console.ReadLine();

                    if (int.TryParse(opcao, out var opcaoValida))
                    {
                        switch (opcaoValida)
                        {
                        case 1:
                            new MenuPrincipal();
                            break;

                        case 2:
                            new MenuPrincipal();
                            break;

                        case 3:
                            alunoService.Excluir(alunoExistente);
                            Console.Clear();
                            Console.WriteLine("Aluno excluido com sucesso.\n Aperte qualquer tecla para continuar.\n");
                            Console.ReadLine();
                            break;

                        default:
                            OpcaoInvalida();
                            break;
                        }
                    }
                    else
                    {
                        OpcaoInvalida();
                    }
                }while (true);
            }
            else
            {
                var dataInvalida = true;

                while (dataInvalida)
                {
                    Console.Clear();
                    Console.Write("Data de Nascimento: ");

                    var data = Console.ReadLine();

                    if (string.IsNullOrWhiteSpace(data))
                    {
                        Console.Clear();
                        Console.WriteLine("Preencha a data.\n Aperte qualquer tecla para continuar.\n");
                        Console.ReadLine();
                        continue;
                    }

                    if (DateTime.TryParse(data, out var dataConvertida))
                    {
                        if (dataConvertida < DateTime.MinValue || dataConvertida > DateTime.MaxValue)
                        {
                            Console.Clear();
                            Console.WriteLine("A data esta fora do alcance permitido. Digite uma data válida.\n Aperte qualquer tecla para continuar.\n");
                            Console.ReadLine();
                        }

                        if (dataConvertida > DataMinima)
                        {
                            Console.Clear();
                            Console.WriteLine("A data não pode ser maior que 01/01/2002.\n Aperte qualquer tecla para continuar.\n");
                            Console.ReadLine();
                        }
                        else
                        {
                            aluno.DataDeNascimento = dataConvertida;
                            dataInvalida           = false;
                        }
                    }
                    else
                    {
                        Console.Clear();
                        Console.WriteLine("Formado de data inválido. Digite no formato dia/mês/ano.\nAperte qualquer tecla para continuar.\n");
                        Console.ReadLine();
                    }
                }

                var cpfInvalido = true;

                while (cpfInvalido)
                {
                    Console.Clear();
                    Console.Write("CPF: ");
                    var cpf = Console.ReadLine();

                    if (string.IsNullOrWhiteSpace(cpf))
                    {
                        Console.Clear();
                        Console.WriteLine("Preencha o CPF.\n Aperte qualquer tecla para continuar.\n");
                        Console.ReadLine();
                        continue;
                    }

                    if (alunoService.BuscarPorCpf(cpf) != null)
                    {
                        Console.Clear();
                        Console.WriteLine("Um aluno já foi cadastrado com esse CPF.\n Aperte qualquer tecla para continuar.\n");
                        Console.ReadLine();
                        continue;
                    }

                    if (int.TryParse(cpf, out var cpfConvertido))
                    {
                        aluno.Cpf   = cpf;
                        cpfInvalido = false;
                    }
                    else
                    {
                        Console.Clear();
                        Console.WriteLine("O CPF deve conter apenas números.\nAperte qualquer tecla para continuar.\n");
                        Console.ReadLine();
                    }
                }

                var cursoInvalido = true;

                while (cursoInvalido)
                {
                    Console.Clear();
                    Console.Write("Curso: ");
                    var curso = Console.ReadLine();

                    if (string.IsNullOrWhiteSpace(curso))
                    {
                        Console.Clear();
                        Console.WriteLine("Preencha o curso.\n Aperte qualquer tecla para continuar.\n");
                        Console.ReadLine();
                    }
                    else
                    {
                        aluno.Curso   = curso;
                        cursoInvalido = false;
                    }
                }

                var opcao = "";

                do
                {
                    Console.Clear();
                    Console.WriteLine("Universidade Ecológica do Sitio do Caqui" +
                                      "\n---------------------------------------------------------\n" +
                                      "Cadastro de Aluno" +
                                      "\n---------------------------------------------------------\n" +
                                      "Nome: " + aluno.Nome + "\n" +
                                      "Sobrenome: " + aluno.Sobrenome + "\n" +
                                      "Data de Nascimento: " + aluno.DataDeNascimento.ToShortDateString() + "\n" +
                                      "CPF: " + aluno.Cpf + "\n" +
                                      "Curso: " + aluno.Curso + "\n" +
                                      "\n---------------------------------------------------------\n" +
                                      "01 - Voltar | 02 - Salvar | 03 - Excluir" +
                                      "\n---------------------------------------------------------");

                    opcao = Console.ReadLine();

                    if (int.TryParse(opcao, out var opcaoValida))
                    {
                        switch (opcaoValida)
                        {
                        case 1:
                            new MenuPrincipal();
                            break;

                        case 2:
                            alunoService.Cadastrar(aluno);
                            Console.Clear();
                            Console.WriteLine("Aluno salvo com sucesso!\nAperte qualquer tecla para continuar.");
                            Console.ReadLine();
                            opcao = "";
                            new MenuPrincipal();
                            break;

                        case 3:
                            new MenuPrincipal();
                            break;

                        default:
                            OpcaoInvalida();
                            break;
                        }
                    }
                    else
                    {
                        OpcaoInvalida();
                    }
                }while (string.IsNullOrWhiteSpace(opcao));
            }
        }
コード例 #31
0
 public ActionResult Editar(Aluno aluno)
 {
     _unit.AlunoRepository.Atualizar(aluno);
     _unit.Salvar();
     return(RedirectToAction("Listar", new { msg = "Aluno Atualizado" }));
 }
コード例 #32
0
 private void Aluno_Attach(Aluno entity)
 {
     entity.Perfil = this;
 }
コード例 #33
0
 public HomeController(Aluno aluno)
 {
     _aluno = aluno;
 }
コード例 #34
0
ファイル: AlunoDAO.cs プロジェクト: brneor/pwin-academico
 public void Inserir(Aluno obj) => registros.Add(obj);
コード例 #35
0
 /// <summary>
 /// Realiza a adição de um objeto "Aluno" à lista "List<Aluno>"
 /// </summary>
 /// <param name="aluno">Recebe o objeto do tipo "Aluno"</param>
 public static void AdicionarAluno(Aluno aluno)
 {
     RelacaoAluno.Add(aluno);
 }
コード例 #36
0
        public void Excluir(Aluno aluno)
        {
            try
            {
                Aluno alunoAux = new Aluno();
                alunoAux.ID = aluno.ID;

                List<Aluno> resultado = this.Consultar(alunoAux, TipoPesquisa.E);

                if (resultado == null || resultado.Count == 0)
                    throw new AlunoNaoExcluidoExcecao();

                alunoAux = resultado[0];

                db.Aluno.DeleteOnSubmit(alunoAux);

            }
            catch (Exception)
            {

                throw new AlunoNaoExcluidoExcecao();
            }
        }
コード例 #37
0
ファイル: AlunoDB.cs プロジェクト: project-tcc/TCC2
        public bool Salvar(Aluno aluno)

        {
            try
            {
                string sql = "INSERT INTO aluno_tb " + "" +
                             "(ra, curso, data_de_ingresso, " +
                             "Nome_completo, rg, cpf, telefone_fixo, " +
                             "telefone_celular, nacionalidade, nome_pai, " +
                             "nome_mae, end_cep, end_complemento, end_bairro, " +
                             "end_cidade, tipo_logradouro, end_rua, " +
                             "telefone_emergencial, data_nascimento, email, sexo_id, " +
                             "status_id, tipo_id, dt_inclusao, data_alteracao)" + ""

                             + "values (@Ra, @Curso, @Data_de_ingresso, " +
                             "@Nome_completo, @Rg, @cpf, @telefone_fixo, @Telefone_celular, " +
                             "@Nacionalidade, @Nome_pai, @Nome_mae, @End_cep, @End_complemento, " +
                             "@End_bairro, @End_cidade, @Tipo_logradouro, @End_rua, @Telefone_emergencial, " +
                             "@Data_nascimento, @Email, @Sexo_id, @Status_id, @Tipo_id, @Dt_inclusao, @Data_alteracao)";


                using (var cmd = sqliteConnection.CreateCommand())
                {
                    cmd.CommandText = sql;
                    cmd.Parameters.AddWithValue("@Id", aluno.Id);
                    cmd.Parameters.AddWithValue("@Ra", aluno.Ra);
                    cmd.Parameters.AddWithValue("@End_cidade", aluno.End_cidade);
                    cmd.Parameters.AddWithValue("@End_cep", aluno.End_cep);
                    cmd.Parameters.AddWithValue("@End_rua", aluno.End_rua);
                    cmd.Parameters.AddWithValue("@End_complemento", aluno.End_complemento);
                    cmd.Parameters.AddWithValue("@End_bairro", aluno.End_bairro);
                    cmd.Parameters.AddWithValue("@Tipo_logradouro", aluno.Tipo_logradouro);
                    cmd.Parameters.AddWithValue("@Telefone_fixo", aluno.Telefone_fixo);
                    cmd.Parameters.AddWithValue("@Telefone_celular", aluno.Telefone_celular);
                    cmd.Parameters.AddWithValue("@Telefone_emergencial", aluno.Telefone_emergencial);
                    cmd.Parameters.AddWithValue("@Curso", aluno.Curso);
                    cmd.Parameters.AddWithValue("@Data_de_ingresso", aluno.Data_de_ingresso);
                    cmd.Parameters.AddWithValue("@Nome_pai", aluno.Nome_pai);
                    cmd.Parameters.AddWithValue("@Nome_mae", aluno.Nome_mae);
                    cmd.Parameters.AddWithValue("@Rg", aluno.Rg);
                    cmd.Parameters.AddWithValue("@Cpf", aluno.Cpf);
                    cmd.Parameters.AddWithValue("@Email", aluno.Email);
                    cmd.Parameters.AddWithValue("@Nacionalidade", aluno.Nacionalidade);
                    cmd.Parameters.AddWithValue("@Status_id", aluno.Status_id);
                    cmd.Parameters.AddWithValue("@Sexo_id", aluno.Sexo_id);
                    cmd.Parameters.AddWithValue("@Tipo_id", aluno.Tipo_id);
                    cmd.Parameters.AddWithValue("@Dt_inclusao", aluno.Dt_inclusao);
                    cmd.Parameters.AddWithValue("@Data_alteracao", aluno.Data_alteracao);
                    cmd.Parameters.AddWithValue("@Data_nascimento", aluno.Data_nascimento);
                    cmd.Parameters.AddWithValue("@Nome_completo", aluno.Nome_completo);


                    cmd.ExecuteNonQuery();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #38
0
        public void Incluir(Aluno aluno)
        {
            try
            {
                db.Aluno.InsertOnSubmit(aluno);
            }
            catch (Exception)
            {

                throw new AlunoNaoIncluidoExcecao();
            }
        }
コード例 #39
0
 public IActionResult Post(Aluno aluno)
 {
     _context.Add(aluno);
     _context.SaveChanges();
     return(Ok(aluno));
 }
コード例 #40
0
        // GET: api/Aluno
        public IEnumerable <Aluno> Get()
        {
            Aluno aluno = new Aluno();

            return(aluno.ListarAlunos());
        }
コード例 #41
0
 public void Atualizar(Aluno aluno)
 {
     contexto.Entry(aluno).State = System.Data.Entity.EntityState.Modified;
     contexto.SaveChanges();
 }
コード例 #42
0
        // GET: api/Aluno/5
        public Aluno Get(int id)
        {
            Aluno aluno = new Aluno();

            return(aluno.ListarAlunos().Where(x => x.id == id).FirstOrDefault());
        }
コード例 #43
0
        public JsonResult Save(int cmbPessoa_Value, string cmbResponsavel_Value, string txtGrauParentesco, string txtDataCancelamento, int cmbTurma_Value)
        {
            try
            {
                //Tratamento de erro para não permitir o cadastramento duplicado do aluno na turma
                var qtdMatAluno = (from m in dbMatriculaTurma.Context.MatriculaTurma where m.Matricula.Aluno.Pessoa.idPessoa == cmbPessoa_Value && m.Turma.idTurma == cmbTurma_Value && m.Turma.status == (int)EnumStatus.TurmaAberta select m).Count();
                if (qtdMatAluno > 0)
                {
                    throw new Exception("O Aluno já matriculado nesta turma!");
                }


                Matricula   matricula   = new Matricula();
                Aluno       aluno       = new Aluno();
                Responsavel responsavel = new Responsavel();
                Cobranca    cobranca    = new Cobranca();

                Aluno alunoExistente = dbAluno.FindOne(x => x.idPessoa == cmbPessoa_Value);

                Taxa taxa = dbTaxa.FindOne(x => x.idTaxa == 1);

                if (!String.IsNullOrEmpty(txtDataCancelamento))
                {
                    matricula.dataCancelamento = Convert.ToDateTime(txtDataCancelamento);
                }

                if (!String.IsNullOrEmpty(cmbResponsavel_Value) && !String.IsNullOrEmpty(txtGrauParentesco))
                {
                    responsavel.idPessoa       = Convert.ToInt32(cmbResponsavel_Value);
                    responsavel.grauParentesco = txtGrauParentesco;
                    aluno.Responsavel          = responsavel;
                }

                aluno.idPessoa         = cmbPessoa_Value;
                aluno.statusFinanceiro = 0;
                aluno.statusPedagogico = 0;

                matricula.numeroMatricula = 0;
                if (alunoExistente != null)
                {
                    matricula.idAluno = alunoExistente.idAluno;
                }
                else
                {
                    matricula.Aluno = aluno;
                }
                matricula.dataRegistro = DateTime.Now;
                matricula.tipo         = "matricula";

                dbMatricula.Adicionar(matricula);
                dbMatricula.SaveChanges();

                Turma turma = (from t in dbTurma.Context.Turma where t.idTurma == cmbTurma_Value select t).First();

                cobranca.idTaxa          = 1;
                cobranca.idAluno         = matricula.idAluno;
                cobranca.statusPagamento = (int)EnumStatus.NaoPago;
                cobranca.valorTotal      = taxa.valor;
                cobranca.juros           = 0;
                cobranca.dataVencimento  = DateTime.Now.AddDays(5);
                cobranca.idCurso         = turma.idCurso;

                Matricula matriculaExistente = dbMatricula.FindOne(x => x.idAluno == matricula.idAluno && x.numeroMatricula != 0);

                Matricula numMatricula = dbMatricula.FindOne(idM => idM.idMatricula == matricula.idMatricula);
                numMatricula.numeroMatricula = matriculaExistente != null ? matriculaExistente.numeroMatricula : numMatricula.idMatricula;

                dbMatricula.Atualizar(numMatricula);
                dbMatricula.SaveChanges();

                dbCobranca.Adicionar(cobranca);
                dbCobranca.SaveChanges();

                MatriculaTurma matriculaTurma = new MatriculaTurma();
                matriculaTurma.idMatricula = numMatricula.idMatricula;
                matriculaTurma.idTurma     = cmbTurma_Value;

                dbMatriculaTurma.Adicionar(matriculaTurma);
                dbMatriculaTurma.SaveChanges();


                turma.vagasOcupadas += 1;
                dbTurma.Atualizar(turma);
                dbTurma.SaveChanges();

                return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(new { success = false, message = e.Message }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #44
0
 public EntityEntry <Aluno> Entry(Aluno aluno)
 {
     return(base.Entry(aluno));
 }
コード例 #45
0
ファイル: Form1.cs プロジェクト: RicardoSilverio/DotNet
        private void incluirButton_Click(object sender, EventArgs e)
        {
            long rm;
            if (String.IsNullOrWhiteSpace(rmTextBox.Text))
            {
                MessageBox.Show("RM não preechido");
                return;
            }
            else if (!long.TryParse(rmTextBox.Text, out rm))
            {
                MessageBox.Show("RM deve conter somente dígitos");
                return;
            }
            else if(_listaOrdenada.ContainsKey(rmTextBox.Text))
            {
                MessageBox.Show("RM duplicado");
                return;
            }

            if (String.IsNullOrWhiteSpace(nomeTextBox.Text))
            {
                MessageBox.Show("Nome não preechido");
                return;
            }

            _aluno.Nome = nomeTextBox.Text;
            _aluno.RM = rmTextBox.Text;

            _pilha.Push(_aluno);
            _fila.Enqueue(_aluno);
            _listaOrdenada.Add(_aluno.RM, _aluno);

            _aluno = new Aluno();
            rmTextBox.Text = String.Empty;
            nomeTextBox.Text = String.Empty;
            nota1TextBox.Text = String.Empty;
            nota2TextBox.Text = String.Empty;
            nota3TextBox.Text = String.Empty;
            nota1Label.Text = "0,0";
            nota2Label.Text = "0,0";
            nota3Label.Text = "0,0";
        }
コード例 #46
0
 public static void Remover(Aluno aluno)
 {
     _context.Alunos.Remove(aluno);
     _context.SaveChanges();
 }
コード例 #47
0
ファイル: TermoBD.cs プロジェクト: 4nub1s/infoGym
 public bool novo(Termo ter)
 {
     sql = "INSERT INTO termo(ter_quemcadastrou) "
     +"VALUES (@1)";
     sql = sql.Replace("@1", ter.TerQuemCadastrou);
     bco.conecta();
     result = bco.executeNonQuery(sql);
     bco.desconecta();
     if (result)
     {
         Aluno alu = new Aluno();
         alu.Id = Convert.ToInt32(ter.AluId);
         alu.TerId = ter.getUltimoId();
         result = alu.addTermo();
     }
     return result;
 }
コード例 #48
0
        public static void Initialize(FaculdadeContexto context)
        {
            context.Database.EnsureCreated();
            // procura por qualquer estudante
            if (context.Alunos.Any())
            {
                return;  //O banco foi inicializado
            }

            var alunos = new Aluno[]
            {
                new Aluno {
                    Matricula = "012018", Nome = "Silveira", Cpf = "426.679.420-78", EMail = "*****@*****.**", Endereco = "Rua da Ajuda 128", Bairro = "Centro", Cidade = "Rio de Janeiro", Uf = "RJ", Cep = "21.000-000", Celular = "(21)98877-6688", TelefoneResidencial = "(21)3488-7799", DataMatricula = DateTime.Parse("2018-06-01")
                },
                new Aluno {
                    Matricula = "022018", Nome = "Marcia", Cpf = "808.140.740-57", EMail = "*****@*****.**", Endereco = "Rua Maria Aparecida 60", Bairro = "Iraja", Cidade = "Rio de Janeiro", Uf = "RJ", Cep = "21.000-000", Celular = "(21)94433-2123", TelefoneResidencial = "", DataMatricula = DateTime.Parse("2018-04-01")
                },
                new Aluno {
                    Matricula = "032018", Nome = "Roberta", Cpf = "135.319.230-05", EMail = "*****@*****.**", Endereco = "A. Bras de Pina 18", Bairro = "Olaria", Cidade = "Rio de Janeiro", Uf = "RJ", Cep = "21.000-000", Celular = "(21)93456-5544", TelefoneResidencial = "(21)4678-7799", DataMatricula = DateTime.Parse("2018-06-01")
                },
                new Aluno {
                    Matricula = "042018", Nome = "Carlos", Cpf = "812.331.100-12", EMail = "*****@*****.**", Endereco = "Rua Custodia 33", Bairro = "Meier", Cidade = "Rio de Janeiro", Uf = "RJ", Cep = "21.000-000", Celular = "(21)94325-1234", TelefoneResidencial = "(21)3488-3399", DataMatricula = DateTime.Parse("2018-03-01")
                },
            };

            foreach (Aluno s in alunos)
            {
                context.Alunos.Add(s);
            }
            context.SaveChanges();

            var disciplinas = new Disciplina[]
            {
                new Disciplina {
                    DisciplinaID = 1050, NomeDisciplina = "Quimica", Descricao = "", DataCriacao = DateTime.Parse("2018-03-01"), CodigoDisciplina = "1001"
                },
                new Disciplina {
                    DisciplinaID = 4022, NomeDisciplina = "Economia", Descricao = "", DataCriacao = DateTime.Parse("2018-03-01"), CodigoDisciplina = "1002"
                },
                new Disciplina {
                    DisciplinaID = 4041, NomeDisciplina = "Economia", Descricao = "", DataCriacao = DateTime.Parse("2018-03-01"), CodigoDisciplina = "1003"
                },
                new Disciplina {
                    DisciplinaID = 1045, NomeDisciplina = "Cálculo", Descricao = "", DataCriacao = DateTime.Parse("2018-03-01"), CodigoDisciplina = "1004"
                },
                new Disciplina {
                    DisciplinaID = 3141, NomeDisciplina = "Trigonometria", Descricao = "", DataCriacao = DateTime.Parse("2018-03-01"), CodigoDisciplina = "1005"
                }
            };

            foreach (Disciplina c in disciplinas)
            {
                context.Disciplinas.Add(c);
            }

            context.SaveChanges();

            var turmas = new Turma[]
            {
                new Turma {
                    TurmaID = 1, CodigoTurma = "1003", Curso = "Sistema da Informação", Periodo = 1, DisciplinaID = 1050, AlunoID = 1, DataCriacao = DateTime.Parse("2018-03-01")
                },
                new Turma {
                    TurmaID = 2, CodigoTurma = "1003", Curso = "Sistema da Informação", Periodo = 1, DisciplinaID = 1050, AlunoID = 2, DataCriacao = DateTime.Parse("2018-03-01")
                },
                new Turma {
                    TurmaID = 3, CodigoTurma = "1003", Curso = "Sistema da Informação", Periodo = 1, DisciplinaID = 1050, AlunoID = 3, DataCriacao = DateTime.Parse("2018-03-01")
                },
                new Turma {
                    TurmaID = 4, CodigoTurma = "1003", Curso = "Sistema da Informação", Periodo = 1, DisciplinaID = 1050, AlunoID = 4, DataCriacao = DateTime.Parse("2018-03-01")
                },
                new Turma {
                    TurmaID = 5, CodigoTurma = "1004", Curso = "Suporte", Periodo = 1, DisciplinaID = 4022, AlunoID = 2, DataCriacao = DateTime.Parse("2018-03-01")
                },
                new Turma {
                    TurmaID = 6, CodigoTurma = "1004", Curso = "Suporte", Periodo = 1, DisciplinaID = 4022, AlunoID = 3, DataCriacao = DateTime.Parse("2018-03-01")
                },
                new Turma {
                    TurmaID = 7, CodigoTurma = "1004", Curso = "Suporte", Periodo = 1, DisciplinaID = 4022, AlunoID = 4, DataCriacao = DateTime.Parse("2018-03-01")
                },
                new Turma {
                    TurmaID = 8, CodigoTurma = "1005", Curso = "Desenvolvimento", Periodo = 1, DisciplinaID = 4041, AlunoID = 3, DataCriacao = DateTime.Parse("2018-03-01")
                },
                new Turma {
                    TurmaID = 9, CodigoTurma = "1006", Curso = "Engenharia", Periodo = 1, DisciplinaID = 1050, AlunoID = 2, DataCriacao = DateTime.Parse("2018-03-01")
                },
                new Turma {
                    TurmaID = 10, CodigoTurma = "1007", Curso = "Ciência da Computação", Periodo = 1, DisciplinaID = 1045, AlunoID = 1, DataCriacao = DateTime.Parse("2018-03-01")
                },
                new Turma {
                    TurmaID = 11, CodigoTurma = "1007", Curso = "Ciência da Computação", Periodo = 1, DisciplinaID = 1045, AlunoID = 2, DataCriacao = DateTime.Parse("2018-03-01")
                },
                new Turma {
                    TurmaID = 12, CodigoTurma = "1007", Curso = "Ciência da Computação", Periodo = 1, DisciplinaID = 1045, AlunoID = 4, DataCriacao = DateTime.Parse("2018-03-01")
                }
            };

            foreach (Turma c in turmas)
            {
                context.Turmas.Add(c);
            }

            context.SaveChanges();
        }
コード例 #49
0
 private void Aluno_Detach(Aluno entity)
 {
     entity.Perfil = null;
 }
コード例 #50
0
 public void IncluirNotasAluno(Aluno aluno)
 {
     DAL.DaoAluno Aluno = new DAL.DaoAluno();
     Aluno.IncluirNotasAluno(aluno);
 }
コード例 #51
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (!editMode)
            {
                TwitterService service = new TwitterService("9fHcTGpQkdy25gAQ8bFmiOd67", "KBWAa7reZWDEofMkgDluIfLVk9dEaAZAOTinUFInw5k6xNGCX6");

                // Step 1 - Retrieve an OAuth Request Token
                OAuthRequestToken requestToken = service.GetRequestToken();

                // Step 2 - Redirect to the OAuth Authorization URL
                Uri uri = service.GetAuthorizationUri(requestToken);
                Process.Start(uri.ToString());

                // Step 3 - Exchange the Request Token for an Access Token
                string verifier = "0350060"; // <-- This is input into your application by your user
                OAuthAccessToken access = service.GetAccessToken(requestToken, verifier);

                // Step 4 - User authenticates using the Access Token
                service.AuthenticateWith(access.Token, access.TokenSecret);

                var aluno = new Aluno((Turma)Enum.Parse(typeof(Turma), cbxTurma.Text),
                        txtNome.Text,
                        txtSobrenome.Text,
                        int.Parse(txtIdade.Text),
                        double.Parse(txtNota.Text),
                        (Status)Enum.Parse(typeof(Status), cbxStatus.Text));
                _alunoAplicacao.Adicionar(aluno);

                service.BeginSendTweet(new SendTweetOptions());
            }

            else
            {
                var aluno = _alunoAplicacao.Buscar(_aluno.Id);
                aluno.Turma = (Turma)Enum.Parse(typeof(Turma), cbxTurma.Text);
                aluno.Nome = txtNome.Text;
                aluno.Sobrenome = txtSobrenome.Text;
                aluno.Idade = int.Parse(txtIdade.Text);
                aluno.Nota = double.Parse(txtNota.Text);
                aluno.Status = (Status)Enum.Parse(typeof(Status), cbxStatus.Text);
                _alunoAplicacao.Atualizar(aluno);
            }
            Close();
        }
コード例 #52
0
ファイル: AlunoControl.cs プロジェクト: minafrajr/SIESC
        /// <summary>
        /// Localiza o aluno pelo ID
        /// </summary>
        /// <param name="aluno">O objeto Aluno</param>
        /// <returns>Retorna o ID do aluno</returns>
        public int PesquisaId(Aluno aluno)
        {
            alunoTa = new alunosTableAdapter();

            return((int)alunoTa.PesquisaID(aluno.Nome, aluno.DataNascimento, aluno.NomeMae));
        }
コード例 #53
0
        private void telaAlunoMatricula_Activated(object sender, EventArgs e)
        {
            uMenuLateral1.verificaTela(telaalunomatricula);
            uMenuImagem1.ocultarBotaoAdicionarImagem();

            if (memoria.Aluno != null)
            {
                uMenuImagem1.carregaAluno(memoria.Aluno);
                alunoMatriculaAux = memoria.Aluno;
                geraNumeroMatricula(memoria.Aluno.ID);

            }
            else
            {
                limparTela();
            }

            uMenuImagem1.ocultarBotaoAdicionarImagem();

            descontoControlador = DescontoProcesso.Instance;
            carregaComboSerie();

            cmbSerie.DataSource = listaSalaAuxiliar;

            Desconto d = new Desconto();
            d.Status = (int)Status.Ativo;

            listaDescontoAux = new List<Desconto>();

            listaDescontoAux = descontoControlador.Consultar(d, TipoPesquisa.E);
            cmbDesconto.DataSource = listaDescontoAux;
            cmbDesconto.DisplayMember = "Descricao";

            carregarValorTotal();
        }
コード例 #54
0
 public Usuario GetUsuarioByALuno(Aluno al)
 {
     return(db.Usuario.Find(al.IdUsuario));
 }
コード例 #55
0
        public JsonResult SavePreMatricula(int cmbPessoa_Value, string cmbResponsavel_Value, string txtGrauParentesco, string txtDataCancelamento, int cmbTurma_Value)
        {
            Matricula   matricula   = new Matricula();
            Aluno       aluno       = new Aluno();
            Responsavel responsavel = new Responsavel();

            Aluno alunoExistente = dbAluno.FindOne(x => x.idPessoa == cmbPessoa_Value);

            if (!String.IsNullOrEmpty(txtDataCancelamento))
            {
                matricula.dataCancelamento = Convert.ToDateTime(txtDataCancelamento);
            }

            if (!String.IsNullOrEmpty(cmbResponsavel_Value) && !String.IsNullOrEmpty(txtGrauParentesco))
            {
                responsavel.idPessoa       = Convert.ToInt32(cmbResponsavel_Value);
                responsavel.grauParentesco = txtGrauParentesco;
                aluno.Responsavel          = responsavel;
            }

            aluno.idPessoa         = cmbPessoa_Value;
            aluno.statusFinanceiro = 0;
            aluno.statusPedagogico = 0;

            matricula.numeroMatricula = 0;
            if (alunoExistente != null)
            {
                matricula.idAluno = alunoExistente.idAluno;
            }
            else
            {
                matricula.Aluno = aluno;
            }
            matricula.dataRegistro = DateTime.Now;
            matricula.tipo         = "prematricula";

            try
            {
                dbMatricula.Adicionar(matricula);
                dbMatricula.SaveChanges();

                Matricula matriculaExistente = dbMatricula.FindOne(x => x.idAluno == matricula.idAluno && x.numeroMatricula != 0);

                Matricula numMatricula = dbMatricula.FindOne(idM => idM.idMatricula == matricula.idMatricula);
                numMatricula.numeroMatricula = matriculaExistente != null ? matriculaExistente.numeroMatricula : numMatricula.idMatricula;

                dbMatricula.Atualizar(numMatricula);
                dbMatricula.SaveChanges();

                MatriculaTurma matriculaTurma = new MatriculaTurma();
                matriculaTurma.idMatricula = numMatricula.idMatricula;
                matriculaTurma.idTurma     = cmbTurma_Value;

                dbMatriculaTurma.Adicionar(matriculaTurma);
                dbMatriculaTurma.SaveChanges();

                return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(new { success = false, message = e.Message }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #56
0
 private void btnAluno_Click(object sender, EventArgs e)
 {
     frmAluGerenciamento frmAlu = new frmAluGerenciamento(true, user);
     frmAlu.ShowDialog();
     if (frmAlu.getPesquisaRealizada())
     {
         mod.Id = "";
         ttbModalidade.Text = "Todas";
         rbAtivasInativas.Checked = true;
         rbDiaristaMensalista.Checked = true;
         alu.Id = frmAlu.getAluId();
         alu = alu.getAlunoById();
         ttbAluno.Text = alu.Nome;
     }
     else
     {
         alu.Id = 0;
         ttbAluno.Text = "Todos";
     }
 }
コード例 #57
0
 public static void Alterar(Aluno aluno)
 {
     _context.Alunos.Update(aluno);
     _context.SaveChanges();
 }
コード例 #58
0
ファイル: AlunoDAO.cs プロジェクト: brneor/pwin-academico
 public void Alterar(Aluno obj)
 {
     Excluir(obj.Id);
     Inserir(obj);
 }
コード例 #59
0
        // DELETE: api/Aluno/5
        public void Delete(int id)
        {
            Aluno _aluno = new Aluno();

            _aluno.Deletar(id);
        }
コード例 #60
0
ファイル: AlunoControl.cs プロジェクト: minafrajr/SIESC
        /// <summary>
        /// Localiza o aluno pelo nome
        /// </summary>
        /// <param name="aluno"></param>
        /// <returns></returns>
        public string PesquisaNome(Aluno aluno)
        {
            alunoTa = new alunosTableAdapter();

            return(alunoTa.PesquisaNome((int)aluno.Id));
        }