Exemplo n.º 1
0
        private void btnConsultar_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 0)
            {
                MessageBox.Show("Nenhum Aluno foi selecionado.", "Consultar", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Aluno ct = new Aluno();

            ct.IdAluno                = Convert.ToInt32(dataGridView1.CurrentRow.Cells["id_Aluno"].Value.ToString());
            ct.Nome                   = dataGridView1.CurrentRow.Cells["Nome"].Value.ToString();
            ct.Matricula              = dataGridView1.CurrentRow.Cells["Matricula"].Value.ToString();
            ct.Turma                  = dataGridView1.CurrentRow.Cells["Turma"].Value.ToString();
            ct.Turno                  = dataGridView1.CurrentRow.Cells["Turno"].Value.ToString();
            ct.Grau                   = dataGridView1.CurrentRow.Cells["Grau"].Value.ToString();
            ct.Cpf                    = dataGridView1.CurrentRow.Cells["Cpf"].Value.ToString();
            ct.Descricao              = dataGridView1.CurrentRow.Cells["Descricao"].Value.ToString();
            ct.Cidade                 = dataGridView1.CurrentRow.Cells["Cidade"].Value.ToString();
            ct.Estado                 = dataGridView1.CurrentRow.Cells["Estado"].Value.ToString();
            ct.Endereco               = dataGridView1.CurrentRow.Cells["Endereco"].Value.ToString();
            ct.Numeroend              = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Numero"].Value.ToString());
            ct.Bairro                 = dataGridView1.CurrentRow.Cells["Bairro"].Value.ToString();
            ct.Complemento            = dataGridView1.CurrentRow.Cells["Complemento"].Value.ToString();
            ct.DataNascimento         = Convert.ToDateTime(dataGridView1.CurrentRow.Cells["DataNascimento"].Value.ToString());
            ct.Telefone               = dataGridView1.CurrentRow.Cells["Telefone"].Value.ToString();
            ct.Email                  = dataGridView1.CurrentRow.Cells["Email"].Value.ToString();
            ct.TelefoneResponsavel    = dataGridView1.CurrentRow.Cells["TelefoneRespo"].Value.ToString();
            ct.Cep                    = dataGridView1.CurrentRow.Cells["cep"].Value.ToString();
            ct.Id_FuncionarioCadastro = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Id_FuncionarioCadastro"].Value.ToString());
            ct.DataCadastro           = Convert.ToDateTime(dataGridView1.CurrentRow.Cells["DataCadastro"].Value.ToString());
            ct.DataAlteracao          = Convert.ToDateTime(dataGridView1.CurrentRow.Cells["DataAlteracao"].Value.ToString());
            ct.Sexo                   = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["Sexo"].Value.ToString());
            ct.Situacao               = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["Situacao"].Value.ToString());
            ct.Disponibilidade        = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["Disponibilidade"].Value.ToString());

            String NomeFunc = dataGridView1.CurrentRow.Cells["Nome1"].Value.ToString();

            AlunoConsulta consultar = new AlunoConsulta(ct, NomeFunc);
            DialogResult  dialog    = consultar.ShowDialog();

            if (dialog == DialogResult.Yes)
            {
                ExibirAlunos();
            }
        }
Exemplo n.º 2
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            Aluno ct = new Aluno();

            ct.IdAluno                = Convert.ToInt32(dataGridView1.CurrentRow.Cells["id_Aluno"].Value.ToString());
            ct.Nome                   = dataGridView1.CurrentRow.Cells["Nome"].Value.ToString();
            ct.Matricula              = dataGridView1.CurrentRow.Cells["Matricula"].Value.ToString();
            ct.Turma                  = dataGridView1.CurrentRow.Cells["Turma"].Value.ToString();
            ct.Turno                  = dataGridView1.CurrentRow.Cells["Turno"].Value.ToString();
            ct.Grau                   = dataGridView1.CurrentRow.Cells["Grau"].Value.ToString();
            ct.Cpf                    = dataGridView1.CurrentRow.Cells["Cpf"].Value.ToString();
            ct.Descricao              = dataGridView1.CurrentRow.Cells["Descricao"].Value.ToString();
            ct.Cidade                 = dataGridView1.CurrentRow.Cells["Cidade"].Value.ToString();
            ct.Estado                 = dataGridView1.CurrentRow.Cells["Estado"].Value.ToString();
            ct.Endereco               = dataGridView1.CurrentRow.Cells["Endereco"].Value.ToString();
            ct.Numeroend              = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Numero"].Value.ToString());
            ct.Bairro                 = dataGridView1.CurrentRow.Cells["Bairro"].Value.ToString();
            ct.Complemento            = dataGridView1.CurrentRow.Cells["Complemento"].Value.ToString();
            ct.DataNascimento         = Convert.ToDateTime(dataGridView1.CurrentRow.Cells["DataNascimento"].Value.ToString());
            ct.Telefone               = dataGridView1.CurrentRow.Cells["Telefone"].Value.ToString();
            ct.Email                  = dataGridView1.CurrentRow.Cells["Email"].Value.ToString();
            ct.TelefoneResponsavel    = dataGridView1.CurrentRow.Cells["TelefoneRespo"].Value.ToString();
            ct.Cep                    = dataGridView1.CurrentRow.Cells["cep"].Value.ToString();
            ct.Id_FuncionarioCadastro = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Id_FuncionarioCadastro"].Value.ToString());
            ct.DataCadastro           = Convert.ToDateTime(dataGridView1.CurrentRow.Cells["DataCadastro"].Value.ToString());
            ct.DataAlteracao          = Convert.ToDateTime(dataGridView1.CurrentRow.Cells["DataAlteracao"].Value.ToString());
            ct.Sexo                   = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["Sexo"].Value.ToString());
            ct.Situacao               = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["Situacao"].Value.ToString());
            ct.Disponibilidade        = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["Disponibilidade"].Value.ToString());

            String NomeFunc = dataGridView1.CurrentRow.Cells["Nome1"].Value.ToString();

            AlunoConsulta consultar = new AlunoConsulta(ct, NomeFunc);
            DialogResult  dialog    = consultar.ShowDialog();

            if (dialog == DialogResult.Yes)
            {
                ExibirAlunos();
            }
        }