private void btnBuscar_Click(object sender, EventArgs e)
        {
            Aluno              alunoaux     = new Aluno();
            List <Aluno>       alunos       = new List <Aluno>();
            List <Endereco>    enderecos    = new List <Endereco>();
            List <Responsavel> responsaveis = new List <Responsavel>();

            int NumeroMatricula = int.Parse(txtMatricula.Text);


            alunoaux.SelectById(NumeroMatricula, alunos, enderecos, responsaveis);

            if (alunos.Count != 0)
            {
                foreach (Aluno aluno in alunos)
                {
                    txtNome.Text      = aluno.Nome;
                    txtCpf.Text       = aluno.Cpf;
                    txtRg.Text        = aluno.Rg;
                    txtEmail.Text     = aluno.Email;
                    celMask.Text      = aluno.Telefone.ToString();
                    dtNascimento.Text = aluno.Dt_Nascimento.ToString();
                }
                foreach (Endereco endereco in enderecos)
                {
                    txtRua.Text    = endereco.Rua;
                    txtNum.Text    = endereco.Numero.ToString();
                    txtBairro.Text = endereco.Bairro;
                    txtCidade.Text = endereco.Cidade;
                    cbEstado.Text  = endereco.Estado;
                    codEndereco    = endereco.CodEndereco;
                }
                foreach (Responsavel responsavel in responsaveis)
                {
                    txtNomePai.Text  = responsavel.Nome_Pai;
                    txtNomeMae.Text  = responsavel.Nome_Mae;
                    txtTelPai.Text   = responsavel.Telefone_Pai.ToString();
                    txtTelMae.Text   = responsavel.Telefone_Mae.ToString();
                    txtEmailPai.Text = responsavel.Email_Pai;
                    txtEmailMae.Text = responsavel.Email_Mae;
                    txtCpfPai.Text   = responsavel.Cpf_Pai;
                    txtCpfMae.Text   = responsavel.Cpf_Mae;
                    codResp          = responsavel.CodResponsaveis;
                }
            }
            else
            {
                MessageBox.Show("Matricula Invalida", "AVISO");
                alunoaux.ClearTxtBoxes(this.Controls);
            }
        }
Example #2
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            Aluno        aluno  = new Aluno();
            string       tabela = "aluno";
            string       nameId = "numero_matricula";
            List <Aluno> alunos = new List <Aluno>();


            aluno.SelectById(tabela, nameId, int.Parse(txtMatricula.Text), alunos);
            foreach (Aluno aluno1 in alunos)
            {
                txtNome.Text      = aluno1.Nome;
                txtCpf.Text       = aluno1.Cpf;
                txtEmail.Text     = aluno1.Email;
                txtTel.Text       = aluno1.Telefone.ToString();
                dtNascimento.Text = aluno1.Dt_Nascimento.ToString();
            }
        }