Exemplo n.º 1
0
 private void salvarBtn_Click(object sender, EventArgs e)
 {
     isEmpty 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
         { }
     }
     var cpf = participante.Cpf;
     participante.Cpf = cpfMsk.Text;
     participante.Nome = nomeTxt.Text;
     participante.Telefone = telTxt.Text;
     participante.Email = emailTxt.Text;
     participante.Curso = cursoCB.Text;
     participante.Periodo = int.Parse(periodoTxt.Text);
     participante.Senha = senhaTxt.Text;
     participante.Perfil = perfilCB.Text;
     participante.Login = loginTxt.Text;
     appPart.salvaParticipante(participante, cpf);
     MessageBox.Show("Informação(ões) alterada(s) com sucesso");
 }
Exemplo n.º 2
0
 private void salvarBtn_Click(object sender, EventArgs e)
 {
     isEmpty validaControles = new isEmpty();
     try
     {
         foreach (Control child in this.Controls.Cast<Control>().OrderBy(c => c.TabIndex))
         {
             string tag = validaControles.empty(child);
             if (tag != "")
             {
                 throw new Exception("O campo " + "'" + tag + "'" + " está vazio");
             }
             else
             { }
         }
         var appPalest = new palestranteAplicacao();
         Palestrante palestrante = new Palestrante();
         palestrante.Nome = nomeTxt.Text;
         palestrante.Titulacao = titulacaoCB.Text;
         palestrante.Cidade = cidadeTxt.Text;
         palestrante.Email = emailTxt.Text;
         palestrante.Telefone = telMsk.Text;
         palestrante.MiniCurriculum = miniCTxt.Text;
         appPalest.salvaPalestrante(palestrante, palestrante.Nome);
         MessageBox.Show("Palestrante salvo com sucesso!");
     }
     catch(Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 3
0
        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
                    { }
                }

                palestrante = new Palestrante();
                palestrante.Codigo = int.Parse(codValorLbl.Text);
                palestrante.Nome = nomeTxt.Text;
                palestrante.Cidade = cidadeTxt.Text;
                palestrante.Email = emailTxt.Text;
                palestrante.MiniCurriculum = miniCTxt.Text;
                palestrante.Telefone = telMsk.Text;
                palestrante.Titulacao = titulacaoCB.Text;
                palesApp.salvaPalestrante(palestrante, nome);
                MessageBox.Show("Palestrante salvo com sucesso!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 4
0
 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
             { }
         }
         evento.Codigo = codigo;
         evento.Nome = nomeTxt.Text;
         evento.Local = localTxt.Text;
         evento.Data = DateTime.Parse(dataPck.Text);
         evento.Hora = DateTime.Parse(horaPck.Text);
         evento.CodPal = int.Parse(codPTxt.Text);
         evento.Duracao = int.Parse(duracaoTxt.Text);
         evento.Vagas = int.Parse(vagasTxt.Text);
         evento.Descricao = descricaoTxt.Text;
         appEvento.salvaEvento(evento, codigo);
         MessageBox.Show("Alterações salvas com sucesso!");
     }
     catch(Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 5
0
        private void salvarBtn_Click(object sender, EventArgs e)
        {
            isEmpty validaControles = new isEmpty();
            try
            {
                foreach (Control child in this.Controls.Cast<Control>().OrderBy(c => c.TabIndex))
                {
                    string tag = validaControles.empty(child);
                    if (tag != "")
                    {
                        throw new Exception("O campo " + "'" + tag + "'" + " está vazio");
                    }
                    else
                    { }
                }
                cpfMsk.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
                telTxt.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
                participante.Cpf = cpfMsk.Text;
                participante.Nome = nomeTxt.Text;
                participante.Curso = cursoCB.Text;
                participante.Periodo = int.Parse(periodoTxt.Text);
                participante.Telefone = telTxt.Text;
                participante.Email = emailTxt.Text;
                participante.Login = loginTxt.Text;
                participante.Senha = senhaTxt.Text;
                participante.Perfil = perfilCB.Text;
                appPart.salvaParticipante(participante, participante.Cpf);
                MessageBox.Show("Participante salvo com sucesso!");
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 6
0
        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);
            }
        }
Exemplo n.º 7
0
        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);
            }
        }
Exemplo n.º 8
0
 private void buscarBtn_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
             { }
         }
         inscGV.DataSource = appEvento.retornaEventosInscritos(cpfMsk.Text);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 9
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            validaLogin logar = new validaLogin();
            isEmpty validaControles = new isEmpty();
            Thread th;
            try
            {
                foreach (Control child in this.Controls)
                {
                    string tag = validaControles.empty(child);
                    if (tag != "")
                    {
                        throw new Exception("O campo " + "'" + tag + "'" + " está vazio");
                    }
                    else
                    { }
                }
                Properties.Settings.Default.Perfil = logar.logar(loginTxt.Text, senhaTxt.Text);
                Properties.Settings.Default.CPF = logar.cpfLogin(loginTxt.Text, senhaTxt.Text);
                if (Properties.Settings.Default.Perfil == "Aluno" || Properties.Settings.Default.Perfil == "Administrador")
                {
                    MessageBox.Show("Login efetuado com sucesso!", "Bem-vindo");
                    this.Close();
                    th = new Thread(openNewForm);
                    th.SetApartmentState(ApartmentState.STA);
                    th.Start();
                }
                else
                {
                    MessageBox.Show("Usuário ou senha inexistente");
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 10
0
 private void salvarBtn_Click(object sender, EventArgs e)
 {
     try
     {
         isEmpty 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
             { }
         }
         inscricaoSeminfoAplicacao appInsc = new inscricaoSeminfoAplicacao();
         if (appInsc.jaCadastrado(cpfMsk.Text))
         {
             throw new Exception("CPF já cadastrado na SEMINFO!");
         }
         else if (!appInsc.jaCadastrado(cpfMsk.Text))
         {
             throw new Exception("CPF inexistente!");
         }
         else
         {
             inscricaoSeminfo insc = new inscricaoSeminfo();
             insc.Data = DateTime.Parse(dataPck.Text);
             insc.ParticipanteCpf = cpfMsk.Text;
             appInsc.insereInscricao(insc);
             MessageBox.Show("Participante cadastrado com sucesso!!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }