コード例 #1
0
        /// <summary>
        /// Carrega o combo de anos letivos com todas as matrículas do aluno.
        /// </summary>
        public void CarregarComboAnosLetivos(long alu_id, int mtu_id)
        {
            DataTable dt = ACA_AlunoBO.AreaAluno_DadosTurmaAtualBoletim(alu_id, 0);

            ddlAnosLetivos.DataSource = dt;
            ddlAnosLetivos.DataBind();

            // Exibe o combo quando tem mais de 1 item.
            divAnosLetivos.Visible = ddlAnosLetivos.Items.Count > 0;

            var valores = (from ListItem item in ddlAnosLetivos.Items
                           let mtu_id_cal_id = item.Value.Split(',')
                                               where mtu_id_cal_id.Length > 0 &&
                                               mtu_id_cal_id[0] == mtu_id.ToString()
                                               select item.Value);

            // Selecionar o mtu_id que está na sessão do aluno.
            if (valores.Any())
            {
                ddlAnosLetivos.SelectedValue = valores.First();
            }
        }