public void Logout(User user, ISellTicketsClient client) { Console.WriteLine("SellTicketsServer - LogOut"); this._loggedClients.Remove(key: user.Username); Console.WriteLine("SellTicketsServer - LogOut succesfuly"); }
public void Login(User user, ISellTicketsClient client) { Console.WriteLine("SellTicketsServer - LogIn"); this._userService.LogIn(user.Username, user.Password); this._loggedClients.Add(user.Username, client); Console.WriteLine("SellTicketsServer - Login succesfuly"); }
public virtual void Logout(User user, ISellTicketsClient client) { UserDTO udto = DTOUtils.GetDTO(user); SendRequest(new LogoutRequest(udto)); IResponse response = ReadResponse(); CloseConnection(); if (response is ErrorResponse) { ErrorResponse err = (ErrorResponse)response; throw new ControllerException(err.Message); } }
private void CloseConnection() { _finished = true; try { _stream.Close(); //output.close(); _connection.Close(); _waitHandle.Close(); _client = null; } catch (Exception e) { Console.WriteLine(e.StackTrace); } }
public virtual void Login(User user, ISellTicketsClient client) { InitializeConnection(); var udto = DTOUtils.GetDTO(user); SendRequest(new LoginRequest(udto)); var response = ReadResponse(); if (response is OkResponse) { this._client = client; return; } else if (response is ErrorResponse) { var err = (ErrorResponse)response; CloseConnection(); throw new ControllerException(err.Message); } }