Exemple #1
0
        protected void btnSim_Click(object sender, EventArgs e)
        {
            try
            {
                ACA_TipoAreaDocumento entity = new ACA_TipoAreaDocumento {
                    tad_id = VS_tad_id
                };

                if (ACA_TipoAreaDocumentoBO.Delete(entity))
                {
                    grvAreas.DataBind();
                    ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Delete, "tad_id: " + VS_tad_id);
                    lblMensagem.Text = UtilBO.GetErroMessage(RetornaResource("SucessoExclusaoPopup"), UtilBO.TipoMensagem.Sucesso);

                    if (grvAreas.Rows.Count > 0)
                    {
                        ((ImageButton)grvAreas.Rows[0].FindControl("btnSubir")).Visible = false;
                        ((ImageButton)grvAreas.Rows[grvAreas.Rows.Count - 1].FindControl("btnDescer")).Visible = false;
                    }

                    updAreas.Update();
                }
            }
            catch (ValidationException ex)
            {
                lblMensagem.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Alerta);
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                lblMensagem.Text = UtilBO.GetErroMessage(RetornaResource("ErroExcluirTipoArea"), UtilBO.TipoMensagem.Erro);
            }
        }
Exemple #2
0
        /// <summary>
        /// Carrega combos e textos iniciais da tela.
        /// </summary>
        private void CarregarTelaInicial()
        {
            UCComboUAEscola.ObrigatorioUA         =
                UCComboUAEscola.ObrigatorioEscola =
                    UCComboUAEscola.Visible       =
                        VS_permiteCadastroEscola  = ACA_TipoAreaDocumentoBO.GetCadastroEscolaBy_tad_id(VS_tad_id);

            VS_listaArquivoArea = ACA_ArquivoAreaBO.GetSelectBy_tad_id(VS_tad_id);
            VS_listaArquivoArea.ForEach(p => p.id = Guid.NewGuid());

            if (VS_permiteCadastroEscola)
            {
                UCComboUAEscola.Inicializar();

                Dictionary <Guid, List <ACA_ArquivoArea> > dicArquivoUad = (from arquivo in VS_listaArquivoArea.Where(p => p.esc_id > 0 && p.uni_id > 0 && p.uad_idSuperior != Guid.Empty)
                                                                            group arquivo by arquivo.uad_idSuperior into grupo
                                                                            select new
                {
                    chave = grupo.Key
                    ,
                    valor = grupo.ToList()
                }).ToDictionary(p => p.chave, p => p.valor);

                if (UCComboUAEscola.VisibleUA)
                {
                    List <Guid> listaUad = UCComboUAEscola.DdlUA.Items.Cast <ListItem>().Select(p => new Guid(p.Value)).ToList();
                    dicArquivoUad = (from dic in dicArquivoUad
                                     join uad in listaUad on dic.Key equals uad
                                     select dic).ToDictionary(p => p.Key, p => p.Value);

                    if (dicArquivoUad.Any())
                    {
                        UCComboUAEscola.Uad_ID = UCComboUAEscola.Uad_ID == Guid.Empty ? dicArquivoUad.First().Key : UCComboUAEscola.Uad_ID;
                    }
                }

                var listaEscola = UCComboUAEscola.DdlEscola.Items.Cast <ListItem>().Select(p => new { esc_id = Convert.ToInt32(p.Value.Split(';')[0]), uni_id = Convert.ToInt32(p.Value.Split(';')[1]) });
                List <ACA_ArquivoArea> listaArquivoArea = (from arquivo in dicArquivoUad.Where(p => p.Key == uad_idSuperior || (uad_idSuperior == Guid.Empty && !UCComboUAEscola.VisibleUA)).SelectMany(p => p.Value)
                                                           join esc in listaEscola on new { esc_id = arquivo.esc_id, uni_id = arquivo.uni_id } equals new { esc.esc_id, esc.uni_id }
                                                           select arquivo).ToList();

                if (listaArquivoArea.Any())
                {
                    UCComboUAEscola.SelectedValueEscolas = UCComboUAEscola.Esc_ID > 0 ? new int[] { UCComboUAEscola.Esc_ID, UCComboUAEscola.Uni_ID } : new int[] { listaArquivoArea.First().esc_id, listaArquivoArea.First().uni_id };
                }
            }

            UCComboUAEscola.EnableEscolas = UCComboUAEscola.Uad_ID != Guid.Empty || !UCComboUAEscola.VisibleUA;

            Carregar();
        }
Exemple #3
0
        /// <summary>
        /// Método para carregar um registro de tipo de area, a fim de atualizar suas informações.
        /// Recebe dados referente ao tipo de area para realizar a busca.
        /// </summary>
        private void Carregar()
        {
            ACA_TipoAreaDocumento entity = new ACA_TipoAreaDocumento {
                tad_id = VS_tad_id
            };

            ACA_TipoAreaDocumentoBO.GetEntity(entity);

            txtNome.Text = entity.tad_nome;
            chkCadastroEscola.Checked = entity.tad_cadastroEscola;

            bool integridade = ACA_TipoAreaDocumentoBO.VerificarIntegridade("tad_id", VS_tad_id.ToString(), "ACA_TipoAreaDocumento");

            chkCadastroEscola.Enabled = !integridade;

            lblMsgInfo.Text = integridade && __SessionWEB.__UsuarioWEB.Grupo.vis_id == SysVisaoID.Administracao ? UtilBO.GetErroMessage(RetornaResource("lblMsgInfo.Text"), UtilBO.TipoMensagem.Informacao) : string.Empty;
        }
Exemple #4
0
        /// <summary>
        /// Carrega os documentos ativos
        /// </summary>
        private void CarregarDocumentos(long alu_id, int mtu_id)
        {
            string mtuId = "";

            if (mtu_id > 0)
            {
                mtuId = Convert.ToString(mtu_id);
            }
            MTR_MatriculaTurma matriculaTurma = MTR_MatriculaTurmaBO.GetEntity(new MTR_MatriculaTurma {
                alu_id = __SessionWEB.__UsuarioWEB.alu_id, mtu_id = mtu_id
            });
            //TUR_Turma turma = TUR_TurmaBO.GetEntity(new TUR_Turma { tur_id = matriculaTurma.tur_id });
            TUR_TurmaCurriculo curriculo = TUR_TurmaCurriculoBO.GetSelectBy_Turma(matriculaTurma.tur_id).FirstOrDefault();
            ACA_Curso          curso     = ACA_CursoBO.GetEntity(new ACA_Curso {
                cur_id = curriculo.cur_id
            });

            this.tne_id = curso.tne_id;


            DataTable dtArea = ACA_TipoAreaDocumentoBO.SelecionarAtivos();

            dtArea.Columns.Add("PPP");

            // Adiciona PPP
            DataRow drPPP = dtArea.NewRow();

            drPPP["tad_id"]   = -1;
            drPPP["tad_nome"] = GetGlobalResourceObject("Mensagens", "MSG_PLANO_POLITICO_PEDAGOGICO").ToString();
            drPPP["PPP"]      = true;
            drPPP["tad_cadastroEscolaBoolean"] = true;
            dtArea.Rows.Add(drPPP);

            rptAreas.DataSource = dtArea;
            rptAreas.DataBind();

            lblSemAreas.Text = UtilBO.GetErroMessage((string)GetGlobalResourceObject("UserControl", "UCPlanejamentoProjetos.lblSemAreas.Text"),
                                                     UtilBO.TipoMensagem.Informacao);
            lblSemAreas.Visible = rptAreas.Items.Count <= 0;
        }
Exemple #5
0
        /// <summary>
        /// Método para salvar um tipo de area.
        /// </summary>
        private void Salvar()
        {
            try
            {
                ACA_TipoAreaDocumento entity = new ACA_TipoAreaDocumento {
                    tad_id = VS_tad_id
                };
                ACA_TipoAreaDocumentoBO.GetEntity(entity);

                entity.tad_nome           = txtNome.Text;
                entity.IsNew              = VS_tad_id < 0;
                entity.tad_cadastroEscola = chkCadastroEscola.Checked;

                if (ACA_TipoAreaDocumentoBO.SalvarArea(entity))
                {
                    ApplicationWEB._GravaLogSistema(VS_tad_id > 0 ? LOG_SistemaTipo.Update : LOG_SistemaTipo.Insert, "tad_id: " + entity.tad_id);
                    __SessionWEB.PostMessages = UtilBO.GetErroMessage("Documento " + (VS_tad_id > 0 ? "alterado" : "incluído") + " com sucesso.", UtilBO.TipoMensagem.Sucesso);

                    RedirecionarPagina("~/Academico/Areas/Busca.aspx");
                }
            }
            catch (ValidationException e)
            {
                lblMensagem.Text = UtilBO.GetErroMessage(e.Message, UtilBO.TipoMensagem.Alerta);
            }
            catch (ArgumentException e)
            {
                lblMensagem.Text = UtilBO.GetErroMessage(e.Message, UtilBO.TipoMensagem.Alerta);
            }
            catch (DuplicateNameException e)
            {
                lblMensagem.Text = UtilBO.GetErroMessage(e.Message, UtilBO.TipoMensagem.Alerta);
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                lblMensagem.Text = UtilBO.GetErroMessage(RetornaResource("ErroAoTentarSalvar"), UtilBO.TipoMensagem.Erro);
            }
        }
Exemple #6
0
        protected void grvAreas_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Deletar")
            {
                try
                {
                    int index = int.Parse(e.CommandArgument.ToString());
                    VS_tad_id = Convert.ToInt32(grvAreas.DataKeys[index].Values["tad_id"]);

                    lblPopUpExclusao.Text = ACA_TipoAreaDocumentoBO.VerificarIntegridade("tad_id", VS_tad_id.ToString(), "ACA_TipoAreaDocumento") ?
                                            "Já existem links/documentos cadastrados por unidades escolares. Deseja realmente excluir?" :
                                            "Confirma a exclusão?";

                    updMensagemExclusao.Update();

                    ScriptManager.RegisterStartupScript(Page
                                                        , typeof(Page)
                                                        , "AbrePopUpExclusaoVinculo"
                                                        , "$('#divConfirmaExclusao').dialog('open');"
                                                        , true);
                }
                catch (Exception ex)
                {
                    ApplicationWEB._GravaErro(ex);
                    lblMensagem.Text = UtilBO.GetErroMessage(RetornaResource("ErroExcluirTipoArea"), UtilBO.TipoMensagem.Erro);
                }
            }

            if (e.CommandName == "Subir")
            {
                try
                {
                    int index = int.Parse(e.CommandArgument.ToString());

                    int tad_idDescer    = Convert.ToInt32(grvAreas.DataKeys[index - 1]["tad_id"]);
                    int tad_ordemDescer = Convert.ToByte(grvAreas.DataKeys[index]["tad_ordem"]);
                    ACA_TipoAreaDocumento entityDescer = new ACA_TipoAreaDocumento {
                        tad_id = tad_idDescer
                    };
                    ACA_TipoAreaDocumentoBO.GetEntity(entityDescer);
                    entityDescer.tad_ordem = tad_ordemDescer;

                    int tad_idSubir    = Convert.ToInt32(grvAreas.DataKeys[index]["tad_id"]);
                    int tad_ordemSubir = Convert.ToByte(grvAreas.DataKeys[index - 1]["tad_ordem"]);
                    ACA_TipoAreaDocumento entitySubir = new ACA_TipoAreaDocumento {
                        tad_id = tad_idSubir
                    };
                    ACA_TipoAreaDocumentoBO.GetEntity(entitySubir);
                    entitySubir.tad_ordem = tad_ordemSubir;

                    if (ACA_TipoAreaDocumentoBO.SaveOrdem(entityDescer, entitySubir))
                    {
                        grvAreas.DataBind();
                        if (grvAreas.Rows.Count > 0)
                        {
                            ((ImageButton)grvAreas.Rows[0].FindControl("btnSubir")).Visible = false;
                            ((ImageButton)grvAreas.Rows[grvAreas.Rows.Count - 1].FindControl("btnDescer")).Visible = false;
                        }

                        updAreas.Update();

                        ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Update, "tad_id: " + tad_idSubir);
                        ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Update, "tad_id: " + tad_idDescer);
                    }
                }
                catch (ValidationException ex)
                {
                    lblMensagem.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Alerta);
                }
                catch (Exception ex)
                {
                    ApplicationWEB._GravaErro(ex);
                    lblMensagem.Text = UtilBO.GetErroMessage(RetornaResource("ErroSubir"), UtilBO.TipoMensagem.Erro);
                }
            }

            if (e.CommandName == "Descer")
            {
                try
                {
                    int index = int.Parse(e.CommandArgument.ToString());

                    int tad_idDescer    = Convert.ToInt32(grvAreas.DataKeys[index]["tad_id"]);
                    int tad_ordemDescer = Convert.ToByte(grvAreas.DataKeys[index + 1]["tad_ordem"]);
                    ACA_TipoAreaDocumento entityDescer = new ACA_TipoAreaDocumento {
                        tad_id = tad_idDescer
                    };
                    ACA_TipoAreaDocumentoBO.GetEntity(entityDescer);
                    entityDescer.tad_ordem = tad_ordemDescer;

                    int tad_idSubir    = Convert.ToInt32(grvAreas.DataKeys[index + 1]["tad_id"]);
                    int tad_ordemSubir = Convert.ToByte(grvAreas.DataKeys[index]["tad_ordem"]);
                    ACA_TipoAreaDocumento entitySubir = new ACA_TipoAreaDocumento {
                        tad_id = tad_idSubir
                    };
                    ACA_TipoAreaDocumentoBO.GetEntity(entitySubir);
                    entitySubir.tad_ordem = tad_ordemSubir;

                    if (ACA_TipoAreaDocumentoBO.SaveOrdem(entityDescer, entitySubir))
                    {
                        grvAreas.DataBind();

                        if (grvAreas.Rows.Count > 0)
                        {
                            ((ImageButton)grvAreas.Rows[0].FindControl("btnSubir")).Visible = false;
                            ((ImageButton)grvAreas.Rows[grvAreas.Rows.Count - 1].FindControl("btnDescer")).Visible = false;
                        }

                        updAreas.Update();

                        ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Update, "tad_id: " + tad_idSubir);
                        ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Update, "tad_id: " + tad_idDescer);
                    }
                }
                catch (ValidationException ex)
                {
                    lblMensagem.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Alerta);
                }
                catch (Exception ex)
                {
                    ApplicationWEB._GravaErro(ex);
                    lblMensagem.Text = UtilBO.GetErroMessage(RetornaResource("ErroDescer"), UtilBO.TipoMensagem.Erro);
                }
            }
        }
Exemple #7
0
 protected void grvAreas_DataBound(object sender, EventArgs e)
 {
     UCTotalRegistros.Total = ACA_TipoAreaDocumentoBO.GetTotalRecords();
 }