public static ModuloRN GetInstance() { if (_instancia == null) { _instancia = new ModuloRN(); } return(_instancia); }
private void ZeraAcessos(PerfilDTO dto) { if (dto.Codigo > 0) { List <ModuloDTO> modulos = ModuloRN.GetInstance().ObterTodosModulos(); ModuloDTO dtoModulo = null; for (int i = 0; i < modulos.Count; i++) { PermissaoModuloDTO dtoPerMod = new PermissaoModuloDTO(); dtoModulo = new ModuloDTO(); dtoModulo.Codigo = modulos[i].Codigo; dtoPerMod.Modulo = dtoModulo; dto = new PerfilDTO(); dtoPerMod.Perfil = dto; dtoPerMod.Acesso = 0; dtoPerMod.Autorizar = 0; dtoPerMod.Visibilidade = 0; PermissaoModuloRN.GetInstance().Inserir(dtoPerMod); // Instancia os Formulários FormularioDTO dtoForm = new FormularioDTO(); dtoForm.Modulo = dtoModulo; // Obtem os Formulário do Módulo List <FormularioDTO> formularios = FormularioRN.GetInstance().ObterFormulariosPorModulo(dtoForm); if (formularios.Count > 0) { for (int f = 0; f < formularios.Count; f++) { PermissaoFormularioDTO dtoPermForm = new PermissaoFormularioDTO(); dtoForm = new FormularioDTO(); dtoForm.Codigo = formularios[f].Codigo; dtoPermForm.Formulario = dtoForm; dtoPermForm.Perfil = dto; dtoPermForm.AllowAccess = 0; dtoPermForm.AllowUpdate = 0; dtoPermForm.AllowSelect = 0; dtoPermForm.AllowDelete = 0; dtoPermForm.AllowPrint = 0; dtoPermForm.AllowInsert = 0; PermissaoFormularioRN.GetInstance().InserirPermissoesFormulario(dtoPermForm); } } } } }