Example #1
0
    protected void btnLibera_Click(object sender, EventArgs e)
    {
        string[]     assuntoGrupo = lblMsgAssunto.Text.Split('-'); //separa a string de assunto automática
        int          codReq       = Convert.ToInt32(lblMsgId.Text);
        Requerimento req          = Requerimento_DB.Select(codReq);
        int          codGrupo     = req.CodigoGrupo;

        if (Requerimento_DB.Update(codReq, 2, codGrupo) == 0)
        {
            Grupo_DB.Update(codGrupo);
            Requerimento_DB.UpdateTime(codReq);
            lblMsgStatus.Text             = "Em Andamento";
            mdlHeader.Attributes["style"] = "background-color: #f9ae0e;color: #fff; border-bottom: none; height: 54px; position: absolute; z-index: 999; width: 100%; box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.26);";

            txtResponder.Text = "";
            UpdatePanel3.Update();


            string usuario   = Session["nome"].ToString();
            string matricula = Session["matricula"].ToString();
            string msg       = "O grupo " + assuntoGrupo[1] + "foi liberado para edição de nota por " + usuario;


            Mensagem men = new Mensagem(codReq, matricula, msg, usuario);

            if (Mensagem_DB.Insert(men) == 0)
            {
            }
            else
            {
            }
        }
        else
        {
        }
        abrirMensagens(codReq);
        CarregarGridAtivos();

        UpdatePanel3.Update();
        UpdatePanel1.Update();
        UpdatePanel2.Update();

        ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
    }
Example #2
0
    protected void gdvProjetos_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "verDetalhes")
        {
            GridViewRow gvr = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); //pega a linha da grid pela fonte do comando

            Label lblCodigoGrupo = (Label)gdvProjetos.Rows[gvr.RowIndex].FindControl("lblCodigo");
            int   gru_codigo     = Convert.ToInt32(lblCodigoGrupo.Text);

            LinkButton lblNome  = (LinkButton)gdvProjetos.Rows[gvr.RowIndex].FindControl("lblNome");
            string     gru_nome = lblNome.Text;
            //Grupo gru = Grupo_DB.Select(gru_codigo);

            Label lblCodigoPI = (Label)gdvProjetos.Rows[gvr.RowIndex].FindControl("lblCodigoPI");
            int   CodigoPI    = Convert.ToInt32(lblCodigoPI.Text);

            Label  lblCurso   = (Label)gdvProjetos.Rows[gvr.RowIndex].FindControl("lblCurso");
            string nome_curso = lblCurso.Text;

            Label  lblSemestreCurso = (Label)gdvProjetos.Rows[gvr.RowIndex].FindControl("lblSemestreCurso");
            string semestre_curso   = lblSemestreCurso.Text;

            Label  lblStatus = (Label)gdvProjetos.Rows[gvr.RowIndex].FindControl("lblStatus");
            string status    = lblStatus.Text;

            lblInformacoes.Text = "<pre>Grupo: " + gru_nome + " / Curso: " + nome_curso + "</br>Semestre: " + semestre_curso + " / Status: " + status + "</pre>";

            /*lblNomeGrupoModal.Text = gru_nome;
             * lblCursoModal.Text = nome_curso; //pega o nome do curso e coloca na célula da coluna correspondente ao curso daquela linha
             * lblSemestreModal.Text = semestre_curso;
             * lblStatusModal.Text = status;*/

            DataSet cod_disciplina = Atribuicao_PI_DB.SelectDisciplinaByCod(CodigoPI);
            DataSet nome_professor = Atribuicao_PI_DB.SelectNomeProfessor(CodigoPI);

            int qtd = nome_professor.Tables[0].Rows.Count;

            string[] professores = new string[qtd];
            for (int i = 0; i < qtd; i++)
            {
                professores[i] = nome_professor.Tables[0].Rows[i]["pro_nome"].ToString();
            }

            string[] matriculas_alunos = Grupo_Aluno_DB.SelectAllMatriculaByGrupo(gru_codigo);
            string[] nome_alunos       = Funcoes.NomeAlunosByMatricula(matriculas_alunos);
            string[] nome_disciplina   = Funcoes.DisciplinasByCodigo(cod_disciplina);

            DataTable dt = new DataTable();
            dt.Columns.Add("T", typeof(string));
            dt.Columns.Add("Detalhes", typeof(string));

            DataRow dr = dt.NewRow();
            for (int i = 0; i < matriculas_alunos.Length; i++) //Lista com alunos
            {
                dr["T"]        = "Alunos";
                dr["Detalhes"] = dr["Detalhes"] + nome_alunos[i] + ", ";
            }
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            for (int i = 0; i < nome_disciplina.Length; i++) //Lista com disciplina
            {
                dr["T"]        = "Disciplinas";
                dr["Detalhes"] = dr["Detalhes"] + nome_disciplina[i] + ", ";
            }
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            for (int i = 0; i < qtd; i++) //Lista com professores
            {
                dr["T"]        = "Professores";
                dr["Detalhes"] = dr["Detalhes"] + professores[i] + ", ";
            }
            dt.Rows.Add(dr);

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

            foreach (GridViewRow linha in gdvDetalhes.Rows)                     //percorre cada linha da grid
            {
                Label    lblDetalhes = (Label)linha.FindControl("lblDetalhes"); //acha o label de Nome e liga a outro label
                string[] split       = lblDetalhes.Text.Split(',');
                lblDetalhes.Text = "";

                for (int i = 0; i < split.Length - 1; i++)
                {
                    lblDetalhes.Text = lblDetalhes.Text + split[i] + "</br>";
                }
            }

            UpdatePanelModalNovoCriterio.Update();
            ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
        }

        if (e.CommandName == "projHabilitar")
        {
            GridViewRow gvr       = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); //pega a linha da grid pela fonte do comando
            Label       lblCodigo = (Label)gdvProjetos.Rows[gvr.RowIndex].FindControl("lblCodigo");

            //string lblCodigo = gdvProjetos.Rows[gvr.RowIndex].Cells[0].Text;
            int cod = Convert.ToInt32(lblCodigo.Text);

            if (Grupo_DB.Update(cod) == 0)
            {
                CarregaGrid();
                UpdatePanelAtivados.Update();
                lblMsg.Text = "Projeto habilitado para alterações de nota com Sucesso!";
            }
            else
            {
                CarregaGrid();
                UpdatePanelAtivados.Update();
                lblMsg.Text = "Erro ao habilitar projeto!";
            }
        }
    }