private async void SwapComponent() { SwapComponentRequest request = new SwapComponentRequest { RequestType = _customerDetailsResponse.IdentifierType, RequestValue = _customerDetailsResponse.Identifier, IncomingComponentId = _incomingProductComponent.StockId, OutgoingComponentId = _outgoingProductComponent.StockId, Reason = reason, }; Log.Verbose("Swap details RequestType= " + request.RequestType + ",RequestValue= " + request.RequestValue + " Incoming ComponentId= " + request.IncomingComponentId + " Outgoing ComponentId= " + request.OutgoingComponentId + ",Reason " + request.Reason); Log.Verbose("Get components of a product."); var progressDialog = ProgressDialog.Show(this, GetString(Resource.String.please_wait), GetString(Resource.String.swapping_component), true); api = new SwapComponentApi(); SwapComponentResponse swapComponentResponse = await api.SwapComponent(request); progressDialog.Hide(); Intent intent = null; Bundle extras = new Bundle(); extras.PutString("product", JsonConvert.SerializeObject(_product)); extras.PutString("customerDetailsResponse", JsonConvert.SerializeObject(_customerDetailsResponse)); extras.PutString("productComponentsResponse", JsonConvert.SerializeObject(_productComponentsResponse)); if (swapComponentResponse.Success) { Log.Verbose("Swap was successful"); intent = new Intent(this, typeof(SwapSuccessfulActivity)); } else { Log.Verbose("Something went wrong - Swap failed"); intent = new Intent(this, typeof(SwapFailedActivity)); // extras.PutInt("stockId", _incomingProductComponent.StockId); // extras.PutString("reason", reason); extras.PutString("incomingProductComponent", JsonConvert.SerializeObject(_incomingProductComponent)); extras.PutString("outgoingProductComponent", JsonConvert.SerializeObject(_outgoingProductComponent)); extras.PutString("reason", reason); extras.PutString("swapComponentResponse", JsonConvert.SerializeObject(swapComponentResponse)); } //pass the product details intent.PutExtras(extras); StartActivity(intent); }
private async void SwapComponent() { Log.Verbose("Trying to Swap Component"); SwapComponentRequest request = new SwapComponentRequest { RequestType = _customerDetailsResponse.IdentifierType, RequestValue = _customerDetailsResponse.Identifier, IncomingComponentId = _incomingProductComponent.StockId, OutgoingComponentId = _outgoingProductComponent.StockId, Reason = reason, }; Log.Verbose("Swap details RequestType= " + request.RequestType + ",RequestValue= " + request.RequestValue + " Incoming ComponentId= " + request.IncomingComponentId + " Outgoing ComponentId= " + request.OutgoingComponentId + ",Reason " + request.Reason); Log.Verbose("Get components of a product."); SwapComponentResponse swapComponentResponse = await api.SwapComponent(request); if (swapComponentResponse.Success) { Log.Verbose("Swap was successful"); Bundle extras = new Bundle(); extras.PutString("product", JsonConvert.SerializeObject(_product)); extras.PutString("customerDetailsResponse", JsonConvert.SerializeObject(_customerDetailsResponse)); extras.PutString("productComponentsResponse", JsonConvert.SerializeObject(_productComponentsResponse)); Intent intent = new Intent(this, typeof(SwapSuccessfulActivity)); //pass the product details intent.PutExtras(extras); StartActivity(intent); } else { Log.Verbose("Something went wrong - Swap failed"); numOfRetries = numOfRetries + 1; //TryAgain(); progressDialog.Hide(); } }