/// <summary> /// Sends the data to be echo'd to the service bus /// </summary> /// <param name="request">The data to be echo'd</param> /// <returns>The response from the servicebus</returns> public static ServiceBusResponse echoAsIs(AsIsEchoRequest request) { ServiceBusConnection tempConnection = new ServiceBusConnection(""); ServiceBusResponse response = tempConnection.echoAsIs(request); tempConnection.close(); return(response); }
/// <summary> /// Indicates to the service bus that this client wishes to create a new account. /// Sends the new account info to the service bus and awaits a response indicating success or failure. /// </summary> /// <param name="msg">The CreateAccount object containing the new accounts information</param> /// <returns>The response from the bus</returns> public static ServiceBusResponse sendNewAccountInfo(CreateAccountRequest request) { ServiceBusConnection newConnection = new ServiceBusConnection(request.createCommand.username); ServiceBusResponse response = newConnection.sendNewAccountInfo(request); if (response.result == true) { addConnection(request.createCommand.username, newConnection); Globals.setUser(request.createCommand.username); } else { newConnection.close(); } return(response); }
/// <summary> /// Sends the login information to the bus /// </summary> /// <param name="request">The request to be sent to the service bus containg the necessary information</param> /// <returns>The response from the bus</returns> public static ServiceBusResponse sendLogIn(LogInRequest request) { ServiceBusConnection newConnection = new ServiceBusConnection(request.username); ServiceBusResponse response = newConnection.sendLogIn(request); if (response.result == true) { addConnection(request.username, newConnection); Globals.setUser(request.username); } else { newConnection.close(); } return(response); }
/// <summary> /// Sends the login information to the bus /// </summary> /// <param name="request">The request to be sent to the service bus containg the necessary information</param> /// <returns>The response from the bus</returns> public static ServiceBusResponse sendLogIn(LogInRequest request) { ServiceBusConnection newConnection = new ServiceBusConnection(request.username); ServiceBusResponse response = newConnection.sendLogIn(request); if (response.result == true) { addConnection(request.username, newConnection); Globals.setUser(request.username); response.response = "Login Successful"; } else { newConnection.close(); response.response = "Incorrect Username and/or Password"; } return(response); }
/// <summary> /// Adds the given connection to the list of connection with the given string as a key /// </summary> /// <param name="user">The identifier for the connection</param> /// <param name="connection">The ServiceBusConnection to add to the list</param> private static void addConnection(string user, ServiceBusConnection connection) { connections[user] = connection; }