コード例 #1
0
ファイル: CFG_CorRelatorioDAO.cs プロジェクト: Mualumene/SGP
        /// <summary>
        /// Retorna um datatable com a lista de cores para o relatório
        /// </summary>
        /// <param name="rlt_id">rlt_id id do relatório</param>
        /// <returns>
        /// DataTable com as cores por rlt_id
        /// </returns>
        public List <CFG_CorRelatorio> SelecionaCoresRelatorio(int rlt_id)
        {
            List <CFG_CorRelatorio> lt = new List <CFG_CorRelatorio>();

            QuerySelectStoredProcedure qs = new QuerySelectStoredProcedure("NEW_CFG_CorRelatorioSelecionaPorRelatorio", _Banco);

            try
            {
                #region PARAMETROS

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

                #endregion

                qs.Execute();
                foreach (DataRow dr in qs.Return.Rows)
                {
                    CFG_CorRelatorio entity = new CFG_CorRelatorio();
                    lt.Add(this.DataRowToEntity(dr, entity));
                }
                return(lt);
            }
            catch
            {
                throw;
            }
            finally
            {
                qs.Parameters.Clear();
            }
        }
コード例 #2
0
    protected void grvCadastroCor_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        GridView grv = ((GridView)sender);

        try
        {
            if (!Boolean.Parse(grv.DataKeys[e.RowIndex]["IsNew"].ToString()))
            {
                CFG_CorRelatorio entity = new CFG_CorRelatorio
                {
                    cor_id       = Convert.ToInt32(grv.DataKeys[e.RowIndex]["cor_id"]),
                    rlt_id       = Convert.ToInt32(grv.DataKeys[e.RowIndex]["rlt_id"]),
                    cor_situacao = Byte.Parse(grv.DataKeys[e.RowIndex]["cor_situacao"].ToString())
                };
                if (CFG_CorRelatorioBO.Delete(entity))
                {
                    ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Delete, "cor_id: " + entity.cor_id + ", rlt_id: " + entity.rlt_id);
                    lblMessage.Text = UtilBO.GetErroMessage("Cor excluída com sucesso.", UtilBO.TipoMensagem.Sucesso);
                    updMensagem.Update();
                    Carregar(VS_rlt_id);
                }
            }
        }
        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 cor.", UtilBO.TipoMensagem.Erro);
        }
    }
コード例 #3
0
ファイル: CFG_CorRelatorioDAO.cs プロジェクト: Mualumene/SGP
        /// <summary>
        /// Parâmetros para efetuar a alteração preservando a data de criação
        /// </summary>
        /// <param name="qs"></param>
        /// <param name="entity"></param>
        protected override void ParamAlterar(QueryStoredProcedure qs, CFG_CorRelatorio entity)
        {
            base.ParamAlterar(qs, entity);

            qs.Parameters.RemoveAt("@cor_dataCriacao");
            qs.Parameters["@cor_dataAlteracao"].Value = DateTime.Now;
        }
コード例 #4
0
    protected void grvCadastroCor_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridView grv = ((GridView)sender);

        try
        {
            CFG_CorRelatorio entity = new CFG_CorRelatorio
            {
                IsNew        = Boolean.Parse(grv.DataKeys[e.RowIndex]["IsNew"].ToString()),
                cor_id       = Convert.ToInt32(grv.DataKeys[e.RowIndex]["cor_id"]),
                cor_situacao = Byte.Parse(grv.DataKeys[e.RowIndex]["cor_situacao"].ToString()),
                cor_ordem    = Convert.ToByte(grv.DataKeys[e.RowIndex]["cor_ordem"]),
                rlt_id       = Convert.ToInt32(grv.DataKeys[e.RowIndex]["rlt_id"])
            };

            TextBox cor_corPaleta = (TextBox)grvCadastroCor.Rows[e.RowIndex].FindControl("txtCorPaleta");
            if (cor_corPaleta != null)
            {
                entity.cor_corPaleta = cor_corPaleta.Text;
            }

            entity.cor_dataCriacao   = DateTime.Now;
            entity.cor_dataAlteracao = DateTime.Now;

            if (CFG_CorRelatorioBO.SalvarCor(entity))
            {
                if (Boolean.Parse(grv.DataKeys[e.RowIndex]["IsNew"].ToString()))
                {
                    ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Insert, "cor_id: " + entity.cor_id + ", rlt_id: " + entity.rlt_id);
                    lblMessage.Text = UtilBO.GetErroMessage("Cor cadastrada com sucesso.", UtilBO.TipoMensagem.Sucesso);
                    updMensagem.Update();
                }
                else
                {
                    ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Update, "cor_id: " + entity.cor_id + ", rlt_id: " + entity.rlt_id);
                    lblMessage.Text = UtilBO.GetErroMessage("Cor alterada com sucesso.", UtilBO.TipoMensagem.Sucesso);
                    updMensagem.Update();
                }
                grv.EditIndex = -1;
                Carregar(VS_rlt_id);
            }
        }
        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 cor.", UtilBO.TipoMensagem.Erro);
        }
    }
コード例 #5
0
ファイル: CFG_CorRelatorioDAO.cs プロジェクト: Mualumene/SGP
        /// <summary>
        /// Retorna todas as cores não excluídos logicamente
        /// </summary>
        /// <param name="rlt_id">Id do relatorio</param>
        /// <param name="totalRecords">Total de registros retornado na busca</param>
        public bool ValidaCor
        (
            CFG_CorRelatorio entity
        )
        {
            QuerySelectStoredProcedure qs = new QuerySelectStoredProcedure("NEW_CFG_CorRelatorio_ValidaCor", _Banco);

            try
            {
                #region PARAMETROS

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

                Param               = qs.NewParameter();
                Param.DbType        = DbType.Int32;
                Param.ParameterName = "@cor_id";
                Param.Size          = 4;
                Param.Value         = entity.cor_id;
                qs.Parameters.Add(Param);

                Param               = qs.NewParameter();
                Param.DbType        = DbType.AnsiString;
                Param.ParameterName = "@cor_corPaleta";
                Param.Size          = 10;
                Param.Value         = entity.cor_corPaleta;
                qs.Parameters.Add(Param);

                #endregion

                qs.Execute();
                //totalRecords = qs.Return.Rows.Count;

                return(qs.Return.Rows.Count > 0);
            }

            catch
            {
                throw;
            }
            finally
            {
                qs.Parameters.Clear();
            }
        }
コード例 #6
0
    protected void grvCadastroCor_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Subir")
        {
            try
            {
                int index = int.Parse(e.CommandArgument.ToString());

                int              rlt_idDescer = Convert.ToInt32(grvCadastroCor.DataKeys[index]["rlt_id"]);
                int              cor_idDescer = Convert.ToInt32(grvCadastroCor.DataKeys[index - 1]["cor_id"]);
                byte             cor_ordem    = Convert.ToByte(grvCadastroCor.DataKeys[index]["cor_ordem"]);
                CFG_CorRelatorio entityDescer = new CFG_CorRelatorio {
                    cor_id = cor_idDescer, rlt_id = rlt_idDescer
                };
                CFG_CorRelatorioBO.GetEntity(entityDescer);
                entityDescer.cor_ordem = cor_ordem;

                int              rlt_idSubir    = Convert.ToInt32(grvCadastroCor.DataKeys[index]["rlt_id"]);
                int              cor_idSubir    = Convert.ToInt32(grvCadastroCor.DataKeys[index]["cor_id"]);
                byte             cor_ordemSubir = Convert.ToByte(grvCadastroCor.DataKeys[index - 1]["cor_ordem"]);
                CFG_CorRelatorio entitySubir    = new CFG_CorRelatorio {
                    cor_id = cor_idSubir, rlt_id = rlt_idSubir
                };
                CFG_CorRelatorioBO.GetEntity(entitySubir);
                entitySubir.cor_ordem = cor_ordemSubir;

                if (CFG_CorRelatorioBO.SaveOrdem(entityDescer, entitySubir))
                {
                    grvCadastroCor.DataBind();
                    Carregar(VS_rlt_id);

                    if (grvCadastroCor.Rows.Count > 0)
                    {
                        ((ImageButton)grvCadastroCor.Rows[0].Cells[2].FindControl("_btnSubir")).Style.Add("visibility", "hidden");
                        ((ImageButton)grvCadastroCor.Rows[grvCadastroCor.Rows.Count - 1].FindControl("_btnDescer")).Style.Add("visibility", "hidden");
                    }
                }
                ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Update, "cor_id: " + cor_idSubir);
                ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Update, "cor_id: " + cor_idDescer);
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                lblMessage.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Erro);
            }
        }

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

                int              rlt_idDescer    = Convert.ToInt32(grvCadastroCor.DataKeys[index]["rlt_id"]);
                int              cor_idDescer    = Convert.ToInt32(grvCadastroCor.DataKeys[index]["cor_id"]);
                byte             cor_ordemDescer = Convert.ToByte(grvCadastroCor.DataKeys[index + 1]["cor_ordem"]);
                CFG_CorRelatorio entityDescer    = new CFG_CorRelatorio {
                    cor_id = cor_idDescer, rlt_id = rlt_idDescer
                };
                CFG_CorRelatorioBO.GetEntity(entityDescer);
                entityDescer.cor_ordem = cor_ordemDescer;

                int              rlt_idSubir    = Convert.ToInt32(grvCadastroCor.DataKeys[index]["rlt_id"]);
                int              cor_idSubir    = Convert.ToInt32(grvCadastroCor.DataKeys[index + 1]["cor_id"]);
                byte             cor_ordemSubir = Convert.ToByte(grvCadastroCor.DataKeys[index]["cor_ordem"]);
                CFG_CorRelatorio entitySubir    = new CFG_CorRelatorio {
                    cor_id = cor_idSubir, rlt_id = rlt_idSubir
                };
                CFG_CorRelatorioBO.GetEntity(entitySubir);
                entitySubir.cor_ordem = cor_ordemSubir;

                if (CFG_CorRelatorioBO.SaveOrdem(entityDescer, entitySubir))
                {
                    grvCadastroCor.DataBind();
                    Carregar(VS_rlt_id);

                    if (grvCadastroCor.Rows.Count > 0)
                    {
                        ((ImageButton)grvCadastroCor.Rows[0].Cells[2].FindControl("_btnSubir")).Style.Add("visibility", "hidden");
                        ((ImageButton)grvCadastroCor.Rows[grvCadastroCor.Rows.Count - 1].FindControl("_btnDescer")).Style.Add("visibility", "hidden");
                    }
                }
                ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Update, "cor_id: " + cor_idSubir);
                ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Update, "cor_id: " + cor_idDescer);
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                lblMessage.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Erro);
            }
        }
    }
コード例 #7
0
ファイル: CFG_CorRelatorioDAO.cs プロジェクト: Mualumene/SGP
 /// <summary>
 /// Método alterado para que o update não faça a alteração da data de criação
 /// </summary>
 /// <param name="entity">Entidade ACA_TipoDisciplina</param>
 /// <returns>true = sucesso | false = fracasso</returns>
 protected override bool Alterar(CFG_CorRelatorio entity)
 {
     __STP_UPDATE = "NEW_CFG_CorRelatorio_UPDATE_AlteraTipo";
     return(base.Alterar(entity));
 }