コード例 #1
0
        public AddAgreementSignMobileResponse saveSignature(AddAgreementSignMobileRequest signMobileRequest, string token)
        {
            AddAgreementSignMobileResponse result = null;

            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "AgreementMobile/SaveAgreementSignMobile");
                    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 <AddAgreementSignMobileResponse>(responseStream);
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
コード例 #2
0
        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);


                if (img != null)
                {
                    signatureView.IsEnabled = false;
                    BinaryReader br = new BinaryReader(img);
                    br.BaseStream.Position = 0;
                    Byte[] All = br.ReadBytes((int)img.Length);

                    string strBase64 = Convert.ToBase64String(All);
                    signMobileRequest.base64Img = strBase64;



                    signMobileResponse = saveSignature(signMobileRequest, token);
                    if (signMobileResponse != null)
                    {
                        if (signMobileResponse.message.ErrorCode == "200")
                        {
                            await PopupNavigation.Instance.PushAsync(new SuccessPopUp("Your signature saved successfully"));

                            signatureView.IsEnabled = false;
                            signatureGrid.IsVisible = false;
                            TCcheckBox.IsEnabled    = false;
                        }
                        else
                        {
                            await PopupNavigation.Instance.PushAsync(new Error_popup(signMobileResponse.message.ErrorMessage));
                        }
                    }
                }
                else
                {
                    await PopupNavigation.Instance.PushAsync(new Error_popup("Invalid signature.Please try again"));
                }
            }
        }
コード例 #3
0
        private AddAgreementSignMobileResponse saveSignature(AddAgreementSignMobileRequest signMobileRequest, string token)
        {
            AgreementController            agreementController = new AgreementController();
            AddAgreementSignMobileResponse response            = null;

            try
            {
                response = agreementController.saveSignature(signMobileRequest, token);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(response);
        }
コード例 #4
0
        public AddAgreementSignMobileResponse saveSignature(AddAgreementSignMobileRequest signMobileRequest, string token)
        {
            AddAgreementSignMobileResponse response = null;

            try
            {
                response = agreementService.saveSignature(signMobileRequest, token);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(response);
        }
コード例 #5
0
 public ViewMyRental(int agreementId)
 {
     InitializeComponent();
     this.agreementId = agreementId;
     token            = App.Current.Properties["currentToken"].ToString();
     AgreementByAgreementIdMobileRequest             = new GetAgreementByAgreementIdMobileRequest();
     AgreementByAgreementIdMobileRequest.agreementId = agreementId;
     AgreementByAgreementIdMobileResponse            = null;
     signMobileResponse                      = null;
     signMobileRequest                       = new AddAgreementSignMobileRequest();
     imageURLMobileRequest                   = new ReloadSignatureImageURLMobileRequest();
     imageURLMobileRequest.agreementId       = agreementId;
     imageURLMobileRequest.IsCheckIn         = false;
     imageURLMobileRequest.isDamageView      = false;
     imageURLMobileResponse                  = null;
     imageURLMobileRequest.SignatureImageUrl = "";
 }
コード例 #6
0
 public AgreementScreen(int agreementId, int vehicleId)
 {
     InitializeComponent();
     On <Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true);
     this.agreementId = agreementId;
     token            = App.Current.Properties["currentToken"].ToString();
     AgreementByAgreementIdMobileRequest             = new GetAgreementByAgreementIdMobileRequest();
     AgreementByAgreementIdMobileRequest.agreementId = agreementId;
     AgreementByAgreementIdMobileResponse            = null;
     signMobileResponse                      = null;
     signMobileRequest                       = new AddAgreementSignMobileRequest();
     imageURLMobileRequest                   = new ReloadSignatureImageURLMobileRequest();
     imageURLMobileRequest.agreementId       = agreementId;
     imageURLMobileRequest.IsCheckIn         = false;
     imageURLMobileRequest.isDamageView      = false;
     imageURLMobileResponse                  = null;
     imageURLMobileRequest.SignatureImageUrl = "";
     this.vehicleId          = vehicleId;
     vehicleController       = new VehicleController();
     getVehicleDetailsMobile = null;
 }