Exemple #1
0
        private void btnListarTurmas_Click(object sender, EventArgs e)
        {
            BancoAcademia.LerArquivoTurma(ListaCodigoTurma, ListaTipoTurma, ListaHorarioTurma, ListaDiasTurma);
            BancoAcademia.LerArquivoProf(ListaCpfProf, ListaNomeProf, ListaSobrenomeProf, ListaSenhaProf, ListaTelefoneProf, ListaRgProf, ListaGeneroProf, ListaDataProf, ListaCodigoTurmaProf);
            if (ListaCodigoTurma.Count == 0)
            {
                DialogResult resposta;
                resposta = MessageBox.Show("Não há turmas cadastradas, deseja criar uma turma nova?", "Erro", MessageBoxButtons.YesNo);
                if (resposta == DialogResult.Yes)
                {
                    new CadastroTurmas().Show();
                }
            }
            listView1.Items.Clear();
            string[]     vetorDeTeste = new string[5];
            ListViewItem itm;

            for (int i = 0; i < ListaCodigoTurma.Count; i++)
            {
                vetorDeTeste[0] = ListaCodigoTurma[i].ToString();
                vetorDeTeste[1] = ListaTipoTurma[i].ToString();
                vetorDeTeste[2] = ListaHorarioTurma[i].ToString();
                vetorDeTeste[3] = ListaDiasTurma[i].ToString();
                itm             = new ListViewItem(vetorDeTeste);
                listView1.Items.Add(itm);
            }
        }
Exemple #2
0
 private void BtnLogin_Click(object sender, EventArgs e)
 {
     if (cbxLogin.Text == "Admin")
     {
         string login = txtLogin.Text;
         string senha = txtSenha.Text;
         if (BancoAcademia.Autenticação(ListaIdAdmin, login))
         {
             if (BancoAcademia.Autenticação(ListaSenhaAdmin, senha))
             {
                 MessageBox.Show("Login realizado com sucesso, seja bem-vindo.", "Bem-vindo", MessageBoxButtons.OK);
                 formTurmas turmas = new formTurmas();
                 turmas.Show();
             }
             else
             {
                 MessageBox.Show("Senha incorreta para este ID, verifique sua senha e tente novamente.", "Erro de senha", MessageBoxButtons.OK);
                 txtSenha.Clear();
                 txtSenha.Focus();
             }
         }
         else
         {
             MessageBox.Show("ID não registrado, verifique se seu ID foi escrito corretamente.", "Erro de ID", MessageBoxButtons.OK);
             txtLogin.Focus();
         }
     }
     else if (cbxLogin.Text == "Professor")
     {
         BancoAcademia.LerArquivoProf(ListaCpfProf, ListaNomeProf, ListaSobrenomeProf, ListaSenhaProf, ListaTelefoneProf, ListaRgProf, ListaGeneroProf, ListaNascimentoProf, ListaCodigoTurmaProf);
         string loginProf = txtLogin.Text;
         string senhaProf = txtSenha.Text;
         if (BancoAcademia.Autenticação(ListaCpfProf, loginProf))
         {
             if (BancoAcademia.Autenticação(ListaSenhaProf, senhaProf))
             {
                 MessageBox.Show("Login realizado com sucesso, seja bem-vindo.", "Bem-vindo", MessageBoxButtons.OK);
                 formTurmas turmas = new formTurmas();
                 turmas.Show();
             }
             else
             {
                 MessageBox.Show("Senha incorreta para este ID, verifique sua senha e tente novamente.", "Erro de senha", MessageBoxButtons.OK);
                 txtSenha.Clear();
                 txtSenha.Focus();
             }
         }
         else
         {
             MessageBox.Show("ID não registrado, verifique se seu ID foi escrito corretamente.", "Erro de ID", MessageBoxButtons.OK);
             txtLogin.Focus();
         }
     }
 }
Exemple #3
0
 private void CadastroProfessores_Load(object sender, EventArgs e)
 {
     txtNomeTurma.Enabled = false;
     BancoAcademia.LerArquivoTurma(ListaCodigoTurma, ListaTipoTurma, ListaHorarioTurma, ListaDiasTurma);
     BancoAcademia.LerArquivoProf(ListaCpfProf, ListaNomeProf, ListaSobrenomeProf, ListaSenhaProf, ListaTelefoneProf, ListaRgProf, ListaGeneroProf, ListaNascimentoProf, ListaCodigoTurmaProf);
     foreach (string gen in genero)
     {
         cbxGeneroProf.Items.Add(gen);
     }
     foreach (string turma in ListaCodigoTurma)
     {
         cbxTurmasOn.Items.Add(turma);
     }
 }
        private void BtnListarProf_Click(object sender, EventArgs e)
        {
            BancoAcademia.LerArquivoTurma(ListaCodigoTurma, ListaTipoTurma, ListaHorarioTurma, ListaDiasTurma);
            BancoAcademia.LerArquivoProf(ListaCpfProf, ListaNomeProf, ListaSobrenomeProf, ListaSenhaProf, ListaTelefoneProf, ListaRgProf, ListaGeneroProf, ListaDataProf, ListaCodigoTurmaProf);
            if (ListaCpfProf.Count == 0)
            {
                DialogResult resposta;
                resposta = MessageBox.Show("Não há professores cadastrados, deseja cadastrar um novo professor?", "Erro", MessageBoxButtons.YesNo);
                if (resposta == DialogResult.Yes)
                {
                    new CadastroProfessores().Show();
                }
            }
            lvProf.Items.Clear();
            string[]     dadosProf = new string[8];
            ListViewItem prof;

            for (int i = 0; i < ListaCpfProf.Count; i++)
            {
                dadosProf[0] = ListaCpfProf[i].ToString();
                dadosProf[1] = ListaNomeProf[i].ToString();
                dadosProf[2] = ListaSobrenomeProf[i].ToString();
                dadosProf[3] = ListaTelefoneProf[i].ToString();
                dadosProf[4] = ListaRgProf[i].ToString();
                dadosProf[5] = ListaGeneroProf[i].ToString();
                dadosProf[6] = ListaDataProf[i].ToString();
                if (ListaCodigoTurma.Count != 0)
                {
                    for (int j = 0; j < ListaCodigoTurma.Count; j++)
                    {
                        if (ListaCodigoTurmaProf[i].ToString() == ListaCodigoTurma[j].ToString())
                        {
                            dadosProf[7] = ListaTipoTurma[j].ToString();
                            break;
                        }
                        else
                        {
                            dadosProf[7] = ListaCodigoTurmaProf[i].ToString();
                        }
                    }
                }
                else
                {
                    dadosProf[7] = ListaCodigoTurmaProf[i].ToString();
                }
                prof = new ListViewItem(dadosProf);
                lvProf.Items.Add(prof);
            }
        }
Exemple #5
0
        private void CadastroTurmas_Load(object sender, EventArgs e)
        {
            BancoAcademia.LerArquivoProf(ListaCpfProf, ListaNomeProf, ListaSobrenomeProf, ListaSenhaProf, ListaTelefoneProf, ListaRgProf, ListaGeneroProf, ListaNascimentoProf, ListaCodigoTurmaProf);
            int quantidadeDeProfessores = ListaCodigoTurmaProf.Count;

            professoresDisponiveis = new string[quantidadeDeProfessores];
            professoresCpf         = new string[quantidadeDeProfessores];
            int contador = 0;

            foreach (string dias in diasDeAula)
            {
                cckListDias.Items.Add(dias);
            }

            for (int i = 0; i < ListaCpfProf.Count; i++)
            {
                if (ListaCodigoTurmaProf[i].ToString() == "Disponível")
                {
                    professoresCpf[contador]         = ListaCpfProf[i].ToString();
                    professoresDisponiveis[contador] = ListaCodigoTurmaProf[i].ToString();
                    contador++;
                }
            }
        }