public AddDamageSignMobileResponse saveDamageSignature(AddDamageSignMobileRequest signMobileRequest, string token) { AddDamageSignMobileResponse result = null; try { using (var client = new HttpClient()) { client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "AgreementMobile/SaveDamageSign"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); var myContent = JsonConvert.SerializeObject(signMobileRequest); var buffer = Encoding.UTF8.GetBytes(myContent); var byteContent = new ByteArrayContent(buffer); byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var response = client.PostAsync(client.BaseAddress, byteContent).Result; if (response.IsSuccessStatusCode) { var responseStream = response.Content.ReadAsStringAsync().Result; result = JsonConvert.DeserializeObject <AddDamageSignMobileResponse>(responseStream); } } } catch (Exception ex) { throw ex; } return(result); }
private AddDamageSignMobileResponse saveDamageSignature(AddDamageSignMobileRequest signMobileRequest, string token) { AgreementController agreementController = new AgreementController(); AddDamageSignMobileResponse response = null; try { response = agreementController.saveDamageSignature(signMobileRequest, token); } catch (Exception e) { throw e; } return(response); }
public AddDamageSignMobileResponse saveDamageSignature(AddDamageSignMobileRequest signMobileRequest, string token) { AddDamageSignMobileResponse response = null; try { response = agreementService.saveDamageSignature(signMobileRequest, token); } catch (Exception ex) { throw ex; } return(response); }
private async void SaveSignatureBtn_Clicked(object sender, EventArgs e) { bool confirm = await DisplayAlert("Alert", "Are you sure want to save ?", "Yes", "No"); if (confirm) { SignMobileRequest.agreementId = agreementId; //Stream bitmap = await signatureView.GetImageStreamAsync(SignatureImageFormat.Png); //StreamReader reader = new StreamReader(bitmap); //byte[] bytedata = System.Text.Encoding.Default.GetBytes(reader.ReadToEnd()); Stream img = await signatureView.GetImageStreamAsync(SignatureImageFormat.Png); BinaryReader br = new BinaryReader(img); br.BaseStream.Position = 0; Byte[] All = br.ReadBytes((int)img.Length); string strBase64 = Convert.ToBase64String(All); SignMobileRequest.base64Img = strBase64; SignMobileRequest.ischeckin = true; signMobileResponse = saveDamageSignature(SignMobileRequest, token); if (signMobileResponse != null) { if (signMobileResponse.message.ErrorCode == "200") { await PopupNavigation.Instance.PushAsync(new SuccessPopUp("Your signature saved successfully!")); signatureView.IsEnabled = false; signatureBtnGrid.IsVisible = false; } else { await PopupNavigation.Instance.PushAsync(new Error_popup(signMobileResponse.message.ErrorMessage)); } } } }
public DamageCheckListCheckIn(int agreementId, string AgreementNumber, int VehicleId) { InitializeComponent(); this.agreementId = agreementId; this.agreementNumber = AgreementNumber; this.vehicleId = VehicleId; checklistMobileRequest = new GetChecklistMobileRequest(); checklistMobileRequest.AgreementId = agreementId; checklistMobileRequest.clientId = Constants.ClientId; checklistMobileResponse = null; token = App.Current.Properties["currentToken"].ToString(); SignMobileRequest = new AddDamageSignMobileRequest(); signMobileResponse = null; imageURLMobileRequest = new ReloadSignatureImageURLMobileRequest(); imageURLMobileRequest.agreementId = agreementId; imageURLMobileRequest.IsCheckIn = true; imageURLMobileRequest.isDamageView = true; imageURLMobileResponse = null; imageURLMobileRequest.SignatureImageUrl = ""; }
public DamageCheckListCheckOut(int agreementId, string agreementNo, int status, int VehicleId) { InitializeComponent(); On <Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true); this.agreementId = agreementId; AgreementNumber = agreementNo; this.VehicleId = VehicleId; this.status = status; checklistMobileRequest = new GetChecklistMobileRequest(); checklistMobileRequest.AgreementId = agreementId; checklistMobileRequest.clientId = Constants.ClientId; checklistMobileResponse = null; token = App.Current.Properties["currentToken"].ToString(); signMobileResponse = null; SignMobileRequest = new AddDamageSignMobileRequest(); imageURLMobileRequest = new ReloadSignatureImageURLMobileRequest(); imageURLMobileRequest.agreementId = agreementId; imageURLMobileRequest.IsCheckIn = false; imageURLMobileRequest.isDamageView = true; imageURLMobileResponse = null; imageURLMobileRequest.SignatureImageUrl = ""; }