Beispiel #1
0
        public new static bool Delete
        (
            SYS_Servicos entity
        )
        {
            SYS_ServicosDAO dao = new SYS_ServicosDAO();

            dao._Banco.Open(IsolationLevel.ReadCommitted);

            try
            {
                //Verifica se o serviço pode ser deletado
                if (GestaoEscolarUtilBO.VerificarIntegridade("ser_id", entity.ser_id.ToString(), "SYS_Servicos", dao._Banco))
                {
                    throw new ValidationException("Não é possível excluir o serviço pois possui outros registros ligados a ele.");
                }

                //Deleta logicamente o serviço
                dao.Delete(entity);

                return(true);
            }
            catch (Exception err)
            {
                dao._Banco.Close(err);
                throw;
            }
            finally
            {
                dao._Banco.Close();
            }
        }
Beispiel #2
0
        public new static bool Delete(ACA_TipoEquipamentoDeficiente entity)
        {
            ACA_TipoEquipamentoDeficienteDAO dao = new ACA_TipoEquipamentoDeficienteDAO();

            dao._Banco.Open(IsolationLevel.ReadCommitted);

            try
            {
                if (GestaoEscolarUtilBO.VerificarIntegridade("ted_id"
                                                             , entity.ted_id.ToString()
                                                             , "ACA_TipoEquipamentoDeficiente"
                                                             , dao._Banco))
                {
                    throw new ValidationException(
                              CustomResource.GetGlobalResourceObject("BLL", "TipoEquipamentoDeficiente.ErroAoExcluir")
                              );
                }
                return(dao.Delete(entity));
            }
            catch (Exception ex)
            {
                dao._Banco.Close(ex);
                throw;
            }
            finally
            {
                dao._Banco.Close();
            }
        }
Beispiel #3
0
        public new static bool Delete
        (
            ACA_RecursosAula entity
        )
        {
            ACA_RecursosAulaDAO dao = new ACA_RecursosAulaDAO();

            dao._Banco.Open(IsolationLevel.ReadCommitted);

            try
            {
                //Verifica se o recurso de aula pode ser deletado
                if (GestaoEscolarUtilBO.VerificarIntegridade("rsa_id", entity.rsa_id.ToString(), "ACA_RecursosAula", dao._Banco))
                {
                    throw new ValidationException("Não é possível excluir o recurso de aula pois possui outros registros ligados a ele.");
                }

                //Removendo o cache
                RemoveCacheRecursosAula();

                //Deleta logicamente o recurso de aula
                dao.Delete(entity);

                return(true);
            }
            catch (Exception err)
            {
                dao._Banco.Close(err);
                throw;
            }
            finally
            {
                dao._Banco.Close();
            }
        }
        public new static bool Delete
        (
            ACA_TipoPeriodoCalendario entity
        )
        {
            ACA_TipoPeriodoCalendarioDAO dao = new ACA_TipoPeriodoCalendarioDAO();

            dao._Banco.Open(IsolationLevel.ReadCommitted);

            try
            {
                //Verifica se o tipo de período do calendário pode ser deletado
                if (GestaoEscolarUtilBO.VerificarIntegridade("tpc_id", entity.tpc_id.ToString(), "ACA_TipoPeriodoCalendario,REL_AlunosSituacaoFechamento,MTR_MatriculasBoletim,MTR_MatriculasBoletimDisciplina,CLS_AlunoAvaliacaoTurmaDisciplinaMedia,CLS_AlunoFechamentoPendencia,CLS_CompensacaoAusencia", dao._Banco))
                {
                    throw new ValidationException("Não é possível excluir o tipo de período do calendário pois possui outros registros ligados a ele.");
                }

                //Deleta logicamente o tipo de período do calendário
                dao.Delete(entity);

                return(true);
            }
            catch (Exception err)
            {
                dao._Banco.Close(err);
                throw;
            }
            finally
            {
                dao._Banco.Close();
            }
        }
Beispiel #5
0
        public static bool Delete
        (
            ACA_Disciplina entity
            , string tabelasAdicionaisNaoVerificarIntegridade
            , TalkDBTransaction banco
        )
        {
            ACA_DisciplinaDAO dao = new ACA_DisciplinaDAO();

            if (banco == null)
            {
                dao._Banco.Open(IsolationLevel.ReadCommitted);
            }
            else
            {
                dao._Banco = banco;
            }

            LimpaCache(entity);

            string tabelasNaoVerificarIntegridade = "ACA_Disciplina,ACA_CurriculoDisciplina,ACA_DisciplinaMacroCampoEletivaAluno";

            if (!string.IsNullOrEmpty(tabelasAdicionaisNaoVerificarIntegridade))
            {
                tabelasNaoVerificarIntegridade = tabelasNaoVerificarIntegridade + "," + tabelasAdicionaisNaoVerificarIntegridade;
            }

            try
            {
                //Verifica se a disciplina pode ser deletada
                if (GestaoEscolarUtilBO.VerificarIntegridade("dis_id", entity.dis_id.ToString(), tabelasNaoVerificarIntegridade, dao._Banco))
                {
                    throw new ValidationException("Não é possível excluir o(a) " + CustomResource.GetGlobalResourceObject("Mensagens", "MSG_DISCIPLINA") + " " + entity.dis_nome + ", pois possui outros registros ligados a ela.");
                }

                //Deleta logicamente a disciplina
                return(dao.Delete(entity));
            }
            catch (Exception err)
            {
                if (banco == null)
                {
                    dao._Banco.Close(err);
                }

                throw;
            }
            finally
            {
                if (banco == null)
                {
                    dao._Banco.Close();
                }
            }
        }
Beispiel #6
0
 /// <summary>
 /// Verifica se a lista de orientações curriculares está sendo usado em outras telas.
 /// </summary>
 /// <param name="ltOrientacao">Lista de ids das orientações curriculares.</param>
 /// <returns></returns>
 public static bool VerificaIntegridade(List <long> ltOrientacao, TalkDBTransaction banco)
 {
     try
     {
         return(ltOrientacao.Aggregate(false, (usado, ocr_id) => usado |= GestaoEscolarUtilBO.VerificarIntegridade("ocr_id", ocr_id.ToString(), "ORC_OrientacaoCurricular,ORC_OrientacaoCurricularNivelAprendizado", banco)));
     }
     catch (Exception ex)
     {
         throw;
     }
 }
        public new static bool Delete
        (
            MTR_ParametroTipoMovimentacao entity
            , Data.Common.TalkDBTransaction banco
        )
        {
            MTR_ParametroTipoMovimentacaoDAO dao = new MTR_ParametroTipoMovimentacaoDAO();

            if (banco == null)
            {
                dao._Banco.Open(IsolationLevel.ReadCommitted);
            }
            else
            {
                dao._Banco = banco;
            }

            try
            {
                // Verifica se o parâmetro do parâmetro de movimentação pode ser deletado
                if (GestaoEscolarUtilBO.VerificarIntegridade
                    (
                        "ptm_id"
                        , entity.ptm_id.ToString()
                        , "MTR_TipoMovimentacao,MTR_ParametroTipoMovimentacao"
                        , dao._Banco
                    ))
                {
                    throw new ValidationException("Não é possível excluir o parâmetro de movimentação pois possui outros registros ligados a ele.");
                }

                // Deleta logicamente o parâmetro do parâmetro de movimentação
                dao.Delete(entity);

                return(true);
            }
            catch (Exception err)
            {
                if (banco == null)
                {
                    dao._Banco.Close(err);
                }

                throw;
            }
            finally
            {
                if (banco == null)
                {
                    dao._Banco.Close();
                }
            }
        }
Beispiel #8
0
        public static bool Delete
        (
            ACA_Sondagem entity
            , TalkDBTransaction banco = null
        )
        {
            ACA_SondagemDAO dao = new ACA_SondagemDAO();

            if (banco == null)
            {
                dao._Banco.Open(IsolationLevel.ReadCommitted);
            }
            else
            {
                dao._Banco = banco;
            }

            string tabelasNaoVerificarIntegridade = "ACA_Sondagem,ACA_SondagemAgendamento,ACA_SondagemAgendamentoPeriodo,ACA_SondagemQuestao,ACA_SondagemResposta,CLS_AlunoSondagem";

            try
            {
                //Verifica se a disciplina pode ser deletada
                if (GestaoEscolarUtilBO.VerificarIntegridade("snd_id", entity.snd_id.ToString(), tabelasNaoVerificarIntegridade, dao._Banco))
                {
                    throw new ValidationException("Não é possível excluir a sondagem " + entity.snd_titulo + ", pois possui outros registros ligados a ela.");
                }

                LimpaCache(entity);

                //Deleta logicamente a disciplina
                return(dao.Delete(entity));
            }
            catch (Exception err)
            {
                if (banco == null)
                {
                    dao._Banco.Close(err);
                }

                throw;
            }
            finally
            {
                if (banco == null)
                {
                    dao._Banco.Close();
                }
            }
        }
        /// <summary>
        /// Verifica a integridade antes de deletar
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="banco"></param>
        /// <returns></returns>
        public static bool Delete
        (
            CLS_TipoAtividadeAvaliativa entity
            , TalkDBTransaction banco = null
        )
        {
            CLS_TipoAtividadeAvaliativaDAO dao = new CLS_TipoAtividadeAvaliativaDAO();

            if (banco == null)
            {
                dao._Banco.Open(IsolationLevel.ReadCommitted);
            }
            else
            {
                dao._Banco = banco;
            }

            string tabelasNaoVerificarIntegridade = "CLS_TipoAtividadeAvaliativa";

            try
            {
                //Verifica se a disciplina pode ser deletada
                if (GestaoEscolarUtilBO.VerificarIntegridade("tav_id", entity.tav_id.ToString(), tabelasNaoVerificarIntegridade, dao._Banco))
                {
                    throw new ValidationException("Não é possível excluir o tipo de atividade " + entity.tav_nome + ", pois possui outros registros ligados a ela.");
                }

                //Deleta logicamente a disciplina
                return(dao.Delete(entity));
            }
            catch (Exception err)
            {
                if (banco == null)
                {
                    dao._Banco.Close(err);
                }

                throw;
            }
            finally
            {
                if (banco == null)
                {
                    dao._Banco.Close();
                }
            }
        }
Beispiel #10
0
        public new static bool Delete
        (
            ACA_Docente entity
        )
        {
            ACA_DocenteDAO dao = new ACA_DocenteDAO();

            dao._Banco.Open(IsolationLevel.ReadCommitted);

            try
            {
                //Verifica se o docente pode ser deletado
                if (GestaoEscolarUtilBO.VerificarIntegridade("doc_id", entity.doc_id.ToString(), "ACA_Docente,REL_SituacaoPlanejamentoAulasNotas", dao._Banco))
                {
                    throw new ValidationException("Não é possível excluir o docente pois possui outros registros ligados a ele.");
                }

                //Deleta logicamente o docente
                dao.Delete(entity);

                RHU_Colaborador col = new RHU_Colaborador {
                    col_id = entity.col_id
                };
                RHU_ColaboradorBO.GetEntity(col);

                RHU_ColaboradorBO.Delete(col, dao._Banco);

                //Limpa o cache do docente
                CacheManager.Factory.Remove(string.Format(ModelCache.DOCENTE_POR_ENTIDADE_PESSOA_MODEL_KEY, col.ent_id, col.pes_id));

                return(true);
            }
            catch (Exception err)
            {
                dao._Banco.Close(err);
                throw;
            }
            finally
            {
                dao._Banco.Close();
            }
        }
Beispiel #11
0
        public new static bool Delete
        (
            RHU_Funcao entity
        )
        {
            RHU_FuncaoDAO dao = new RHU_FuncaoDAO();

            dao._Banco.Open(IsolationLevel.ReadCommitted);

            SYS_EntidadeDAO entDao = new SYS_EntidadeDAO();

            entDao._Banco.Open(IsolationLevel.ReadCommitted);

            try
            {
                //Verifica se a função pode ser deletada
                if (GestaoEscolarUtilBO.VerificarIntegridade("fun_id", entity.fun_id.ToString(), "RHU_Funcao", dao._Banco))
                {
                    throw new ValidationException("Não é possível excluir a função pois possui outros registros ligados a ela.");
                }

                //Decrementa um na integridade da entidade
                entDao.Update_DecrementaIntegridade(entity.ent_id);

                //Deleta logicamente a função
                dao.Delete(entity);

                return(true);
            }
            catch (Exception err)
            {
                dao._Banco.Close(err);
                entDao._Banco.Close(err);

                throw;
            }
            finally
            {
                dao._Banco.Close();
                entDao._Banco.Close();
            }
        }
        public new static bool Delete
        (
            ACA_HistoricoObservacaoPadrao entity
        )
        {
            ACA_HistoricoObservacaoPadraoDAO dao = new ACA_HistoricoObservacaoPadraoDAO();

            dao._Banco.Open(IsolationLevel.ReadCommitted);

            try
            {
                //Verifica se o tipo de movimentação pode ser deletado
                if (GestaoEscolarUtilBO.VerificarIntegridade("hop_id", entity.hop_id.ToString(), "ACA_HistoricoObservacaoPadrao", dao._Banco))
                {
                    throw new ValidationException("Não é possível excluir a observação do histórico escolar pois possui outros registros ligados a ela.");
                }

                if (MTR_ParametroTipoMovimentacaoBO.VerificaValorParametroTipoMovimentacao(entity.hop_id.ToString(), ChaveParametroTipoMovimentacao.ObservacaoPadraoHistorico))
                {
                    throw new ValidationException("Não é possível excluir a observação do histórico escolar pois possui outros registros ligados a ela.");
                }

                //Deleta logicamente a observação do histórico escolar
                dao.Delete(entity);

                return(true);
            }
            catch (Exception err)
            {
                dao._Banco.Close(err);

                throw;
            }
            finally
            {
                dao._Banco.Close();
            }
        }
        public new static bool Delete
        (
            ACA_TipoJustificativaFalta entity
        )
        {
            ACA_TipoJustificativaFaltaDAO dao = new ACA_TipoJustificativaFaltaDAO();

            dao._Banco.Open(IsolationLevel.ReadCommitted);

            try
            {
                //Verifica se o tipo de justificativa de falta
                if (GestaoEscolarUtilBO.VerificarIntegridade
                    (
                        "tjf_id"
                        , entity.tjf_id.ToString()
                        , "ACA_TipoJustificativaFalta"
                        , dao._Banco
                    ))
                {
                    throw new ValidationException("Não é possível excluir o tipo de justificativa de falta pois possui outros registros ligados a ele.");
                }

                //Deleta logicamente o tipo de justificativa de falta
                dao.Delete(entity);

                return(true);
            }
            catch (Exception ex)
            {
                dao._Banco.Close(ex);
                throw;
            }
            finally
            {
                dao._Banco.Close();
            }
        }
Beispiel #14
0
 /// <summary>
 /// Carrega os dados de tipo de período calendáro
 /// </summary>
 /// <param name="tne_id">Id de tipo de período calendário</param>
 private void _LoadFromEntity(int tpc_id)
 {
     try
     {
         ACA_TipoPeriodoCalendario tipoPeriodoCalendario = new ACA_TipoPeriodoCalendario {
             tpc_id = tpc_id
         };
         ACA_TipoPeriodoCalendarioBO.GetEntity(tipoPeriodoCalendario);
         _VS_tpc_id    = tipoPeriodoCalendario.tpc_id;
         _VS_tpc_ordem = tipoPeriodoCalendario.tpc_ordem;
         _txtTipoPeriodoCalendario.Text          = tipoPeriodoCalendario.tpc_nome;
         _txtTipoPeriodoCalendarioAbreviado.Text = tipoPeriodoCalendario.tpc_nomeAbreviado;
         _ckbForaPeriodoLetivo.Checked           = tipoPeriodoCalendario.tpc_foraPeriodoLetivo;
         _ckbBloqueado.Checked         = !tipoPeriodoCalendario.tpc_situacao.Equals(1);
         _ckbBloqueado.Visible         = true;
         _ckbForaPeriodoLetivo.Enabled = !GestaoEscolarUtilBO.VerificarIntegridade("tpc_id", _VS_tpc_id.ToString(), "ACA_TipoPeriodoCalendario,REL_AlunosSituacaoFechamento", null);
     }
     catch (Exception e)
     {
         ApplicationWEB._GravaErro(e);
         _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o tipo de período do calendário.", UtilBO.TipoMensagem.Erro);
     }
 }
Beispiel #15
0
        /// <summary>
        /// Deleta um relatório de atendimento que não estiver sendo usado
        /// </summary>
        /// <param name="entity">Entidade do relatório de atendimento que vai excluir</param>
        /// <param name="banco">Transação de banco</param>
        /// <returns></returns>
        public static bool Delete(CLS_RelatorioAtendimento entity, TalkDBTransaction banco = null)
        {
            CLS_RelatorioAtendimentoDAO dao = new CLS_RelatorioAtendimentoDAO();

            if (banco == null)
            {
                dao._Banco.Open(IsolationLevel.ReadCommitted);
            }
            else
            {
                dao._Banco = banco;
            }

            string tabelasNaoVerificarIntegridade = "CLS_RelatorioAtendimento,CLS_RelatorioAtendimentoCargo,CLS_RelatorioAtendimentoGrupo,CLS_RelatorioAtendimentoQuestionario";

            try
            {
                //Verifica se a disciplina pode ser deletada
                if (GestaoEscolarUtilBO.VerificarIntegridade("snd_id", entity.rea_id.ToString(), tabelasNaoVerificarIntegridade, dao._Banco))
                {
                    throw new ValidationException("Não é possível excluir o relatório de atendimento " + entity.rea_titulo + ", pois possui outros registros ligados a ele.");
                }

                //Deleta logicamente a disciplina
                return(dao.Delete(entity));
            }
            catch (Exception ex)
            {
                dao._Banco.Close(ex);
                throw;
            }
            finally
            {
                dao._Banco.Close();
            }
            return(true);
        }
Beispiel #16
0
        public new static bool Delete
        (
            ORC_Objetivo entity
        )
        {
            ORC_ObjetivoDAO dao = new ORC_ObjetivoDAO();

            // Verifica se o objetivo da orientação curricular pode ser deletado
            if (GestaoEscolarUtilBO.VerificarIntegridade
                (
                    "obj_id"
                    , entity.obj_id.ToString()
                    , "ORC_Objetivo,ORC_Conteudo,ORC_ConteudoItem,ORC_Habilidades,ORC_ConteudoTipoPeriodoCalendario"
                    , dao._Banco
                ))
            {
                throw new ValidationException("Não é possível excluir o objetivo da orientação curricular, pois possui outros registros ligados a ele.");
            }

            // Deleta logicamente o objetivo da orientação curricular
            dao.Delete(entity);

            return(true);
        }
Beispiel #17
0
        public new static bool Delete(ACA_TipoMacroCampoEletivaAluno entity)
        {
            ACA_TipoMacroCampoEletivaAlunoDAO dao = new ACA_TipoMacroCampoEletivaAlunoDAO();

            dao._Banco.Open(IsolationLevel.ReadCommitted);

            try
            {
                if (GestaoEscolarUtilBO.VerificarIntegridade("tea_id", entity.tea_id.ToString(), "ACA_TipoMacroCampoEletivaAluno", dao._Banco))
                {
                    throw new ValidationException("Não é possível excluir o tipo de macro-campo " + CustomResource.GetGlobalResourceObject("Mensagens", "MSG_DISCIPLINA") + " eletivo(a) pois possui outros registros ligados a ele.");
                }
                return(dao.Delete(entity));
            }
            catch (Exception ex)
            {
                dao._Banco.Close(ex);
                throw;
            }
            finally
            {
                dao._Banco.Close();
            }
        }
Beispiel #18
0
    private void _LoadFromEntity(int crg_id)
    {
        try
        {
            RHU_Cargo Cargo = new RHU_Cargo {
                crg_id = crg_id
            };
            RHU_CargoBO.GetEntity(Cargo);

            CarregarDisciplinas(Cargo);

            if (Cargo.ent_id != __SessionWEB.__UsuarioWEB.Usuario.ent_id)
            {
                __SessionWEB.PostMessages = UtilBO.GetErroMessage("O cargo não pertence à entidade na qual você está logado.", UtilBO.TipoMensagem.Alerta);
                Response.Redirect("Busca.aspx", false);
                HttpContext.Current.ApplicationInstance.CompleteRequest();
            }

            _VS_crg_id = Cargo.crg_id;
            _UCComboTipoVinculo.Valor         = Cargo.tvi_id;
            _UCComboTipoVinculo.PermiteEditar = false;
            _ckbCargoDocente.Enabled          = false;
            _ckbEspecialista.Enabled          = false;
            _txtNome.Text                 = Cargo.crg_nome;
            _txtCodigo.Text               = Cargo.crg_codigo;
            _txtDescricao.Text            = Cargo.crg_descricao;
            _txtCodIntegracao.Text        = Cargo.crg_codIntegracao;
            _txtMaxAulaSemana.Text        = Cargo.crg_maxAulaSemana.ToString();
            _txtMaxAulaDia.Text           = Cargo.crg_maxAulaDia.ToString();
            ckbControleIntegracao.Checked = Cargo.crg_controleIntegracao;

            ddlTipo.SelectedValue = Cargo.crg_tipo.ToString();

            if (!string.IsNullOrEmpty(Cargo.pgs_chave))
            {
                if (UCComboParametroGrupoPerfil1.ExisteItem(Cargo.pgs_chave))
                {
                    UCComboParametroGrupoPerfil1.Valor = Cargo.pgs_chave;
                }
            }

            _ckbBloqueado.Visible = true;
            _ckbBloqueado.Checked = !Cargo.crg_situacao.Equals(1);

            if (Cargo.crg_cargoDocente.Equals(false))
            {
                _ckbCargoDocente.Checked = false;
                divDisciplinas.Visible   = false;
            }
            else
            {
                _ckbCargoDocente.Checked = true;

                if (_txtMaxAulaDia.Text == "0")
                {
                    _txtMaxAulaDia.Text = string.Empty;
                }
                if (_txtMaxAulaSemana.Text == "0")
                {
                    _txtMaxAulaSemana.Text = string.Empty;
                }
                divDisciplinas.Visible = true;

                divCargoDocente.Visible = true;

                _ckbEspecialista.Visible = true;

                if (Cargo.crg_especialista.Equals(true))
                {
                    _ckbEspecialista.Checked = true;
                    divDisciplinas.Visible   = false;
                }
                else
                {
                    divDisciplinas.Visible = true;
                }

                if (GestaoEscolarUtilBO.VerificarIntegridade("crg_id", _VS_crg_id.ToString(), "RHU_Cargo", null))
                {
                    _txtMaxAulaDia.Enabled    = false;
                    _txtMaxAulaSemana.Enabled = false;
                }
                else
                {
                    _txtMaxAulaDia.Enabled    = true;
                    _txtMaxAulaSemana.Enabled = true;
                }
            }
        }
        catch (Exception ex)
        {
            ApplicationWEB._GravaErro(ex);
            _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o cargo.", UtilBO.TipoMensagem.Erro);
        }
    }