public WorksheetSignOffPopUp() { InitializeComponent(); // LoadID = Loadid; _apiServices = new RestApi(); _baseUrl = Settings.Url + Domain.WorkSheetSignOffSigApiConstant; _objDriver_WorkSheetSignOffResponse = new Driver_WorkSheetSignOffResponse(); _objHeaderModel = new HeaderModel(); }
private async void btnSubmit_Clicked(object sender, EventArgs e) { try { String imageBase64; Stream image = await padView.GetImageStreamAsync(SignaturePad.Forms.SignatureImageFormat.Jpeg, Color.Black, Color.White, 1f); _objHeaderModel.TokenCode = Settings.TokenCode; string CustomerName = custName.Text; if (image != null && !string.IsNullOrEmpty(CustomerName) && OffsiteTime != null) { imageBase64 = Base64Extensions.ConvertToBase64(image); _objDriver_WorkSheetSignOffRequest = new Driver_WorkSheetSignOffRequest { Id = Settings.WorksheetID.ToString(), CustomerName = custName.Text, CustomerSign = imageBase64, OffSiteFinishTime = OffsiteTime }; await Navigation.PushPopupAsync(new LoadingPopPage()); _objDriver_WorkSheetSignOffResponse = await _apiServices.WorkSheetSignOffSignAsync(new Get_API_Url().WorkSheetSignOffSignApi(_baseUrl), true, _objHeaderModel, _objDriver_WorkSheetSignOffRequest); if (_objDriver_WorkSheetSignOffResponse.Response.StatusCode == 200) { Settings.IsPreStartChecked = false; DependencyService.Get <IToast>().Show(_objDriver_WorkSheetSignOffResponse.Response.Message); await App.NavigationPage.Navigation.PushAsync(new Driver_WorksheetPage()); await Navigation.PopAllPopupAsync(); } else { DependencyService.Get <IToast>().Show("Something Bad Happend please Try again Later!"); await Navigation.PopAllPopupAsync(); } } else { DependencyService.Get <IToast>().Show("Please Sign over the signature pad to submit the Dailychecklist!"); } //await App.NavigationPage.Navigation.PushAsync(new WorkSheetDetailsPage()); //await Navigation.PopAllPopupAsync(); } catch (Exception ex) { DependencyService.Get <IToast>().Show("Something Went Wrong please try Again or check your Internet Connection!!"); await Navigation.PopAllPopupAsync(); var msg = ex.Message; } }