public BindingSource vincula(string itemCB) { eventoAplicacao evento = new eventoAplicacao(); BindingSource novoEvento = new BindingSource(); novoEvento.Add(evento.selectDTWhere(itemCB)); return novoEvento; }
private void conEventoForms_Load(object sender, EventArgs e) { this.ActiveMdiChild.Dock = DockStyle.Fill; appEvento = new eventoAplicacao(); appEvento.selectEventos(); foreach (var evento in appEvento.selectEventos()) { eventoCB.Items.Add(evento.Nome); } eventoCB.SelectedIndex = -1; }
private void salvarBtn_Click(object sender, EventArgs e) { try { validaControles = new isEmpty(); foreach (Control child in this.Controls) { string tag = validaControles.empty(child); if (tag != "") { throw new Exception("O campo '" + tag + "' está vazio"); } else { appInsc = new inscricaoEventoAplicacao(); appPart = new participanteAplicacao(); inscricao = new inscricaoEvento(); appInscSem = new inscricaoSeminfoAplicacao(); appEvento = new eventoAplicacao(); evento = new Evento(); if (!appInscSem.jaCadastrado(cpfMsk.Text)) { throw new Exception("CPF ainda não cadastrado!!!"); } if (appInsc.cadastradoEvento(appEvento.retornaCodEv(eventoCB.Text), cpfMsk.Text)) { throw new Exception("CPF já cadastrado neste evento!!!"); } evento = appEvento.selectEventoWhere(eventoCB.Text); int codSeminfo = appInsc.retornoCodSeminfo(cpfMsk.Text); if (appEvento.evSameTime(codSeminfo, evento.Data, evento.Hora)) { throw new Exception("CPF já cadastrado em outro evento no mesmo horário"); } else { inscricao.Evento = evento.Codigo; inscricao.Data = evento.Data; inscricao.codigoSeminfo = codSeminfo; appInsc.salvar(inscricao); MessageBox.Show("Espectador cadastrado com sucesso!"); break; } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void eventoCB_SelectedIndexChanged(object sender, EventArgs e) { try { if (eventoCB.Text != "") { appEvento = new eventoAplicacao(); eventoGV.DataSource = appEvento.selectDTWhere(eventoCB.Text); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void cadInscForms_Load(object sender, EventArgs e) { if (Properties.Settings.Default.Perfil == "Administrador") { } else { cpfMsk.Text = Properties.Settings.Default.CPF; cpfMsk.Enabled = false; } appEvento = new eventoAplicacao(); foreach (var evento in appEvento.selectEventos()) { eventoCB.Items.Add(evento.Nome); } eventoCB.SelectedIndex = -1; this.ActiveMdiChild.Dock = DockStyle.Fill; }
private void salvarBtn_Click(object sender, EventArgs e) { isEmpty validaControles = new isEmpty(); try { foreach (Control child in this.Controls) { string tag = validaControles.empty(child); if (tag != "") { throw new Exception("O campo " + "'" + tag + "'" + " está vazio"); } else { } } var appEvento = new eventoAplicacao(); var evento = new Evento(); evento.Nome = nomeTxt.Text; evento.Local = localTxt.Text; evento.Data = Convert.ToDateTime(dataPck.Text); evento.Hora = Convert.ToDateTime(horaPck.Text); if (palestraRB.Checked) evento.Tipo = palestraRB.Text; else evento.Tipo = minicursoRB.Text; evento.Duracao = Convert.ToInt32(duracaoTxt.Text); evento.Descricao = descricaoTxt.Text; evento.CodPal = Convert.ToInt32(codPTxt.Text); evento.Vagas = Convert.ToInt32(vagasTxt.Text); appEvento.salvaEvento(evento, 0); MessageBox.Show("Salvo com sucesso!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }