//Working(Temporary). Will delete after finishing webapi.config public async Task <PierClaimScanResponse> PierScan(PierClaimScanInput input) { //var x = GetWebApi("AuthWebService"); PierClaimScanResponse items = new PierClaimScanResponse(); var restUrl = "http://172.26.82.21:5000/PierWebservice/bags"; var uri = new Uri(string.Format(restUrl, string.Empty)); var json = JsonConvert.SerializeObject(input); var content = new StringContent(json, Encoding.UTF8, "application/json"); var response = await client.PostAsync(uri, content); if (response.IsSuccessStatusCode) { var contents = await response.Content.ReadAsStringAsync(); items = JsonConvert.DeserializeObject <PierClaimScanResponse>(contents); } return(items); ////logger.Trace("Service : IRestService, Method : PierClaimScan , Request : PierClaimScanInput = {"Bags" : input.Bags, "DeviceName" : input.DeviceName,"MyProperty" : input.MyProperty,"PierClaimLocation": input.PierClaimLocation, "Station" : input.Station, "Version" : input.Version};") //PierClaimScanResponse pierClaimScan = new PierClaimScanResponse(); //pierClaimScan.Success = true; ////logger.Trace("Service : IRestService , Method : PierClaimScan , Response : PierClaimScanResponse = {"ReturnCode":PierResponse.ReturnCode,"Message":PierResponse.Message}; //return pierClaimScan; }
public PierClaimScanResponse PierClaimScan(PierClaimScanInput input) { //logger.Trace("Service : IRestService, Method : PierClaimScan , Request : PierClaimScanInput = {"Bags" : input.Bags, "DeviceName" : input.DeviceName,"MyProperty" : input.MyProperty,"PierClaimLocation": input.PierClaimLocation, "Station" : input.Station, "Version" : input.Version};") PierClaimScanResponse pierClaimScan = new PierClaimScanResponse(); pierClaimScan.ReturnCode = "1"; //logger.Trace("Service : IRestService , Method : PierClaimScan , Response : PierClaimScanResponse = {"ReturnCode":PierResponse.ReturnCode,"Message":PierResponse.Message}; return(pierClaimScan); }
private async void ScanBagtagExecuted() { if (!string.IsNullOrEmpty(BagtagNo)) { PierClaimScanInput pierClaimInput = new PierClaimScanInput(); PierClaimScanResponse scanResult = new PierClaimScanResponse(); pierClaimInput.Username = "******"; pierClaimInput.Version = "0.1"; pierClaimInput.DeviceName = "Android"; pierClaimInput.Station = "MNL"; pierClaimInput.Location = "Pier"; pierClaimInput.SubLocation = "PIER0001"; List <Bag> bagList = new List <Bag>(); bagList.Add(new Bag() { Bagtag = BagtagNo, Latitude = "", Longitude = "", ScanTime = DateTime.Now }); pierClaimInput.Bags = bagList; if (pierClaimFlag == "Pier") { scanResult = await Mvx.Resolve <IRestService>().PierScan(pierClaimInput); } else { scanResult = await Mvx.Resolve <IRestService>().ClaimScan(pierClaimInput); } foreach (var bag in scanResult.Bags) { if (bag.Success == true) { TotalValue++; SuccessValue++; } else { TotalValue++; FailedValue++; } } BagtagNo = ""; } else { Mvx.Resolve <IUserDialogs>().Alert("Bagtag cannot be empty.", null, "Dismiss"); } }
//Working(Temporary). Will delete after finishing webapi.config public async Task <PierClaimScanResponse> ClaimScan(PierClaimScanInput input) { PierClaimScanResponse items = new PierClaimScanResponse(); var uri = "http://172.26.82.21:5000/ClaimWebservice/bags"; var json = JsonConvert.SerializeObject(input); var content = new StringContent(json, Encoding.UTF8, "application/json"); var response = await client.PostAsync(uri, content); if (response.IsSuccessStatusCode) { var contents = await response.Content.ReadAsStringAsync(); items = JsonConvert.DeserializeObject <PierClaimScanResponse>(contents); } return(items); }