private void btnBuscar_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(txtNome.Text)) { nivel = NivelDAO.BuscarNivelPorNome(txtNome.Text); if (nivel != null) { btnCadastrar.IsEnabled = false; btnAlterar.IsEnabled = true; btnRemover.IsEnabled = true; txtId.Text = nivel.Id.ToString(); txtNome.Text = nivel.Nome; txtOrdenacao.Text = nivel.Ordenacao.ToString(); txtCriadoEm.Text = nivel.CriadoEm.ToString(); } else { MessageBox.Show("Este nível não existe!!!", "Vendas WPF", MessageBoxButton.OK, MessageBoxImage.Error); LimparFormulario(); } } else { MessageBox.Show("Preencha o campo nome!!!", "Vendas WPF", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void btnCadastrar_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(txtNome.Text)) { nivel = new Nivel { Nome = txtNome.Text, Ordenacao = Convert.ToInt32(txtOrdenacao.Text) }; if (NivelDAO.BuscarNivelPorOrdenacao(nivel.Ordenacao) == null) { if (NivelDAO.Cadastrar(nivel)) { MessageBox.Show("Nível cadastrado com sucesso!", "Matricula WPF", MessageBoxButton.OK, MessageBoxImage.Information); LimparFormulario(); } else { MessageBox.Show("Este nível já existe", "Matricula WPF", MessageBoxButton.OK, MessageBoxImage.Error); } } else { MessageBox.Show("Esta ordenação já existe", "Matricula WPF", MessageBoxButton.OK, MessageBoxImage.Error); } } else { MessageBox.Show("Preencha o campo nome!", "Matricula WPF", MessageBoxButton.OK, MessageBoxImage.Error); } }
public TurmaController(TurmaDAO turmaDAO, NivelDAO nivelDAO, AdministracaoHorarioDAO administracaohorarioDAO) { _turmaDAO = turmaDAO; _nivelDAO = nivelDAO; _administracaohorarioDAO = administracaohorarioDAO; }
private void btnAdicionar_Click(object sender, RoutedEventArgs e) { //if (cboAdms.SelectedValue ?? null && cboNiveis.SelectedValue ?? null) //{ //int idmentor = (int)cboAdms.SelectedValue; //int iddisciplina = (int)cboNiveis.SelectedValue; //MessageBox.Show($"ID mentor: {id} - ID disciplina: {iddisc}"); turma = new Turma(); AdministracaoHorario a = new AdministracaoHorario(); Nivel n = new Nivel(); //colocar throw exception aqui para quando nao vir informado dados na combobox a.Id = (int)cboAdms.SelectedValue; n.Id = (int)cboNiveis.SelectedValue; n = NivelDAO.BuscarNivelPorId(n.Id); if (n != null) { turma.Nivel = n; a = AdministracaoHorarioDAO.BuscarAdmPorId(a.Id); if (a != null) { turma.AdministracaoHorario = a; //turma.Descricao = "Turma referente ao nível: " + n.Nome; if (TurmaDAO.Cadastrar(turma)) { MessageBox.Show("Atrelamento realizado com sucesso!", "Matricula WPF", MessageBoxButton.OK, MessageBoxImage.Information); LimparFormulario(); } else { MessageBox.Show("Atrelamento já existente!", "Matricula WPF", MessageBoxButton.OK, MessageBoxImage.Information); LimparFormulario(); } } else { MessageBox.Show("Administração não localizada", "Matricula WPF", MessageBoxButton.OK, MessageBoxImage.Information); LimparFormulario(); } } else { MessageBox.Show("Nível não localizado!", "Matricula WPF", MessageBoxButton.OK, MessageBoxImage.Information); LimparFormulario(); } }
private void btnAdicionar_Click(object sender, RoutedEventArgs e) { //if (cboNiveis.SelectedValue ?? null && cboAlunos.SelectedValue ?? null) //{ //int idmentor = (int)cboNiveis.SelectedValue; //int iddisciplina = (int)cboAlunos.SelectedValue; //MessageBox.Show($"ID mentor: {id} - ID disciplina: {iddisc}"); historicoaluno = new HistoricoAluno(); Nivel n = new Nivel(); Aluno a = new Aluno(); //colocar throw exception aqui para quando nao vir informado dados na combobox n.Id = (int)cboNiveis.SelectedValue; a.Id = (int)cboAlunos.SelectedValue; n = NivelDAO.BuscarNivelPorId(n.Id); if (n != null) { historicoaluno.Nivel = n; a = AlunoDAO.BuscarAlunoPorId(a.Id); if (a != null) { historicoaluno.Aluno = a; if (HistoricoAlunoDAO.Cadastrar(historicoaluno)) { MessageBox.Show("Atrelamento realizado com sucesso!", "Matricula WPF", MessageBoxButton.OK, MessageBoxImage.Information); LimparFormulario(); } else { MessageBox.Show("Atrelamento já existente!", "Matricula WPF", MessageBoxButton.OK, MessageBoxImage.Information); LimparFormulario(); } } else { MessageBox.Show("Aluno não localizado", "Matricula WPF", MessageBoxButton.OK, MessageBoxImage.Information); LimparFormulario(); } } else { MessageBox.Show("Nivel não localizado!", "Matricula WPF", MessageBoxButton.OK, MessageBoxImage.Information); LimparFormulario(); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { //Carregar os dados de mentores cboNiveis.ItemsSource = NivelDAO.Listar(); //cboNiveis.DisplayMemberPath = "Nome"; cboNiveis.SelectedValuePath = "Id"; //Carregar os dados da disciplina cboAlunos.ItemsSource = AlunoDAO.Listar(); //cboAlunos.DisplayMemberPath = "Nome"; cboAlunos.SelectedValuePath = "Id"; }
private void Window_Loaded(object sender, RoutedEventArgs e) { //Carregar os dados de adms cboAdms.ItemsSource = AdministracaoHorarioDAO.Listar(); //cboAdms.DisplayMemberPath = "Nome"; cboAdms.SelectedValuePath = "Id"; //Carregar os dados de niveis cboNiveis.ItemsSource = NivelDAO.Listar(); //cboNiveis.DisplayMemberPath = "Nome"; cboNiveis.SelectedValuePath = "Id"; }
public void ActualizarNivel(NivelDTO nivel) { var b = new NivelDAO(); if (nivel.Id > 0) { b.ActualizarNivel(nivel, true); } else { b.ActualizarNivel(nivel, false); } }
protected void btnApagar_Click(object sender, EventArgs e) { Nivel nivel = new Nivel(); NivelDAO daoNivel = new NivelDAO(); nivel.Id = codigo; if (daoNivel.Apagar(nivel)) { lblMensagem.Text = "Nível apagado com sucesso!"; } else { lblMensagem.Text = "Erro ao apagar nível"; } }
private void btnRemover_Click(object sender, RoutedEventArgs e) { if (nivel != null) { NivelDAO.Remover(nivel); MessageBox.Show("Nível foi removido com sucesso!!!", "Vendas WPF", MessageBoxButton.OK, MessageBoxImage.Error); } else { MessageBox.Show("O nível não foi removida!!!", "Vendas WPF", MessageBoxButton.OK, MessageBoxImage.Error); } LimparFormulario(); }
private void btnAlterar_Click(object sender, RoutedEventArgs e) { if (nivel != null) { nivel.Nome = txtNome.Text; nivel.Ordenacao = Convert.ToInt32(txtOrdenacao.Text); NivelDAO.Alterar(nivel); MessageBox.Show("O nível foi alterada com sucesso!!!", "Vendas WPF", MessageBoxButton.OK, MessageBoxImage.Error); } else { MessageBox.Show("O nível não foi alterado!!!", "Vendas WPF", MessageBoxButton.OK, MessageBoxImage.Error); } LimparFormulario(); }
protected void btnGravar_Click(object sender, EventArgs e) { Nivel nivel = new Nivel(); NivelDAO daoNivel = new NivelDAO(); nivel.Descricao = ttbDescricao.Text; if (codigo == 0) { if (!daoNivel.verificaNivelCadastrado(ttbDescricao.Text)) { if (daoNivel.Gravar(nivel)) { lblMensagem.Text = "Nível cadastrado com sucesso!"; } else { lblMensagem.Text = "Erro ao efetuar cadastro!"; } } else { lblMensagem.Text = "Já existe uma nível com essa descrição cadastrada"; } } else { if (!daoNivel.verificaNivelCadastrado(ttbDescricao.Text, codigo)) { nivel.Id = codigo; if (daoNivel.Editar(nivel)) { lblMensagem.Text = "Nível editado com sucesso!"; } else { lblMensagem.Text = "Erro ao editar cadastro!"; } } else { lblMensagem.Text = "Já existe uma nível com essa descrição cadastrada"; } } }
protected void Page_Load(object sender, EventArgs e) { int.TryParse(Request.QueryString["cod"], out codigo); if (!IsPostBack) { gvNiveis.DataSource = new NivelDAO().LocalizarTudo(); gvNiveis.DataBind(); if (codigo > 0) { DataTable dtNivel = new NivelDAO().pegarPorId(codigo); if (dtNivel.Rows.Count > 0) { ttbDescricao.Text = dtNivel.Rows[0]["niv_descricao"].ToString(); btnApagar.Visible = true; btnCancelar.Visible = true; } } } }
public DataTable listarNivel()// Metodo que obtiene en forma de lista los niveles de usuario { DataTable dt = new DataTable("Nivel"); dt.Columns.Add("Id"); dt.Columns.Add("Nivel"); try { sql = "SELECT id, nombre FROM nivel ORDER BY nombre ASC;"; List <Nivel> nivelLista = NivelDAO.getInstance().Listar(sql); for (int i = 0; i < nivelLista.Count; i++) { dt.Rows.Add(nivelLista[i].id, nivelLista[i].nombre); } return(dt); } catch (Exception ex) { MessageBox.Show(ex.Message); return(dt); } }
public int BorrarNivel(int id) { NivelDAO nivelDao = new NivelDAO(); return(nivelDao.BorrarNivel(id)); }
public void ActivarNivel(int id) { NivelDAO nivelDao = new NivelDAO(); nivelDao.ActivarNivel(id); }
public void EditarNivel(NivelDTO curso) { var b = new NivelDAO(); b.ActualizarNivel(curso, false); }
public NivelDTO ObtenerPeriodo(int idNivel, int idInstitucion) { var b = new NivelDAO(); return(b.ObtenerNivel(idNivel, idInstitucion)); }
public List <NivelDTO> ObtenerNiveles(int idInstitucion) { var b = new NivelDAO(); return(b.ObtenerNiveles(idInstitucion)); }
public List <NivelDTO> ObtenerCatalogoNiveles() { var b = new NivelDAO(); return(b.ObtenerCatalogoNiveles()); }
public NivelServico(NivelDAO nivelDAO) { this.nivelDAO = nivelDAO; }
public NivelController(NivelDAO nivelDAO) => _nivelDAO = nivelDAO;