private void CarregaComboBox() { //ComboBox Professor ProfessorBLL professorbll = new ProfessorBLL(); cbbProfessor.DataSource = professorbll.Preencher(); cbbProfessor.DisplayMember = "nome"; cbbProfessor.ValueMember = "id"; //ComboBox Disciplina DisciplinaBLL disciplinabll = new DisciplinaBLL(); cbbDisciplina.DataSource = disciplinabll.Preencher(); cbbDisciplina.DisplayMember = "nome"; cbbDisciplina.ValueMember = "id"; //ComboBox Sala SalaBLL salabll = new SalaBLL(); cbbSala.DataSource = salabll.Preencher(); cbbSala.DisplayMember = "nome"; cbbSala.ValueMember = "id"; //ComboBox Serie SerieBLL seriebll = new SerieBLL(); cbbSerie.DataSource = seriebll.Preencher(); cbbSerie.DisplayMember = "nome"; cbbSerie.ValueMember = "id"; //ComboBox Turma TurmaBLL turmabll = new TurmaBLL(); cbbTurma.DataSource = turmabll.Preencher(); cbbTurma.DisplayMember = "nome"; cbbTurma.ValueMember = "id"; }
private void CarregaComboBox() { ProfessorBLL professor = new ProfessorBLL(); cbbProfessor.DataSource = professor.Preencher(); cbbProfessor.DisplayMember = "nome"; cbbProfessor.ValueMember = "id"; DisciplinaBLL disciplina = new DisciplinaBLL(); cbbDisciplina.DataSource = disciplina.Preencher(); cbbDisciplina.DisplayMember = "nome"; cbbDisciplina.ValueMember = "id"; }
private void btCadastrarDisciplina_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtDisciplina.Text)) { DisciplinaBLL bll = new DisciplinaBLL(); DisciplinaDTO dto = new DisciplinaDTO(); string nome = txtDisciplina.Text.Replace("'", "''"); dto.Nome = txtDisciplina.Text; bll.Inserir(dto); MessageBox.Show("Cadastro efetuado com sucesso!", "Sucesso"); LimpaTela(3); return; } MessageBox.Show("Por favor preencha o campo.", "Aviso"); return; }
private void Carregar() { ddlProfessor.DataSource = ProfessorBLL.Listar().OrderBy(x => x.Nome); ddlProfessor.DataBind(); ddlProfessor.Items.Insert(0, new ListItem("Selecione", "0")); ddlDisciplina.DataSource = DisciplinaBLL.Listar().OrderBy(x => x.Descricao); ddlDisciplina.DataBind(); ddlDisciplina.Items.Insert(0, new ListItem("Selecione", "0")); ddlTurma.DataSource = TurmaBLL.Listar().OrderBy(x => x.Descricao); ddlTurma.DataBind(); ddlTurma.Items.Insert(0, new ListItem("Selecione", "0")); ddlProfessor.SelectedIndex = ddlTurma.SelectedIndex = ddlDisciplina.SelectedIndex = 0; }