/** * This method will not be used by our system but it is nice * to have in order to test that we can call our own service * through code. */ public static TelstarResponse RequestRoute(TelstarRequest request) { string jsonString = JsonSerializer.Serialize(request); string response = CommunicationController.Send(Config.TELSTAR_URL, jsonString); //Console.WriteLine(response); TelstarResponse telstarResponse = JsonSerializer.Deserialize <TelstarResponse>(response); return(telstarResponse); }
public static EastIndiaResponse RequestRoute(CityEnum cityTo, CityEnum cityFrom, int weight, bool fragile, bool recorded) { try { string url = BuildUrl(cityTo, cityFrom, weight, fragile, recorded); string response = CommunicationController.Send(url, ""); //Console.WriteLine(response); EastIndiaResponse eastIndiaResponse = JsonSerializer.Deserialize <EastIndiaResponse>(response); if (eastIndiaResponse.price == -1 || eastIndiaResponse.time == -1) { return(null); } return(eastIndiaResponse); } catch (Exception) { return(null); } }
public static OceanicResponse RequestRoute(CompanyEnum companyCode, CityEnum cityFrom, CityEnum cityTo, string parcelTyoe, int weight, int height, int width, int length) { try { string url = BuildUrl(companyCode, cityFrom, cityTo, parcelTyoe, weight, height, width, length); string response = CommunicationController.Send(url, ""); //Console.WriteLine(response); OceanicResponse oceanicResponse = JsonSerializer.Deserialize <OceanicResponse>(response); if (oceanicResponse.price == -1 || oceanicResponse.time == -1) { return(null); } return(oceanicResponse); } catch (Exception) { return(null); } }