protected void btnCadastroAluno(object sender, EventArgs e) { try { Aluno p = new Aluno(); p.Nome = txtNome.Text; p.Data_Nasc = txtData_Nasc.Text; p.Idade = txtIdade.Text; p.Objetivo_Graduacao = txtObjetivo_Graduacao.Text; p.Genero = txtGenero.Text; AlunoDAL d = new AlunoDAL(); d.Gravar(p); //gravando o aluno lblMensagem.Text = "Aluno " + p.Nome + " Cadastrado com Sucesso!!!"; txtNome.Text = string.Empty; txtData_Nasc.Text = string.Empty; txtIdade.Text = string.Empty; txtObjetivo_Graduacao.Text = string.Empty; txtGenero.Text = string.Empty; } catch (Exception ex) { lblMensagem.Text = ex.Message; } }
protected void btnPesquisarAluno(object sender, EventArgs e) { try { int Codigo = Convert.ToInt32(txtCodigo.Text); AlunoDAL d = new AlunoDAL(); Aluno p = d.PesquisarporCodigo(Codigo); if (p != null) { pnlDados.Visible = true; txtNome.Text = p.Nome; txtData_Nasc.Text = p.Data_Nasc; txtIdade.Text = p.Idade; txtObjetivo_Graduacao.Text = p.Objetivo_Graduacao; txtGenero.Text = p.Genero; } else { lblMensagem.Text = "Aluno Não Encontrado"; txtCodigo.Text = string.Empty; } } catch (Exception ex) { lblMensagem.Text = ex.Message; } }
public FrequenciaController(IESContext context) { _context = context; frequenciaDAL = new FrequenciaDAL(context); alunoDAL = new AlunoDAL(context); calendarioDAL = new CalendarioDAL(context); }
protected void btnExcluirUsuario(object sender, EventArgs e) { try { int Codigo = Convert.ToInt32(txtCodigo.Text); Aluno p = new Aluno(); AlunoDAL d = new AlunoDAL(); d.Excluir(Codigo); lblMemsagem.Text = "Aluno" + p.Nome + "Excluido com sucesso!"; txtCodigo.Text = string.Empty; txtNome.Text = string.Empty; txtData_Nasc.Text = string.Empty; txtIdade.Text = string.Empty; txtObjetivo_Graduacao.Text = string.Empty; txtGenero.Text = string.Empty; } catch (Exception ex) { lblMensagem.Text = ex.Message; } }
protected void BtnAtualizarUsuario(object sender, EventArgs e) { try { Aluno p = new Aluno(); p.Codigo = Convert.ToInt32(txtCodigo.Text); p.Nome = Convert.ToString(txtNome.Text); p.Data_Nasc = Convert.ToString(txtData_Nasc.Text); p.Idade = Convert.ToString(txtIdade.Text); p.Objetivo_Graduacao = Convert.ToString(txtObjetivo_Graduacao.Text); p.Genero = Convert.ToString(txtGenero.Text); AlunoDAL d = new AlunoDAL(); d.Atualizar(p); lblMemsagem.Text = "Aluno " + p.Nome + " Atualizado com Sucesso!"; txtCodigo.Text = string.Empty; txtNome.Text = string.Empty; txtData_Nasc.Text = string.Empty; txtIdade.Text = string.Empty; txtObjetivo_Graduacao.Text = string.Empty; txtGenero.Text = string.Empty; } catch (Exception ex) { lblMensagem.Text = ex.Message; } }
public void CadastrarAluno(object sender, EventArgs e) { try { Aluno a = new Aluno(); AlunoDAL aDal = new AlunoDAL(); if (ValidarCPF(txtCpf.Text)) { a.NomeAluno = txtNome.Text; a.Matricula = Convert.ToInt32(txtMatricula.Text); a.IdTurma = Convert.ToInt32(ddlTurma.SelectedItem.Value); a.Cpf = txtCpf.Text; aDal.Salvar(a); lblMensagem.Text = "Aluno cadastrado com sucesso!"; } else { lblMensagem.Text = "Favor, informe um cpf válido!"; } } catch (Exception) { lblMensagem.Text = "Ocorreu um erro no cadastro!"; } }
private void FiltrarAlunos(string campoFiltro, string valorFiltro) { DesativarSelecao(); try { AlunoDAL alunoDAL = new AlunoDAL(); List <Aluno> list = new List <Aluno>(); list = alunoDAL.FiltrarPorParametro(campoFiltro, valorFiltro).ToList(); string campo; if (campoFiltro.Equals("rcq")) { campo = "nível de risco referente à RELAÇÃO CINTURA-QUADRIL classificado como "; } else { campo = "TAXA DE GORDURA CORPORAL classificada como "; } if (list.Count() > 0) { PreencherDatagridAlunos(list); lblAvisoSelect.Visible = true; lblAvisoSelect.Text = "Abaixo estão listados os alunos que possuem " + campo + valorFiltro.ToUpper() + "."; } else { MessageBox.Show("Nenhum aluno foi localizado com base na opção selecionada.", "Filtro", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private static void ConsultaPorMatricula(AlunosContext db) { int p1; var daoAluno = new AlunoDAL(); Console.WriteLine("Digite a Matricula para realizar a busca:"); p1 = Convert.ToInt32(Console.ReadLine()); var p2 = (from x in db.Alunos where x.Matricula == p1 select x).FirstOrDefault(); if (p2 == null) { Console.WriteLine($"Matricula {p1} não encontrado."); } else { p2 = daoAluno.ImprimirAluno(p2, p1); Console.WriteLine($"Nome:{p2.Nome}, \nMatricula:{p2.Matricula}, Email:{p2.Email}."); foreach (var item in p2.Endereco) { Console.WriteLine($"Aluno:{p2.Nome}\nTipo de Endereco:{item.TipoEndereco}\nLogradouro:{item.Logradouro}\nCidade:{item.Cidade}, "); Console.WriteLine($"Bairro:{item.Bairro}\nNumero:{item.Bairro}Complemento:{item.Complemento}"); } } }
public void CarregarAlunos() { AlunoDAL a = new AlunoDAL(); dtgAlunos.DataSource = a.ListarTodos(); dtgAlunos.DataBind(); }
public static List <List <object> > AlunoBuscarExercicios() { StreamReader arq = new StreamReader("login.txt"); string CPFAluno = arq.ReadLine(); arq.Close(); string CPFProfessor = AlunoDAL.BuscarExercicios(CPFAluno); return(ExercicioDAL.RetornaExercicios(CPFProfessor)); }
private static void AlterarAluno(AlunosContext db) { int p1; int escolha, escolha2; int a = 0; var end = new List <Endereco>(); var daoAluno = new AlunoDAL(); Console.WriteLine("Digite a Matricula para realizar a alteração:"); p1 = Convert.ToInt32(Console.ReadLine()); var p2 = (from x in db.Alunos where x.Matricula == p1 select x).FirstOrDefault(); if (p2 == null) { Console.WriteLine($"Produto de id {p1} não encontrado."); } else { adicionarAluno(db, p2); Console.Write("Deseja Alterar Tabem O Endereco do Aluno? Se Sim digite 1, Se Nao digite 2: "); escolha = Convert.ToInt32(Console.ReadLine()); switch (escolha) { case 1: { while (a == 0) { Console.Write("1 - Cadastrar novo Endereco\n2 - Alterar Enderenço\n3 - Sair"); escolha2 = Convert.ToInt32(Console.ReadLine()); switch (escolha2) { case 1: adicionarEndereco(db, end); p2.Endereco = end; db.SaveChanges(); break; case 2: alterarEndereco(db, p2.Endereco); break; case 3: a++; break; } } break; } } daoAluno.Alterar(p2); } }
protected void gridAlunos_RowDeleting(object sender, GridViewDeleteEventArgs e) { int index = e.RowIndex; Label lblIdAluno = gridAlunos.Rows[index].FindControl("lblIdAluno") as Label; int IdCurso = Convert.ToInt32(lblIdAluno.Text); AlunoDAL aDAL = new AlunoDAL(); aDAL.Excluir(IdCurso); gridAlunos.EditIndex = -1; CarregarGridView(); }
protected void Page_Load(object sender, EventArgs e) { try { AlunoDAL d = new AlunoDAL(); gridUsuario.DataSource = d.Listar(); //POPULAR A GRID gridUsuario.DataBind(); //EXIBIR O CONTEUDO NO GRID } catch (Exception ex) { lblMensagem.Text = ex.Message; } }
private void BuscarAluno() { string valorBusca = Validations.RemoverMascaraCpf(phTextBox.Text); if (string.IsNullOrEmpty(valorBusca)) { MessageBox.Show("Inclua um cpf, nome ou código para realizar a busca", "Pesquisa", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } valorBusca = phTextBox.Text; try { AlunoDAL alunoDAL = new AlunoDAL(); List <Aluno> list = new List <Aluno>(); if (!Validations.RemoverMascaraCpf(valorBusca).All(char.IsDigit)) { list = alunoDAL.BuscarAlunoPorNome(valorBusca, selecaoAtiva).ToList(); } else { Aluno aluno = alunoDAL.BuscarAluno(valorBusca, selecaoAtiva); if (aluno.Cpf != null) { list.Add(aluno); } } if (list.Count() > 0) { PreencherDatagridAlunos(list); } else { if (selecaoAtiva) { MessageBox.Show("O aluno pretendido não foi localizado com o dado informado. " + "Verifique se este possui mais de uma avaliação cadastrada.", "Pesquisa", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Nenhum aluno foi localizado com o dado informado.", "Pesquisa", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private List <Aluno> BuscarAlunos(bool isSeletivo) { List <Aluno> alunos = new List <Aluno>(); try { AlunoDAL alunoDal = new AlunoDAL(); alunos = alunoDal.ListarAlunos(isSeletivo).ToList(); } catch (Exception ex) { MessageBox.Show(ex.Message); } return(alunos); }
private void CarregarGridView() { try { int IdUsuario = Convert.ToInt32(txtIdUsuario.Text); int IdCurso = Convert.ToInt32(ddl.SelectedItem.Value); AlunoDAL aDAL = new AlunoDAL(); gridAlunos.DataSource = aDAL.Listar(IdUsuario, IdCurso); gridAlunos.DataBind(); } catch (Exception ex) { lblmensagemFalse.Text = ex.Message; } }
private void SalvarAluno() { if (ValidarCamposAluno()) { AlunoDAL alunoDAL = new AlunoDAL(); try { Aluno aluno = new Aluno(); if (editCad) { aluno.CodAluno = codAlunoEdit; } aluno.Cpf = mtxtCpfAlunoCad.Text; aluno.DataNascimento = dtpDataNasc.Value.Date; aluno.Nome = txtNomeAlunoCad.Text; aluno.Sexo = rbtnMasc.Checked ? "M" : "F"; if (alunoDAL.SalvarAluno(aluno, editCad)) { string caption; if (editCad) { caption = "Edição de cadastro"; } else { caption = "Novo cadastro"; } MessageBox.Show("Operação realizada com sucesso.", caption, MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; } } catch (SQLiteException sex) { int codErro = sex.ErrorCode; if (codErro == 19) { MessageBox.Show("Já existe um aluno cadastrado com esse cpf.", "Verifique o cpf", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
private static void ExcluirAluno(AlunosContext db) { int p1; var daoAluno = new AlunoDAL(); Console.WriteLine("Digite a Matricula para realizar a exclusão:"); p1 = Convert.ToInt32(Console.ReadLine()); var p2 = (from x in db.Alunos where x.Matricula == p1 select x).FirstOrDefault(); if (p2 == null) { Console.WriteLine($"Matricula {p1} não encontrado."); } else { daoAluno.Excluir(p2); } }
protected void ddlCurso_SelectedIndexChanged(object sender, EventArgs e) { try { if (!String.IsNullOrEmpty(ddlCurso.SelectedValue)) { int IdUsuario = Convert.ToInt32(txtIdUsuario.Text); int IdCurso = Convert.ToInt32(ddlCurso.SelectedItem.Value); AlunoDAL aDAL = new AlunoDAL(); ddlAluno.DataSource = aDAL.Listar(IdUsuario, IdCurso); ddlAluno.DataBind(); } } catch (Exception ex) { throw new Exception("Erro ao listar Cursos" + ex.Message); } }
private void CarregarAlunos() { try { if (!(IsPostBack)) { int IdUsuario = Convert.ToInt32(txtIdUsuario.Text); int IdCurso = Convert.ToInt32(ddlCurso.SelectedItem.Value); AlunoDAL aDAL = new AlunoDAL(); ddlAluno.DataSource = aDAL.Listar(IdUsuario, IdCurso); ddlAluno.DataBind(); } } catch (Exception ex) { throw new Exception("Erro ao listar Cursos" + ex.Message); } }
protected void gridAlunos_RowUpdating(object sender, GridViewUpdateEventArgs e) { int index = e.RowIndex; Label lblIdAluno = gridAlunos.Rows[index].FindControl("lblIdAluno") as Label; TextBox txtNomeAluno = gridAlunos.Rows[index].FindControl("txtNomeAluno") as TextBox; TextBox txtEmailAluno = gridAlunos.Rows[index].FindControl("txtEmailAluno") as TextBox; Aluno a = new Aluno(); a.IdAluno = Convert.ToInt32(lblIdAluno.Text); a.NomeAluno = Convert.ToString(txtNomeAluno.Text); a.EmailAluno = Convert.ToString(txtEmailAluno.Text); AlunoDAL aDAL = new AlunoDAL(); aDAL.Atualizar(a); gridAlunos.EditIndex = -1; CarregarGridView(); }
protected void btnCadastrarAluno_Click(object sender, EventArgs e) { try { Aluno a = new Aluno(); a.IdInstrutor = Convert.ToInt32(txtIdUsuario.Text); a.IdCurso = Convert.ToInt32(ddl.SelectedItem.Value); a.NomeAluno = txtNomeAluno.Text; a.EmailAluno = txtEmailAluno.Text; AlunoDAL aDAL = new AlunoDAL(); aDAL.Gravar(a); lblmensagemTrue.Text = "O aluno " + a.NomeAluno + " foi adicionado com sucesso."; txtNomeAluno.Text = string.Empty; txtEmailAluno.Text = string.Empty; } catch (Exception) { throw; } }
public AlunoController(IESContext context) { this._context = context; projetoDAL = new ProjetoDAL(context); alunoDAL = new AlunoDAL(context); }
public static void DeletaAlunos() { AlunoDAL.DeletaAlunos(); }
public static bool AlterarSenha(string Senha, string NovaSenha) { return(AlunoDAL.AlterarSenha(Senha, NovaSenha)); }
public static List <Aluno> BuscarTodosalunos() { return(AlunoDAL.BuscarTodosUsuarios()); }
public static List <Aluno> BuscarAlunos() { return(AlunoDAL.BuscarUsuarios()); }
public static bool RetornarAluno(string CPF) { return(AlunoDAL.VincularProfessor(CPF)); }
public static bool Inserir(Aluno novo) { return(AlunoDAL.Inserir(novo)); }
public static Aluno Autenticar(AutenticarEntrada autenticarEntrada) { return(AlunoDAL.AutenticarDAL(autenticarEntrada)); }