public async Task <RetornoInfoPerfilDTO> GetProfileEmployeeInformation(string codeRF, string codeOccupations, string schoolYear, Guid?Perfil, string roleName = null) { try { var endPoint = new EndpointsAPI(); var profileApi = new PerfilSgpAPI(endPoint); var parseado = int.TryParse(codeOccupations, out int result); var profileInformation = new RetornoInfoPerfilDTO(); // Para coordenador pedagógico, assitente de diretor, diretor busca a abrangência no SGP if (!string.IsNullOrWhiteSpace(roleName) && (roleName.Equals("CP") || roleName.Equals("AD") || roleName.Equals("Diretor"))) { profileInformation = await ObterAbrangencia(codeRF, null, profileInformation); } else { profileInformation = await profileApi .getInformacoesPerfil(codeRF, parseado?result : 0, int.Parse(schoolYear), _token, Perfil); } if (profileInformation != null) { return(profileInformation); } else { return(null); } } catch (System.Exception ex) { return(null); } }
public async Task <RetornoCargosServidorDTO> GetOccupationsRF(string rf) { try { // Pensar num fluxo para que os perfis da cotic enxerguem com duas visualizações // já que quem esta na tabela de privilegios atualmente nao passa aqui. var profileApi = new PerfilSgpAPI(endPoint); var occupations = await profileApi.GetCargosDeServidor(rf, _token); string codigoCargoAtivo; bool occupationAccess = false;; if (occupations != null) { foreach (var occupation in occupations.cargos) { codigoCargoAtivo = RetornaCargoAtivo(occupation); if (codigoCargoAtivo == "3239" || codigoCargoAtivo == "3301" || codigoCargoAtivo == "3336" || codigoCargoAtivo == "3310" || codigoCargoAtivo == "3379" || codigoCargoAtivo == "3360") { occupationAccess = true; break; } } if (occupationAccess) { return(occupations); } else { return(null); } } else { return(null); } } catch (Exception ex) { return(null); } }
public async Task <RetornoCargosServidorDTO> GetOccupationsRF(string rf) { if (string.IsNullOrWhiteSpace(rf)) { return(null); } try { var profileApi = new PerfilSgpAPI(endPoint); var occupations = await profileApi.GetCargosDeServidor(rf, _token); string codigoCargoAtivo; bool occupationAccess = false; if (occupations == null) { return(null); } var temAcesso = await profileApi.VerificaSeProfessorTemAcesso(rf, _token); if (occupations != null && temAcesso) { var cargoProfessor = new RetornoCargoDTO(); cargoProfessor.codigoCargo = CODIGO_CARGO_PROFESSOR; cargoProfessor.nomeCargo = "Professor"; occupations.cargos.Add(cargoProfessor); } foreach (var occupation in occupations.cargos) { codigoCargoAtivo = RetornaCargoAtivo(occupation); if (codigoCargoAtivo == CODIGO_CARGO_CP || codigoCargoAtivo == CODIGO_CARGO_DIRETOR || codigoCargoAtivo == CODIGO_CARGO_AD) { occupationAccess = true; break; } } return(occupations); } catch (Exception ex) { return(null); } }
public async Task <RetornoInfoPerfilDTO> GetProfileEmployeeInformation(string codeRF, string codeOccupations, string schoolYear) { try { var endPoint = new EndpointsAPI(); var profileApi = new PerfilSgpAPI(endPoint); var profileInformation = await profileApi.getInformacoesPerfil(codeRF, int.Parse(codeOccupations), int.Parse(schoolYear), _token); if (profileInformation != null) { return(profileInformation); } else { return(null); } } catch (System.Exception ex) { return(null); } }
public async Task <bool> VerificaSeProfessorTemAcesso(string rf) { var profileApi = new PerfilSgpAPI(endPoint); return(await profileApi.VerificaSeProfessorTemAcesso(rf, _token)); }