private void button1_Click(object sender, EventArgs e) { try { int id = int.Parse(textBox1.Text); string nome = textBox2.Text; string email = (textBox3.Text); string telefone = (textBox4.Text); string atribuicoes = textBox5.Text; Palestrante Palestrante = new Palestrante(id, nome, email, telefone, atribuicoes); PalestranteDAO PalestranteDAO = new PalestranteDAO(); PalestranteDAO.Incluir(Palestrante); MessageBox.Show("Palestrante cadastrado com sucesso!"); } catch (OracleException ex) { MessageBox.Show(ex.Message); } }
private void pictureBox1_Click(object sender, EventArgs e) { try { Palestrante Palestrante; PalestranteDAO PalestranteDAO = new PalestranteDAO(); Palestrante = PalestranteDAO.Buscar(textBox1.Text); textBox2.Text = Palestrante.Nome; textBox3.Text = Palestrante.Email; textBox4.Text = Palestrante.Telefone; textBox5.Text = Palestrante.Atribuicoes; } catch (Exception) { MessageBox.Show("Esse ID não está cadastrado, verifique!"); } }
void CarregaDadosIniciais() { ddlData.DataSource = new EventoDAO().DatasEvento(null); ddlDataFiltro.DataSource = new EventoDAO().DatasEvento(null); List <Sala> salas = new SalaDAO().ListarTodos(string.Empty).OrderBy(s => s.Nome).ToList(); if (salas.Count > 0) { Dictionary <int, string> dictionarySalas = new Dictionary <int, string>(); for (int i = 0; i < salas.Count; i++) { dictionarySalas.Add(salas[i].Codigo, salas[i].Nome); } ddlSala.DataSource = new BindingSource(dictionarySalas, null); ddlSala.DisplayMember = "Value"; ddlSala.ValueMember = "Key"; ddlSala.SelectedIndex = -1; } List <Sala> salasFiltro = new SalaDAO().ListarTodos(string.Empty).OrderBy(s => s.Nome).ToList(); if (salasFiltro.Count > 0) { Dictionary <int, string> dictionarySalasFiltro = new Dictionary <int, string>(); for (int i = 0; i < salasFiltro.Count; i++) { dictionarySalasFiltro.Add(salasFiltro[i].Codigo, salasFiltro[i].Nome); } ddlSalaFiltro.DataSource = new BindingSource(dictionarySalasFiltro, null); ddlSalaFiltro.DisplayMember = "Value"; ddlSalaFiltro.ValueMember = "Key"; ddlSalaFiltro.SelectedIndex = -1; } //ddlSalaFiltro.DataSource = new SalaDAO().ListarTodos(); List <Palestrante> palestrantes = new PalestranteDAO().ListarTodos(); if (palestrantes.Count > 0) { Dictionary <int, string> dictionaryPalestrantes = new Dictionary <int, string>(); for (int i = 0; i < palestrantes.Count; i++) { dictionaryPalestrantes.Add(palestrantes[i].Codigo, palestrantes[i].Nome); } ddlPalestrante.DataSource = new BindingSource(dictionaryPalestrantes, null); ddlPalestrante.DisplayMember = "Value"; ddlPalestrante.ValueMember = "Key"; ddlPalestrante.SelectedIndex = -1; } List <Palestrante> palestrantesFiltro = new PalestranteDAO().ListarTodos(); if (palestrantesFiltro.Count > 0) { Dictionary <int, string> dictionaryPalestrantesFiltro = new Dictionary <int, string>(); for (int i = 0; i < palestrantesFiltro.Count; i++) { dictionaryPalestrantesFiltro.Add(palestrantesFiltro[i].Codigo, palestrantesFiltro[i].Nome); } ddlFiltroPalestrantes.DataSource = new BindingSource(dictionaryPalestrantesFiltro, null); ddlFiltroPalestrantes.DisplayMember = "Value"; ddlFiltroPalestrantes.ValueMember = "Key"; ddlFiltroPalestrantes.SelectedIndex = -1; } //.DataSource = //ddlFiltroPalestrantes.DataSource = new PalestranteDAO().ListarTodos(); ddlData.SelectedIndex = -1; ddlDataFiltro.SelectedIndex = -1; ddlSala.SelectedIndex = -1; ddlSalaFiltro.SelectedIndex = -1; ddlPalestrante.SelectedIndex = -1; ddlFiltroPalestrantes.SelectedIndex = -1; tbxHorario.Text = tbxTema.Text = string.Empty; MostrarDados(); dataGridView1.Columns["Codigo"].Visible = dataGridView1.Columns["Data"].Visible = dataGridView1.Columns["Hora"].Visible = dataGridView1.Columns["Data"].Visible = dataGridView1.Columns["ArquivoPalestra"].Visible = dataGridView1.Columns["Tema"].Visible = false; dataGridView1.Columns["TemaFormatado"].HeaderText = "Tema"; }