Example #1
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;
        }
Example #2
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);
                }
            }
        }