/// <summary> /// Takes a company object, converts it into JSON and sends it to the java server. Expect a server reply used for tests. /// </summary> /// <param name="company"></param> public void registerCompany(Model.Company company) { SocketRequest = new SocketRequest(); SocketRequest.Action = ACTION.REGISTER_COMPANY; SocketRequest.Obj = company; //send request string requestAsJSON = JsonConvert.SerializeObject(SocketRequest); communicationController.SendMessage(requestAsJSON); // used for testing purposes string JsonString = communicationController.ReadReplyMessage(); bool response = false; if (JsonString.Equals("success")) { response = true; } communicationController.clientSocket.Close(); //return response; }
public void removeLocationFromCurrentCompany(string locationID) { SocketRequest = new SocketRequest(); SocketRequest.Action = ACTION.REMOVE_LOCATION_FROM_CURRENT_COMPANY; SocketRequest.LocationID = locationID; //send request string requestAsJSON = JsonConvert.SerializeObject(SocketRequest); communicationController.SendMessage(requestAsJSON); // used for testing purposes string JsonString = communicationController.ReadReplyMessage(); bool response = false; if (JsonString.Equals("success")) { response = true; } communicationController.clientSocket.Close(); //return response; }
public LocationList getAvailableLocationList() { SocketRequest = new SocketRequest(); SocketRequest.Action = ACTION.GET_AVAILABLE_LOCATIONS; //send request string requestAsJSON = JsonConvert.SerializeObject(SocketRequest); communicationController.SendMessage(requestAsJSON); // used for testing purposes string JsonString = communicationController.ReadReplyMessage(); LocationList tempLocationList = new LocationList(); communicationController.clientSocket.NoDelay = true; //deserializing tempLocationList = JsonConvert.DeserializeObject <LocationList>(JsonString); communicationController.clientSocket.Close(); return(tempLocationList); }
public PalletList getAvailablePalletList() { SocketRequest = new SocketRequest(); SocketRequest.Action = ACTION.GET_PALLET_LIST; //send request string requestAsJSON = JsonConvert.SerializeObject(SocketRequest); communicationController.SendMessage(requestAsJSON); // used for testing purposes string JsonString = communicationController.ReadReplyMessage(); PalletList tempPalletList = new PalletList(); communicationController.clientSocket.NoDelay = true; //deserializing tempPalletList = JsonConvert.DeserializeObject <PalletList>(JsonString); communicationController.clientSocket.Close(); return(tempPalletList); }
public void updatePallet(Pallet pallet) { SocketRequest = new SocketRequest(); SocketRequest.Action = ACTION.EDIT_PALLET; SocketRequest.Obj = pallet; //send request string requestAsJSON = JsonConvert.SerializeObject(SocketRequest); communicationController.SendMessage(requestAsJSON); // used for testing purposes string JsonString = communicationController.ReadReplyMessage(); bool response = false; if (JsonString.Equals("success")) { response = true; } communicationController.clientSocket.Close(); //return response; }
public LocationList getRentedLocationList(string companyID) { SocketRequest = new SocketRequest(); SocketRequest.Action = ACTION.GET_LOCATIONS_OF_CURRENT_COMPANY; SocketRequest.CompanyID = companyID; //send request string requestAsJSON = JsonConvert.SerializeObject(SocketRequest); communicationController.SendMessage(requestAsJSON); // used for testing purposes string JsonString = communicationController.ReadReplyMessage(); LocationList tempLocationList = new LocationList(); communicationController.clientSocket.NoDelay = true; //deserializing tempLocationList = JsonConvert.DeserializeObject <LocationList>(JsonString); communicationController.clientSocket.Close(); return(tempLocationList); }
public void removePallet(string palletID, string companyID) { SocketRequest = new SocketRequest(); SocketRequest.Action = ACTION.REMOVE_PALLET; SocketRequest.PalletID = palletID; SocketRequest.CompanyID = companyID; //send request string requestAsJSON = JsonConvert.SerializeObject(SocketRequest); communicationController.SendMessage(requestAsJSON); // used for testing purposes string JsonString = communicationController.ReadReplyMessage(); bool response = false; if (JsonString.Equals("success")) { response = true; } communicationController.clientSocket.Close(); //return response; }
public void assignLocationToCompany(string locationID, string companyID) { SocketRequest = new SocketRequest(); SocketRequest.Action = ACTION.ASSIGN_LOCATION_TO_COMPANY; SocketRequest.LocationID = locationID; SocketRequest.CompanyID = companyID; //serializing to Json string requestAsJSON = JsonConvert.SerializeObject(SocketRequest); //send request communicationController.SendMessage(requestAsJSON); // used for testing purposes string JsonString = communicationController.ReadReplyMessage(); bool response = false; if (JsonString.Equals("success")) { response = true; } communicationController.clientSocket.Close(); //return response; }