示例#1
0
        protected void cmdBuscar_Click(object sender, EventArgs e)
        {
            try
            {
                AlunoDTO dto = new AlunoDTO();

                if (txtNome.Text.Length > 0)
                {
                    dto.nome = txtNome.Text;
                }

                if (txtAno.Text.Length > 0)
                {
                    dto.ano = int.Parse(txtAno.Text);
                }

                if (!cmbSituacao.SelectedValue.Equals(""))
                {
                    dto.situacao = cmbSituacao.SelectedValue.ToString();
                }

                AlunoBRL  brl = new AlunoBRL();
                DataTable dt  = brl.searchAlunosGeral(dto);
                grdAluno.DataSource = dt;
                grdAluno.DataBind();

                calculaTotal(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void cmdBuscar_Click(object sender, EventArgs e)
        {
            try
            {
                AlunoDTO dto = new AlunoDTO();

                if (txtNome.Text.Length > 0)
                {
                    dto.nome = txtNome.Text;
                }

                if (txtAno.Text.Length > 0)
                {
                    dto.ano = int.Parse(txtAno.Text);
                }

                if (!cmbSituacao.SelectedValue.Equals(""))
                {
                    dto.situacao = cmbSituacao.SelectedValue.ToString();
                }

                if (!cmbProfessores.SelectedValue.Equals("0"))
                {
                    dto.idProfessor = int.Parse(cmbProfessores.SelectedValue.ToString());
                }

                if (!cmbAvaliacao.SelectedValue.Equals(""))
                {
                    dto.tipoAvaliacao = cmbAvaliacao.SelectedValue.ToString();
                }

                AlunoBRL  brl = new AlunoBRL();
                DataTable dt  = brl.searchAlunosGeral(dto);
                grdAluno.DataSource = dt;
                grdAluno.DataBind();

                lblAlunos.Text = "Total de registros encontrados:  " + dt.Rows.Count;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }