public OtherInformationPage(CustomerReview customer, CustomerImages images)
        {
            InitializeComponent();
            this.customer = customer;
            licenceIssueDate.MaximumDate  = DateTime.Now;
            licenceExpiryDate.MinimumDate = DateTime.Now;
            _token = App.Current.Properties["currentToken"].ToString();
            GetAllStateForMobileRequest stateRequest = new GetAllStateForMobileRequest();
            List <string> stateList = new List <string>();

            stateRequest.CountryID = (int)customer.CountryId;
            stateResponse          = getStates(stateRequest, _token);
            if (stateResponse.stateList.Count > 0)
            {
                foreach (State s in stateResponse.stateList)
                {
                    stateList.Add(s.StateCode);
                }
                ;
            }
            licenceStatePicker.ItemsSource = stateList;
            imageMobileRequest             = new UploadCustomerImageMobileRequest();
            imageMobileResponse            = null;
            this.images                = images;
            licExpireDateSelected      = false;
            licIssueDateSelected       = false;
            licfrontIamgeStat          = new CustomerImages();
            licBackIamgeStat           = new CustomerImages();
            LicenceImagesRequest       = new AddLicenceImagesRequest();
            licenceImageResponse       = null;
            customer.CustomerType      = "Retail";
            confirmEmailAddressRequest = new ConfirmEmailAddressRequest();
            emailAddressResponse       = null;
            this.fromVal               = 0;
        }
Ejemplo n.º 2
0
        public ConfirmEmailAddressResponse ConfirmEmailAddress(ConfirmEmailAddressRequest confirmEmailAddressRequest, string token)
        {
            ConfirmEmailAddressResponse res = new ConfirmEmailAddressResponse();

            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "RegistrationMobile/confirmEmailAddress");
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

                    var myContent   = JsonConvert.SerializeObject(confirmEmailAddressRequest);
                    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;
                        res = JsonConvert.DeserializeObject <ConfirmEmailAddressResponse>(responseStream);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(res);
        }
Ejemplo n.º 3
0
        private ConfirmEmailAddressResponse ConfirmEmailAddress(ConfirmEmailAddressRequest confirmEmailAddressRequest)
        {
            ConfirmEmailAddressResponse response   = null;
            LoginController             controller = new LoginController();

            response = controller.ConfirmEmailAddress(confirmEmailAddressRequest, token);
            return(response);
        }
Ejemplo n.º 4
0
 public ConfirmEmailRequest(int customerId, emailConfirmationType register)
 {
     InitializeComponent();
     confirmEmailAddressRequest = new ConfirmEmailAddressRequest();
     emailAddressResponse       = null;
     yourEmaillabel.Text        = Constants.cutomerAuthContext.CustomerEmail;
     token                 = App.Current.Properties["currentToken"].ToString();
     this.customerId       = customerId;
     this.confirmationType = register;
     this.fromVal          = 0;
 }
Ejemplo n.º 5
0
        public ConfirmEmailAddressResponse ConfirmEmailAddress(ConfirmEmailAddressRequest confirmEmailAddressRequest, string token)
        {
            ConfirmEmailAddressResponse response = new ConfirmEmailAddressResponse();

            try
            {
                response = loginservice.ConfirmEmailAddress(confirmEmailAddressRequest, token);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
Ejemplo n.º 6
0
        private async void sentOTPBtn_Clicked(object sender, EventArgs e)
        {
            //code with mail request API call
            confirmEmailAddressRequest.ClientId   = Constants.ClientId;
            confirmEmailAddressRequest.CustomerId = Constants.cutomerAuthContext.CustomerId;
            confirmEmailAddressRequest.Email      = Constants.cutomerAuthContext.CustomerEmail;
            confirmEmailAddressRequest.CustomerId = Constants.cutomerAuthContext.CustomerId;

            bool busy = false;

            if (!busy)
            {
                try
                {
                    busy = true;
                    await PopupNavigation.Instance.PushAsync(new LoadingPopup("Loading details..."));

                    await Task.Run(async() =>
                    {
                        try
                        {
                            emailAddressResponse = ConfirmEmailAddress(confirmEmailAddressRequest);
                        }
                        catch (Exception ex)
                        {
                            await PopupNavigation.Instance.PushAsync(new Error_popup(ex.Message));
                        }
                    });
                }
                finally
                {
                    busy = false;
                    if (PopupNavigation.Instance.PopupStack.Count == 1)
                    {
                        await PopupNavigation.Instance.PopAllAsync();
                    }
                    if (PopupNavigation.Instance.PopupStack.Count > 1)
                    {
                        if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() != typeof(ErrorWithClosePagePopup))
                        {
                            await PopupNavigation.Instance.PopAllAsync();
                        }
                    }

                    if (emailAddressResponse != null)
                    {
                        if (emailAddressResponse.message != null)
                        {
                            if (emailAddressResponse.message.ErrorCode == "200")
                            {
                                if (fromVal == 1)
                                {
                                    await Navigation.PushModalAsync(new enterConfirmationCodePage(customerId, confirmationType, fromVal));
                                }
                                else
                                {
                                    await Navigation.PushModalAsync(new enterConfirmationCodePage(customerId, confirmationType));
                                }
                            }
                            else
                            {
                                await PopupNavigation.Instance.PushAsync(new Error_popup(emailAddressResponse.message.ErrorMessage));
                            }
                        }
                        else
                        {
                            await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Something went wrong, Please try again."));
                        }
                    }
                    else
                    {
                        await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Something went wrong, Please try again."));
                    }
                }
            }
        }
        private async void DoneBtn_Clicked(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(licenceNumber.Text))
            {
                await PopupNavigation.Instance.PushAsync(new Error_popup("Please enter your drivers license number."));
            }
            else if (!licExpireDateSelected)
            {
                await PopupNavigation.Instance.PushAsync(new Error_popup("Please enter your drivers license expiration date."));
            }
            else if (licenceExpiryDate.Date <= DateTime.Now)
            {
                await PopupNavigation.Instance.PushAsync(new Error_popup("Your license has expired"));
            }
            else if (!licIssueDateSelected)
            {
                await PopupNavigation.Instance.PushAsync(new Error_popup("Please enter your drivers license issue date."));
            }
            else if (licenceIssueDate.Date >= DateTime.Now)
            {
                await PopupNavigation.Instance.PushAsync(new Error_popup("Please check your licence issue date."));
            }

            else if (licfrontIamgeStat.Base64 == null || licBackIamgeStat.Base64 == null)
            {
                await PopupNavigation.Instance.PushAsync(new Error_popup("Please add images of your driver licence. "));
            }
            else
            {
                bool busy = false;
                if (!busy)
                {
                    try
                    {
                        busy = true;
                        await PopupNavigation.Instance.PushAsync(new LoadingPopup("Saving your Information"));

                        await Task.Run(() =>
                        {
                            customer.LicenseNumber     = licenceNumber.Text;
                            customer.LicenseExpiryDate = licenceExpiryDate.Date;

                            if (!licIssueDateSelected)
                            {
                                customer.LicenseIssueDate = null;
                            }
                            else if (licIssueDateSelected)
                            {
                                customer.LicenseIssueDate = licenceIssueDate.Date;
                            }

                            if (licenceStatePicker.SelectedIndex != -1)
                            {
                                customer.LicenseIssueState = licenceStatePicker.SelectedItem.ToString();
                            }
                            if (images != null)
                            {
                                imageMobileRequest.custImag = images;
                            }

                            RegisterController registerController = new RegisterController();
                            customerID = registerController.registerUser(customer, _token);
                            if (images != null && customerID > 0)
                            {
                                imageMobileRequest.custImag.CustomerID  = customerID;
                                imageMobileRequest.custImag.ImageID     = customerID;
                                imageMobileRequest.custImag.Title       = "My Image";
                                imageMobileRequest.custImag.FileName    = "My Image";
                                imageMobileRequest.custImag.Description = "My ImageMy ImageMy Image";
                                imageMobileResponse = registerController.addCustomerImage(imageMobileRequest, _token);
                            }
                            if (customerID > 0)
                            {
                                confirmEmailAddressRequest.ClientId   = Constants.ClientId;
                                confirmEmailAddressRequest.CustomerId = customerID;
                                confirmEmailAddressRequest.Email      = customer.Email;


                                if (licfrontIamgeStat.Base64 != null || licBackIamgeStat.Base64 != null)
                                {
                                    if (licfrontIamgeStat.Base64 != null)
                                    {
                                        LicenceImage licenceImage          = new LicenceImage();
                                        licenceImage.base64DocumentContent = licfrontIamgeStat.Base64;
                                        licenceImage.refType            = (short)ReferenceType.Customer;
                                        licenceImage.refId              = customerID;
                                        LicenceImagesRequest.FrontImage = licenceImage;
                                    }
                                    if (licBackIamgeStat.Base64 != null)
                                    {
                                        LicenceImage licenceImage          = new LicenceImage();
                                        licenceImage.base64DocumentContent = licBackIamgeStat.Base64;
                                        licenceImage.refType           = (short)ReferenceType.Customer;
                                        licenceImage.refId             = customerID;
                                        LicenceImagesRequest.BackImage = licenceImage;
                                    }
                                    try
                                    {
                                        licenceImageResponse = registerController.addLicenceImage(LicenceImagesRequest, _token);
                                        emailAddressResponse = ConfirmEmailAddress(confirmEmailAddressRequest);
                                    }
                                    catch (Exception ex)
                                    {
                                        PopupNavigation.Instance.PushAsync(new Error_popup(ex.Message));
                                    }
                                }
                            }
                        });
                    }
                    finally
                    {
                        busy = false;
                        await PopupNavigation.Instance.PopAllAsync();
                    }
                }
                if (customerID > 0)
                {
                    Constants.IsRegisteredandNotLogin = true;
                    Constants.cutomerAuthContext      = new CutomerAuthContext()
                    {
                        CustomerEmail = customer.Email, CustomerId = customerID
                    };

                    if (fromVal == 1)
                    {
                        await PopupNavigation.Instance.PushAsync(new SavedSuccessfullyPopup(customerID, fromVal));
                    }
                    else
                    {
                        await PopupNavigation.Instance.PushAsync(new SavedSuccessfullyPopup(customerID));
                    }
                }
                else
                {
                    await PopupNavigation.Instance.PushAsync(new Error_popup("Registration failed. Please try again"));
                }
            }
        }