private async Task <string> ExecutePostCloseSession(string urlAuthentication, string stringSession) { string messageLogout = string.Empty; try { LoginItrisRequestEntity request = new LoginItrisRequestEntity() { usersession = stringSession }; httpClient.Timeout = TimeSpan.FromMinutes(30); httpResponseMessage = await httpClient.PostAsJsonAsync <LoginItrisRequestEntity>(new Uri(urlAuthentication), request); if (httpResponseMessage.IsSuccessStatusCode) { var response = await httpResponseMessage.Content.ReadAsAsync <LoginItrisResponseEntity>(); messageLogout = response.message; } else { throw new HttpRequestException(httpResponseMessage.StatusCode.ToString()); } return(messageLogout); } catch (Exception ex) { throw ex; } }
public string OpenSession() { try { string token = string.Empty; LoginItrisRequestEntity loginItrisRequestEntity = new LoginItrisRequestEntity() { app = _authenticateEntity._app, config = _authenticateEntity._config, username = _authenticateEntity._username, password = _authenticateEntity._password, }; ItrisApi3SessionRepository itrisApi3SessionRepository = new ItrisApi3SessionRepository(loginItrisRequestEntity); token = Task.Run( async() => await itrisApi3SessionRepository.ExecutePostAuthenticate(_authenticateEntity.GetApi3LoginUrl()) ).GetAwaiter().GetResult(); return(token); } catch (Exception ex) { throw ex; } }
public string OpenSession() { LoginItrisRequestEntity loginItrisRequestEntity = new LoginItrisRequestEntity() { username = _authenticateEntity._username, password = _authenticateEntity._password, database = _authenticateEntity._database }; itrisSessionRepository = new ItrisSessionRepository(loginItrisRequestEntity); return(itrisSessionRepository.GetItrisSession(_authenticateEntity.LoginUrl())); }
public string CloseSession(string itrisSession) { LoginItrisRequestEntity loginItrisRequestEntity = new LoginItrisRequestEntity() { username = _authenticateEntity._username, password = _authenticateEntity._password, database = _authenticateEntity._database }; itrisSessionRepository = new ItrisSessionRepository(loginItrisRequestEntity); string message = itrisSessionRepository.CloseItrisSession(_authenticateEntity.LogOutUrl(), itrisSession); return(message); }
public ItrisSessionRepository(LoginItrisRequestEntity loginItrisRequestEntity) { _loginItrisRequestEntity = loginItrisRequestEntity; }