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"; }
public void CarregaDetalhes(int idTurma) { panelEdit.Visible = true; panelConsulta.Visible = false; this.ControlBox = false; TurmaDTO param = new TurmaDTO(); param.idTurma = idTurma; param = new TurmaBLL().GetByID(param); // ************************************************** // // Preenche Tela de Detalhes // ************************************************** // lblCodigo.Text = param.idTurma.ToString(); cmbProjeto.SelectedValue = param.idProjeto; if (param.idProjeto != 0 && cmbProjeto.SelectedValue == null) { List <ProjetoDTO> lista = new ProjetoBLL().GetAllData(true); lista.Add(new ProjetoDTO() { idProjeto = param.idProjeto, nomeProjeto = param.nomeProjeto }); cmbProjeto.DataSource = lista; } txtNome.Text = param.nomeTurma; cmbStatus.SelectedIndex = (param.flagAtivo) ? 1 : 0; ddlEducador.SelectedValue = param.idPessoaEducador; if (param.idPessoaEducador != 0 && ddlEducador.SelectedValue == null) { List <PessoaDTO> lista = new PessoaBLL().GetPessoasPorTipo(TipoPessoa.Educador); lista.Add(new PessoaDTO() { idPessoa = param.idPessoaEducador, nomePessoa = param.nomeEducador }); cmbProjeto.DataSource = lista; } cmbPeriodo.Text = param.descricaoPeriodo; cmbHoraInicio.Text = param.horaInicio.Split(':')[0]; cmbMinutoInicio.Text = param.horaInicio.Split(':')[1]; cmbHoraFim.Text = param.horaTermino.Split(':')[0]; cmbMinutoFim.Text = param.horaTermino.Split(':')[1]; txtDescricao.Text = param.descricaoTurma; txtdtCadastro.Text = param.dtCadastro.ToShortDateString(); txtDataAlteracao.Text = param.dtUltAlteracao.ToShortDateString(); txtNomeAlteracao.Text = param.nomePessoaUltAlteracao; ControlFormEdit(false); }
private void btnAll_Click(object sender, EventArgs e) { ClearForm1(); List <TurmaDTO> lista = new TurmaBLL().GetAllData(); Grid.GridViewDataBind(lista.ToDataTable(), gridMessage); }
private void btCadastrarTurma_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtSala.Text)) { SalaDTO dto = new SalaDTO(); SalaBLL bll = new SalaBLL(); string sala = txtSala.Text.Replace("'", "''"); dto.Nome = sala; bll.Inserir(dto); MessageBox.Show("Cadastro efetuado com sucesso!", "Sucesso"); LimpaTela(1); } else if (!string.IsNullOrEmpty(txtSerie.Text)) { SerieBLL bll = new SerieBLL(); SerieDTO dto = new SerieDTO(); string serie = txtSerie.Text.Replace("'", "''"); dto.Nome = serie; bll.Inserir(dto); MessageBox.Show("Cadastro efetuado com sucesso!", "Sucesso"); LimpaTela(1); } else if (!string.IsNullOrEmpty(txtTurma.Text)) { TurmaBLL bll = new TurmaBLL(); TurmaDTO dto = new TurmaDTO(); string turma = txtTurma.Text.Replace("'", "''"); dto.Nome = turma; bll.Inserir(dto); MessageBox.Show("Cadastro efetuado com sucesso!", "Sucesso"); LimpaTela(1); } else { MessageBox.Show("Por favor preencha um ou mais campos antes de cadastrar.", "Aviso"); return; } }
public void CarregaComboTurma(int idProjeto) { List <TurmaDTO> lista = new TurmaBLL().GetTurmasPorProjeto(idProjeto); lista.Insert(0, new TurmaDTO() { idTurma = 0, nomeTurma = "Selecione..." }); this.cmbTurma.DataSource = null; this.cmbTurma.Items.Clear(); this.cmbTurma.DisplayMember = "nomeTurma"; this.cmbTurma.ValueMember = "idTurma"; this.cmbTurma.DataSource = lista; this.cmbTurma.SelectedValue = 0; }
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; }
private void btnSearch_Click(object sender, EventArgs e) { var param = new TurmaDTO(); if (cmbSearchType.SelectedItem.ToString() == "Nome da Turma") { param.nomeTurma = txtSearch.Text; } else if (cmbSearchType.SelectedItem.ToString() == "Código da Turma") { if (txtSearch.Text != string.Empty) { param.idTurma = Convert.ToInt32(txtSearch.Text); } } List <TurmaDTO> lista = new TurmaBLL().GetDataWithParam(param); Grid.GridViewDataBind(lista.ToDataTable(), gridMessage); }
private void CarregaComboBox() { //ComboBox Sala SalaBLL salabll = new SalaBLL(); cbbSala.DataSource = salabll.Preencher(); cbbSala.DisplayMember = "nome"; cbbSala.ValueMember = "nome"; //ComboBox Serie SerieBLL seriebll = new SerieBLL(); cbbSerie.DataSource = seriebll.Preencher(); cbbSerie.DisplayMember = "nome"; cbbSerie.ValueMember = "nome"; //ComboBox Turma TurmaBLL turmabll = new TurmaBLL(); cbbTurma.DataSource = turmabll.Preencher(); cbbTurma.DisplayMember = "nome"; cbbTurma.ValueMember = "nome"; }
private void btnGravar_Click(object sender, EventArgs e) { TurmaDTO param = new TurmaDTO(); if (lblCodigo.Text == string.Empty) { param.idTurma = 0; } else { param.idTurma = Convert.ToInt32(lblCodigo.Text); } param.nomeTurma = txtNome.Text; param.flagAtivo = (cmbStatus.SelectedIndex == 0) ? false : true; param.descricaoPeriodo = cmbPeriodo.SelectedItem.ToString(); param.horaInicio = cmbHoraInicio.SelectedItem + ":" + cmbMinutoInicio.SelectedItem; param.horaTermino = cmbHoraFim.SelectedItem + ":" + cmbMinutoFim.SelectedItem; param.descricaoTurma = txtDescricao.Text; param.idProjeto = Convert.ToInt32(cmbProjeto.SelectedValue); param.idPessoaUltAlteracao = Sessao.Usuario.idPessoaUltAlteracao; param.idPessoaEducador = Convert.ToInt32(ddlEducador.SelectedValue); TurmaBLL bus = new TurmaBLL(); var idTurma = bus.SaveProject(param); if (idTurma > 0) { lblCodigo.Text = idTurma.ToString(); MessageBox.Show("Turma gravado com sucesso!"); CarregaGrid(); } else { throw new Exception("Erro de Gravação do Turma"); } }
public void CarregaGrid() { List <TurmaDTO> lista = new TurmaBLL().GetAllData(); Grid.GridViewDataBind(lista.ToDataTable(), gridMessage); }