/// <summary>
 /// Mostra os dados não excluídos logicamente no dropdownlist
 /// </summary>
 public void CarregarAreaConhecimento()
 {
     ddlCombo.Items.Clear();
     ddlCombo.DataSource     = ACA_AreaConhecimentoBO.SelecionaAtivas();
     MostrarMessageSelecione = true;
     ddlCombo.DataBind();
 }
Esempio n. 2
0
        protected void _dgvAreaConhecimento_DataBound(object sender, EventArgs e)
        {
            UCTotalRegistros1.Total = ACA_AreaConhecimentoBO.GetTotalRecords();

            if (_dgvAreaConhecimento.Rows.Count > 0)
            {
                ((ImageButton)_dgvAreaConhecimento.Rows[0].FindControl("_btnSubir")).Style.Add("visibility", "hidden");
                ((ImageButton)_dgvAreaConhecimento.Rows[_dgvAreaConhecimento.Rows.Count - 1].FindControl("_btnDescer")).Style.Add("visibility", "hidden");
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Método para carregar um registro de área de conhecimento, a fim de atualizar suas informações.
 /// Recebe dados referente à área de conhecimento para realizar a busca.
 /// </summary>
 /// <param name="aco_id">ID da área de conhecimento</param>
 public void Carregar(int aco_id)
 {
     try
     {
         ACA_AreaConhecimento areaConhecimento = new ACA_AreaConhecimento {
             aco_id = aco_id
         };
         ACA_AreaConhecimentoBO.GetEntity(areaConhecimento);
         VS_aco_id                      = aco_id;
         VS_aco_ordem                   = areaConhecimento.aco_ordem;
         txtAreaConhecimento.Text       = areaConhecimento.aco_nome;
         ddlTipoBaseGeral.SelectedValue = areaConhecimento.aco_tipoBaseGeral.ToString();
         ddlTipoBase.SelectedValue      = areaConhecimento.aco_tipoBase.ToString();
     }
     catch (Exception ex)
     {
         ApplicationWEB._GravaErro(ex);
         lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar tipo de ciclo.", UtilBO.TipoMensagem.Erro);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Método para salvar um tipo de qualidade.
        /// </summary>
        private void Salvar()
        {
            try
            {
                ACA_AreaConhecimento areaConhecimento = new ACA_AreaConhecimento
                {
                    aco_id            = VS_aco_id,
                    aco_nome          = txtAreaConhecimento.Text,
                    aco_tipoBaseGeral = Convert.ToByte(ddlTipoBaseGeral.SelectedValue),
                    aco_tipoBase      = Convert.ToByte(ddlTipoBase.SelectedValue),
                    aco_ordem         = VS_aco_ordem,
                    aco_situacao      = Convert.ToByte(1),
                    IsNew             = VS_aco_id <= 0
                };

                if (ACA_AreaConhecimentoBO.Save(areaConhecimento))
                {
                    ApplicationWEB._GravaLogSistema(VS_aco_id > 0 ? LOG_SistemaTipo.Update : LOG_SistemaTipo.Insert, "aco_id: " + areaConhecimento.aco_id);
                    __SessionWEB.PostMessages = UtilBO.GetErroMessage("Área de conhecimento " + (VS_aco_id > 0 ? "alterado" : "incluído") + " com sucesso.", UtilBO.TipoMensagem.Sucesso);

                    Response.Redirect("Busca.aspx", false);
                    HttpContext.Current.ApplicationInstance.CompleteRequest();
                }
            }
            catch (ValidationException e)
            {
                lblMessage.Text = UtilBO.GetErroMessage(e.Message, UtilBO.TipoMensagem.Alerta);
            }
            catch (ArgumentException e)
            {
                lblMessage.Text = UtilBO.GetErroMessage(e.Message, UtilBO.TipoMensagem.Alerta);
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar salvar área de conhecimento.", UtilBO.TipoMensagem.Erro);
            }
        }
Esempio n. 5
0
        protected void _dgvAreaConhecimento_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Deletar")
            {
                try
                {
                    int index  = int.Parse(e.CommandArgument.ToString());
                    int aco_id = Convert.ToInt32(_dgvAreaConhecimento.DataKeys[index].Value.ToString());

                    ACA_AreaConhecimento entity = new ACA_AreaConhecimento {
                        aco_id = aco_id
                    };
                    ACA_AreaConhecimentoBO.GetEntity(entity);

                    if (ACA_AreaConhecimentoBO.Delete(entity))
                    {
                        _dgvAreaConhecimento.DataBind();

                        if (_dgvAreaConhecimento.Rows.Count > 0)
                        {
                            ((ImageButton)_dgvAreaConhecimento.Rows[0].FindControl("_btnSubir")).Style.Add("visibility", "hidden");
                            ((ImageButton)_dgvAreaConhecimento.Rows[_dgvAreaConhecimento.Rows.Count - 1].FindControl("_btnDescer")).Style.Add("visibility", "hidden");
                        }

                        ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Delete, "aco_id: " + aco_id);
                        _lblMessage.Text = UtilBO.GetErroMessage(
                            "Área de conhecimento excluído com sucesso.", UtilBO.TipoMensagem.Sucesso);
                    }
                }
                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 área de conhecimento.", UtilBO.TipoMensagem.Erro);
                }
            }
            if (e.CommandName == "Subir")
            {
                try
                {
                    int index = int.Parse(e.CommandArgument.ToString());

                    int aco_idDescer    = Convert.ToInt32(_dgvAreaConhecimento.DataKeys[index - 1]["aco_id"]);
                    int aco_ordemDescer = Convert.ToInt32(_dgvAreaConhecimento.DataKeys[index]["aco_ordem"]);
                    ACA_AreaConhecimento entityDescer = new ACA_AreaConhecimento {
                        aco_id = aco_idDescer
                    };
                    ACA_AreaConhecimentoBO.GetEntity(entityDescer);
                    entityDescer.aco_ordem = aco_ordemDescer;

                    int aco_idSubir    = Convert.ToInt32(_dgvAreaConhecimento.DataKeys[index]["aco_id"]);
                    int aco_ordemSubir = Convert.ToInt32(_dgvAreaConhecimento.DataKeys[index - 1]["aco_ordem"]);
                    ACA_AreaConhecimento entitySubir = new ACA_AreaConhecimento {
                        aco_id = aco_idSubir
                    };
                    ACA_AreaConhecimentoBO.GetEntity(entitySubir);
                    entitySubir.aco_ordem = aco_ordemSubir;

                    if (ACA_AreaConhecimentoBO.SaveOrdem(entityDescer, entitySubir))
                    {
                        _dgvAreaConhecimento.DataBind();


                        if (_dgvAreaConhecimento.Rows.Count > 0)
                        {
                            ((ImageButton)_dgvAreaConhecimento.Rows[0].Cells[2].FindControl("_btnSubir")).Style.Add("visibility", "hidden");
                            ((ImageButton)_dgvAreaConhecimento.Rows[_dgvAreaConhecimento.Rows.Count - 1].FindControl("_btnDescer")).Style.Add("visibility", "hidden");
                        }
                    }

                    ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Update, "aco_id: " + aco_idSubir);
                    ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Update, "aco_id: " + aco_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 aco_idDescer    = Convert.ToInt32(_dgvAreaConhecimento.DataKeys[index]["aco_id"]);
                    int aco_ordemDescer = Convert.ToInt32(_dgvAreaConhecimento.DataKeys[index + 1]["aco_ordem"]);
                    ACA_AreaConhecimento entityDescer = new ACA_AreaConhecimento {
                        aco_id = aco_idDescer
                    };
                    ACA_AreaConhecimentoBO.GetEntity(entityDescer);
                    entityDescer.aco_ordem = aco_ordemDescer;

                    int aco_idSubir    = Convert.ToInt32(_dgvAreaConhecimento.DataKeys[index + 1]["aco_id"]);
                    int aco_ordemSubir = Convert.ToInt32(_dgvAreaConhecimento.DataKeys[index]["aco_ordem"]);
                    ACA_AreaConhecimento entitySubir = new ACA_AreaConhecimento {
                        aco_id = aco_idSubir
                    };
                    ACA_AreaConhecimentoBO.GetEntity(entitySubir);
                    entitySubir.aco_ordem = aco_ordemSubir;

                    if (ACA_AreaConhecimentoBO.SaveOrdem(entityDescer, entitySubir))
                    {
                        _dgvAreaConhecimento.DataBind();

                        if (_dgvAreaConhecimento.Rows.Count > 0)
                        {
                            ((ImageButton)_dgvAreaConhecimento.Rows[0].Cells[2].FindControl("_btnSubir")).Style.Add("visibility", "hidden");
                            ((ImageButton)_dgvAreaConhecimento.Rows[_dgvAreaConhecimento.Rows.Count - 1].FindControl("_btnDescer")).Style.Add("visibility", "hidden");
                        }
                    }

                    ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Update, "aco_id: " + aco_idSubir);
                    ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Update, "aco_id: " + aco_idDescer);
                }
                catch (Exception ex)
                {
                    ApplicationWEB._GravaErro(ex);
                    _lblMessage.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Erro);
                }
            }
        }