Пример #1
0
        protected void _grvParametros_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                ImageButton imgEditar = (ImageButton)e.Row.FindControl("_imgEditar");
                if (imgEditar != null)
                {
                    imgEditar.Visible = __SessionWEB.__UsuarioWEB.GrupoPermissao.grp_alterar;
                }

                ImageButton imgExcluir = (ImageButton)e.Row.FindControl("_imgExcluir");
                if (imgExcluir != null)
                {
                    imgExcluir.Visible = (__SessionWEB.__UsuarioWEB.GrupoPermissao.grp_excluir) &&
                                         (Convert.ToByte(DataBinder.Eval(e.Row.DataItem, "pda_situacao")) != (Byte)eSituacao.Interno);
                }

                DropDownList ddlChave = e.Row.FindControl("_ddlChave") as DropDownList;
                if (ddlChave != null)
                {
                    CarregarComboEnum <ChaveParametroDocumentoAluno>(ddlChave);
                    CFG_ParametroDocumentoAluno row = (CFG_ParametroDocumentoAluno)e.Row.DataItem;
                    ddlChave.SelectedValue = row.pda_chave.ToString();
                    ddlChave.Enabled       = false;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Retorna todos os parâmetros cadastrados.
        /// </summary>
        /// <returns></returns>
        public IList <CFG_ParametroDocumentoAluno> Seleciona()
        {
            IList <CFG_ParametroDocumentoAluno> lt = new List <CFG_ParametroDocumentoAluno>();
            QuerySelectStoredProcedure          qs = new QuerySelectStoredProcedure("NEW_CFG_ParametroDocumentoAluno_Select", _Banco);

            qs.Execute();

            foreach (DataRow dr in qs.Return.Rows)
            {
                CFG_ParametroDocumentoAluno entity = new CFG_ParametroDocumentoAluno();
                lt.Add(this.DataRowToEntity(dr, entity));
            }
            return(lt);
        }
Пример #3
0
        public string SelectNomeDocumentoPorRelatorio(int rlt_id)
        {
            CFG_ParametroDocumentoAluno entity = new CFG_ParametroDocumentoAluno();
            QuerySelectStoredProcedure  qs     = new QuerySelectStoredProcedure("NEW_CFG_ParametroDocumentoAluno_CarregaNomeDocumentoPorRelatorio", this._Banco);

            try
            {
                qs.Execute();

                return(Convert.ToString(qs.Return.Rows[0]));
            }
            finally
            {
                qs.Parameters.Clear();
            }
        }
Пример #4
0
        protected override void ParamDeletar(QueryStoredProcedure qs, CFG_ParametroDocumentoAluno entity)
        {
            base.ParamDeletar(qs, entity);

            Param               = qs.NewParameter();
            Param.DbType        = DbType.Byte;
            Param.ParameterName = "@pda_situacao";
            Param.Size          = 1;
            Param.Value         = 3;
            qs.Parameters.Add(Param);

            Param               = qs.NewParameter();
            Param.DbType        = DbType.DateTime;
            Param.ParameterName = "@pda_dataAlteracao";
            Param.Size          = 16;
            Param.Value         = DateTime.Now;
            qs.Parameters.Add(Param);
        }
Пример #5
0
        protected void _grvParametros_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            GridView grv = ((GridView)sender);

            try
            {
                if (!Boolean.Parse(grv.DataKeys[e.RowIndex]["IsNew"].ToString()))
                {
                    CFG_ParametroDocumentoAluno entity = new CFG_ParametroDocumentoAluno
                    {
                        pda_id = Convert.ToInt32(grv.DataKeys[e.RowIndex]["pda_id"])
                        ,
                        rlt_id = Convert.ToInt32(grv.DataKeys[e.RowIndex]["rlt_id"])
                        ,
                        ent_id = new Guid(Convert.ToString(grv.DataKeys[e.RowIndex]["ent_id"]))
                        ,
                        pda_situacao = Byte.Parse(grv.DataKeys[e.RowIndex]["pda_situacao"].ToString())
                    };

                    if (CFG_ParametroDocumentoAlunoBO.Delete(entity))
                    {
                        ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Delete, "pda_id: " + entity.pda_id + ", rlt_id: " + entity.rlt_id + ", ent_id: " + entity.ent_id);
                        _lblMessage.Text = UtilBO.GetErroMessage("Parâmetro de documentos do aluno excluído com sucesso.", UtilBO.TipoMensagem.Sucesso);

                        ApplicationWEB.RecarregarConfiguracoes();
                        grv.EditIndex = -1;
                        grv.DataBind();
                    }
                }
            }
            catch (ValidationException ex)
            {
                _lblMessage.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Alerta);
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar excluir parâmetro de documentos do aluno.", UtilBO.TipoMensagem.Erro);
            }
            finally
            {
                _updMessage.Update();
            }
        }
Пример #6
0
        public virtual CFG_ParametroDocumentoAluno CarregarPorChaveRelatorio(string pda_chave, Guid ent_id, int rlt_id)
        {
            CFG_ParametroDocumentoAluno entity = new CFG_ParametroDocumentoAluno();
            QuerySelectStoredProcedure  qs     = new QuerySelectStoredProcedure("NEW_CFG_ParametroDocumentoAluno_LOADBY_ChaveRelatorio", this._Banco);

            try
            {
                #region PARAMETROS

                Param               = qs.NewParameter();
                Param.DbType        = DbType.AnsiString;
                Param.ParameterName = "@pda_chave";
                Param.Size          = 100;
                Param.Value         = pda_chave;
                qs.Parameters.Add(Param);

                Param               = qs.NewParameter();
                Param.DbType        = DbType.Guid;
                Param.ParameterName = "@ent_id";
                Param.Size          = 16;
                Param.Value         = ent_id;
                qs.Parameters.Add(Param);

                Param               = qs.NewParameter();
                Param.DbType        = DbType.Int32;
                Param.ParameterName = "@rlt_id";
                Param.Value         = rlt_id;
                qs.Parameters.Add(Param);

                #endregion

                qs.Execute();
                if (qs.Return.Rows.Count > 0)
                {
                    entity = this.DataRowToEntity(qs.Return.Rows[0], entity, false);
                }
                return(entity);
            }
            finally
            {
                qs.Parameters.Clear();
            }
        }
Пример #7
0
        /// <summary>
        /// Retorna os dados da tabela CFG_ParametroDocumentoAluno filtrados pelo campo pda_chave, ent_id.
        /// </summary>
        /// <param name="pda_chave">Nome da chave do parâmetro.</param>
        /// <param name="ent_id">Id da entidade da tabela CFG_ParametroDocumentoAluno.</param>
        /// <returns>Lista com objetos CFG_ParametroDocumentoAluno.</returns>
        public virtual IList <CFG_ParametroDocumentoAluno> SelectByChave(string pda_chave, Guid ent_id)
        {
            IList <CFG_ParametroDocumentoAluno> lt = new List <CFG_ParametroDocumentoAluno>();
            QuerySelectStoredProcedure          qs = new QuerySelectStoredProcedure("NEW_CFG_ParametroDocumentoAluno_SELECTBY_Chave", this._Banco);

            try
            {
                #region PARAMETROS

                Param               = qs.NewParameter();
                Param.DbType        = DbType.AnsiString;
                Param.ParameterName = "@pda_chave";
                Param.Size          = 100;
                Param.Value         = pda_chave;
                qs.Parameters.Add(Param);

                Param               = qs.NewParameter();
                Param.DbType        = DbType.Guid;
                Param.ParameterName = "@ent_id";
                Param.Size          = 16;
                Param.Value         = ent_id;
                qs.Parameters.Add(Param);

                #endregion

                qs.Execute();
                foreach (DataRow dr in qs.Return.Rows)
                {
                    CFG_ParametroDocumentoAluno entity = new CFG_ParametroDocumentoAluno();
                    lt.Add(this.DataRowToEntity(dr, entity));
                }
                return(lt);
            }
            finally
            {
                qs.Parameters.Clear();
            }
        }
Пример #8
0
        /// <summary>
        /// Método para carregar um registro de aviso texto geral, a fim de atualizar suas informações.
        /// Recebe dados referente ao aviso texto geral para realizar busca.
        /// </summary>
        /// <param name="atg_id">ID do aviso texto geral</param>
        public void CarregarRLT()
        {
            try
            {
                //Carrega dados relatorio
                CFG_RelatorioDocumentoAluno entRlt = CarregaEntRelatorio();

                //Carrega dados parametro documento aluno
                CFG_ParametroDocumentoAluno entPDA = new CFG_ParametroDocumentoAluno
                {
                    pda_id = VS_pda_id,
                    ent_id = __SessionWEB.__UsuarioWEB.Usuario.ent_id,
                    rlt_id = VS_rlt_id
                };
                CFG_RelatorioDocumentoAlunoBO.GetEntity(entRlt);

                txtTitDeclaracao.Text = VS_rlt_id + " - " + entRlt.rda_nomeDocumento;

                //Carrega dados do aviso texto
                if (entRlt.atg_id > 0)
                {
                    VS_atg_id = Convert.ToInt32(entRlt.atg_id);
                    ACA_AvisoTextoGeral entAviso = new ACA_AvisoTextoGeral {
                        atg_id = VS_atg_id
                    };
                    ACA_AvisoTextoGeralBO.GetEntity(entAviso);

                    txtDescricao.Text = HttpUtility.HtmlDecode(entAviso.atg_descricao);
                    //redactor_content.InnerText = HttpUtility.HtmlDecode(entAviso.atg_descricao);
                }
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar os avisos textos gerais.", UtilBO.TipoMensagem.Erro);
            }
        }
Пример #9
0
        protected void _grvParametros_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridView grv = ((GridView)sender);

            try
            {
                CFG_ParametroDocumentoAluno entity = new CFG_ParametroDocumentoAluno
                {
                    IsNew = Boolean.Parse(grv.DataKeys[e.RowIndex]["IsNew"].ToString())
                    ,
                    pda_id = Convert.ToInt32(grv.DataKeys[e.RowIndex]["pda_id"])
                    ,
                    pda_situacao = Byte.Parse(grv.DataKeys[e.RowIndex]["pda_situacao"].ToString())
                    ,
                    ent_id = __SessionWEB.__UsuarioWEB.Usuario.ent_id
                };

                DropDownList _ddlRelatorio = (DropDownList)_grvParametros.Rows[e.RowIndex].FindControl("_ddlRelatorio");
                if (_ddlRelatorio != null)
                {
                    entity.rlt_id = Convert.ToByte(_ddlRelatorio.SelectedValue);
                }

                DropDownList _ddlChave = (DropDownList)_grvParametros.Rows[e.RowIndex].FindControl("_ddlChave");
                if (_ddlChave != null)
                {
                    entity.pda_chave = _ddlChave.SelectedItem.Text;
                }

                TextBox txtDescricao = (TextBox)_grvParametros.Rows[e.RowIndex].FindControl("_txtDescricao");
                if (txtDescricao != null)
                {
                    entity.pda_descricao = txtDescricao.Text;
                }

                TextBox txtValor = (TextBox)_grvParametros.Rows[e.RowIndex].FindControl("_txtValor");
                if (txtValor.Text.Length > 1000)
                {
                    _lblMessage.Text = UtilBO.GetErroMessage(
                        "O tamanho do campo Valor não pode ser maior que 1000.",
                        UtilBO.TipoMensagem.Alerta);
                    return;
                }
                if (txtValor != null)
                {
                    entity.pda_valor = HttpUtility.HtmlEncode(txtValor.Text);
                }

                if (CFG_ParametroDocumentoAlunoBO.Save(entity))
                {
                    CFG_ParametroDocumentoAlunoBO.RecarregaParametrosAtivos();

                    if (Boolean.Parse(grv.DataKeys[e.RowIndex]["IsNew"].ToString()))
                    {
                        ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Insert, "pda_id: " + entity.pda_id + ", rlt_id: " + entity.rlt_id + ", ent_id: " + entity.ent_id);
                        _lblMessage.Text = UtilBO.GetErroMessage("Parâmetro de documentos do aluno incluído com sucesso.", UtilBO.TipoMensagem.Sucesso);
                    }
                    else
                    {
                        ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Update, "pda_id: " + entity.pda_id + ", rlt_id: " + entity.rlt_id + ", ent_id: " + entity.ent_id);
                        _lblMessage.Text = UtilBO.GetErroMessage("Parâmetro de documentos do aluno alterado com sucesso.", UtilBO.TipoMensagem.Sucesso);
                    }
                    ApplicationWEB.RecarregarConfiguracoes();
                    grv.EditIndex = -1;
                    grv.DataBind();
                }
            }
            catch (ValidationException ex)
            {
                _lblMessage.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Alerta);
            }
            catch (DuplicateNameException ex)
            {
                _lblMessage.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Alerta);
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar salvar parâmetro.", UtilBO.TipoMensagem.Erro);
            }
            finally
            {
                _updMessage.Update();
            }
        }
Пример #10
0
 public override bool Delete(CFG_ParametroDocumentoAluno entity)
 {
     __STP_DELETE = "NEW_CFG_ParametroDocumentoAluno_UpdateSituacao";
     return(base.Delete(entity));
 }
Пример #11
0
 protected override bool Alterar(CFG_ParametroDocumentoAluno entity)
 {
     __STP_UPDATE = "NEW_CFG_ParametroDocumentoAluno_UPDATE";
     return(base.Alterar(entity));
 }
Пример #12
0
 protected override void ParamAlterar(QueryStoredProcedure qs, CFG_ParametroDocumentoAluno entity)
 {
     entity.pda_dataAlteracao = DateTime.Now;
     base.ParamAlterar(qs, entity);
     qs.Parameters.RemoveAt("@pda_dataCriacao");
 }
Пример #13
0
 protected override void ParamInserir(QuerySelectStoredProcedure qs, CFG_ParametroDocumentoAluno entity)
 {
     entity.pda_dataCriacao   = DateTime.Now;
     entity.pda_dataAlteracao = DateTime.Now;
     base.ParamInserir(qs, entity);
 }