public async void UploadDetail() { try { Ultis.Settings.RefreshListView = "Yes"; if (!(String.IsNullOrEmpty(reasonPicker.Text))) { try { clsHaulageModel futileJob = new clsHaulageModel(); futileJob.Id = Ultis.Settings.SessionCurrentJobId; futileJob.ActionId = clsHaulageModel.HaulageActionEnum.FutileTrip; futileJob.Remarks = (remarkTextEditor.Text == null) ? "" : remarkTextEditor.Text; futileJob.ReasonCode = reasonCode[reasonPicker.SelectedIndex].Key; var content = await CommonFunction.CallWebService(1, futileJob, Ultis.Settings.SessionBaseURI, ControllerUtil.updateHaulageJobURL(), this); clsResponse response = JsonConvert.DeserializeObject <clsResponse>(content); if (response.IsGood) { confirm_icon.IsEnabled = false; confirm_icon.Source = "confirmDisable.png"; await DisplayAlert("Success", "Job status uploaded", "OK"); Navigation.RemovePage(this.Navigation.NavigationStack[this.Navigation.NavigationStack.Count - 2]); } else { await DisplayAlert("Error", response.Message, "OK"); } } catch (Exception exception) { await DisplayAlert("Error", exception.Message, "OK"); } } else { await DisplayAlert("Error", "Please fill all mandatory field", "OK"); } } catch (HttpRequestException) { await DisplayAlert("Unable to connect", "Please try again later", "Ok"); } catch (Exception) { await DisplayAlert("Reminder", "Please sign for the job.", "OK"); } }
async void button_Clicked(object sender, System.EventArgs e) { var button = sender as SfButton; switch (button.StyleId) { case "btnArrived": try { clsHaulageModel pointIn = new clsHaulageModel { Id = Ultis.Settings.SessionCurrentJobId, ActionId = (jobItem.ActionId.Equals("Point1_In")) ? clsHaulageModel.HaulageActionEnum.Point1_In : clsHaulageModel.HaulageActionEnum.Point2_In }; var content = await CommonFunction.CallWebService(1, pointIn, Ultis.Settings.SessionBaseURI, ControllerUtil.updateHaulageJobURL(), this); clsResponse json_response = JsonConvert.DeserializeObject <clsResponse>(content); if (json_response.IsGood == true) { RefreshJobContent(); } else { await DisplayAlert("Error", json_response.Message, "Okay"); } } catch (Exception exception) { await DisplayAlert("Error", exception.Message, "OK"); } break; case "btnNotArrived": await Navigation.PopAsync(); break; } }