Ejemplo n.º 1
0
        public HomePageMaster()
        {
            InitializeComponent();
            //Common.mMasterPage.Master = this;
            customoerController = new CustomerController();
            token      = Application.Current.Properties["currentToken"].ToString();
            customerId = (int)Application.Current.Properties["CustomerId"];
            portalDetailsMobileRequest            = new GetCustomerPortalDetailsMobileRequest();
            portalDetailsMobileRequest.customerId = customerId;
            PortalDetailsMobileResponse           = null;

            BindingContext = new HomePageMasterViewModel();
            if (Constants.cutomerAuthContext != null)
            {
                welcomeText.Text = "Welcome " + Constants.cutomerAuthContext.FirstName;
            }
            ListView = MenuItemsListView;


            var homeTab = new TapGestureRecognizer();

            homeTab.Tapped += (s, e) =>
            {
                Navigation.PushAsync(new HomePageDetail());
            };
            //HomeBtn.GestureRecognizers.Add(homeTab);
        }
        public GetCustomerPortalDetailsMobileResponse getCustomerDetailsWithProfilePic(GetCustomerPortalDetailsMobileRequest portalDetailsMobileRequest, string token)
        {
            GetCustomerPortalDetailsMobileResponse result = null;

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

                    var myContent   = JsonConvert.SerializeObject(portalDetailsMobileRequest);
                    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 <GetCustomerPortalDetailsMobileResponse>(responseStream);
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Ejemplo n.º 3
0
        public LoginPage(int fromVal)
        {
            InitializeComponent();
            //BindingContext = new SocialLoginPageViewModel();
            store = AccountStore.Create();
            var assembly = typeof(LoginPage);

            portalDetailsMobileRequest  = new GetCustomerPortalDetailsMobileRequest();
            PortalDetailsMobileResponse = null;
            // logoImage.Source = ImageSource.FromResource("MaxVonGrafKftMobile.Assets.logo_high_resolution_white-1.png", assembly);
            //emailIcon.Source = ImageSource.FromResource("MaxVonGrafKftMobile.Assets.emailIcon.png", assembly);
            // passwordIcon.Source = ImageSource.FromResource("MaxVonGrafKftMobile.Assets.passwordIcon.png", assembly);
            //LoginButton.ImageSource= ImageSource.FromResource("MaxVonGrafKftMobile.Assets.LoginIcon.png", assembly);

            if (PopupNavigation.Instance.PopupStack.Count > 0)
            {
                PopupNavigation.Instance.PopAllAsync();
            }


            var forgetPassword_tab = new TapGestureRecognizer();

            forgetPassword_tab.Tapped += (s, e) =>
            {
                Navigation.PushModalAsync(new ForgetPasswordPage());
            };
            forgetPasswordLabel.GestureRecognizers.Add(forgetPassword_tab);
            this.fromVal = fromVal;
        }
Ejemplo n.º 4
0
        private GetCustomerPortalDetailsMobileResponse getCustomerDetailsWithProfilePic(GetCustomerPortalDetailsMobileRequest portalDetailsMobileRequest, string token)
        {
            GetCustomerPortalDetailsMobileResponse response = new GetCustomerPortalDetailsMobileResponse();

            try
            {
                response = customoerController.getCustomerDetailsWithProfilePic(portalDetailsMobileRequest, token);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
Ejemplo n.º 5
0
        public UpdateProfile(CustomerReview customerReview)
        {
            InitializeComponent();
            DateOfBithEntry.MaximumDate = DateTime.Now.AddYears(-18);
            //licIssueDate.MaximumDate = DateTime.Now;
            licenceexpiDate.MinimumDate = DateTime.Now;
            this.customerReview         = customerReview;
            _token                                = App.Current.Properties["currentToken"].ToString();
            customerId                            = (int)Application.Current.Properties["CustomerId"];
            countryResponse                       = null;
            stateResponse                         = null;
            ProfileDetailsMobileRequest           = new UpdateCustomerProfileDetailsMobileRequest();
            profileDetailsMobileResponse          = null;
            portalDetailsMobileRequest            = new GetCustomerPortalDetailsMobileRequest();
            portalDetailsMobileRequest.customerId = customerId;
            PortalDetailsMobileResponse           = null;
            customoerController                   = new CustomerController();
            Images                                = null;
            //licenceIssueDate.MaximumDate = DateTime.Now;
            //licenceExpiryDate.MinimumDate = DateTime.Now;
            licExpireDateSelected = false;
            licIssueDateSelected  = false;
            licfrontIamgeStat     = new CustomerImages();
            licBackIamgeStat      = new CustomerImages();
            LicenceImagesRequest  = new AddLicenceImagesRequest();
            licenceImageResponse  = null;

            var editPhoto = new TapGestureRecognizer();

            editPhoto.Tapped += (s, e) =>
            {
                if (Images != null)
                {
                    if (Images.Base64 == null)
                    {
                        PopupNavigation.PushAsync(new editPrrofilePhotoPage());
                    }
                    else
                    {
                        PopupNavigation.PushAsync(new editPrrofilePhotoPage(Images));
                    }
                }
                else
                {
                    PopupNavigation.PushAsync(new editPrrofilePhotoPage());
                }
            };
            profileImage.GestureRecognizers.Add(editPhoto);
        }
Ejemplo n.º 6
0
 public MyProfile()
 {
     InitializeComponent();
     customoerController = new CustomerController();
     token      = Application.Current.Properties["currentToken"].ToString();
     customerId = (int)Application.Current.Properties["CustomerId"];
     getMobileCustomerByIDRequest            = new GetMobileCustomerByIDRequest();
     getMobileCustomerByIDRequest.CustomerId = customerId;
     getMobileCustomerResponse                              = null;
     portalDetailsMobileRequest                             = new GetCustomerPortalDetailsMobileRequest();
     portalDetailsMobileRequest.customerId                  = customerId;
     PortalDetailsMobileResponse                            = null;
     GetCustomerAgreementReservationCountRequest            = new GetCustomerAgreementReservationCountRequest();
     GetCustomerAgreementReservationCountRequest.customerID = customerId;
     GetCustomerAgreementReservationCountRequest.clientId   = Constants.ClientId;
 }
        private void updateConstantCustomerDetails(GetCustomerPortalDetailsMobileRequest portalDetailsMobileRequest)
        {
            GetCustomerPortalDetailsMobileResponse response = new GetCustomerPortalDetailsMobileResponse();
            CustomerController customoerController          = new CustomerController();

            try
            {
                response = customoerController.getCustomerDetailsWithProfilePic(portalDetailsMobileRequest, token);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            if (response.customerReview != null)
            {
                Constants.customerDetails = response.customerReview;
            }
        }
Ejemplo n.º 8
0
        private void getCustomerRevieAndUpdateImage()
        {
            PortalDetailsMobileResponse = getCustomerDetailsWithProfilePic(portalDetailsMobileRequest, token);

            if (PortalDetailsMobileResponse != null)
            {
                if (PortalDetailsMobileResponse.customerReview != null)
                {
                    Constants.customerDetails = PortalDetailsMobileResponse.customerReview;
                    if (PortalDetailsMobileResponse.customerReview.CustomerImages.Count > 0)
                    {
                        if (PortalDetailsMobileResponse.customerReview.CustomerImages[PortalDetailsMobileResponse.customerReview.CustomerImages.Count - 1].Base64 != null)
                        {
                            byte[] Base64Stream = Convert.FromBase64String(PortalDetailsMobileResponse.customerReview.CustomerImages[PortalDetailsMobileResponse.customerReview.CustomerImages.Count - 1].Base64);
                            profileImage.Source = ImageSource.FromStream(() => new MemoryStream(Base64Stream));
                        }
                    }
                }
            }
        }
Ejemplo n.º 9
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            if (PopupNavigation.Instance.PopupStack.Count > 0)
            {
                if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() == typeof(ErrorWithClosePagePopup))
                {
                    await PopupNavigation.Instance.PopAllAsync();
                }
            }

            //MessagingCenter.Subscribe<AddCustomerPhotoPopup>(this, "LicenceFrontImageAdded", sender =>
            //{
            //    if (licfrontIamgeStat != null)
            //    {
            //        licFrontImage.Source = ImageSource.FromFile(licfrontIamgeStat.PhysicalPath);
            //    }

            //});

            //MessagingCenter.Subscribe<AddCustomerPhotoPopup>(this, "LicenceBackImageAdded", sender =>
            //{
            //    if (licBackIamgeStat != null)
            //    {
            //        licBackImage.Source = ImageSource.FromFile(licBackIamgeStat.PhysicalPath);
            //    }

            //});

            bool busy = false;

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

                    await Task.Run(() =>
                    {
                        try
                        {
                            countryResponse             = getAllCountry(_token);
                            PortalDetailsMobileResponse = getCustomerDetailsWithProfilePic(portalDetailsMobileRequest, _token);
                        }
                        catch (Exception ex)
                        {
                            PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                        }
                    });
                }
                finally
                {
                    busy = false;
                    if (PopupNavigation.Instance.PopupStack.Count == 1)
                    {
                        await PopupNavigation.Instance.PopAllAsync();
                    }
                    else if (PopupNavigation.Instance.PopupStack.Count > 1)
                    {
                        if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 2].GetType() == typeof(editPrrofilePhotoPage))
                        {
                            await PopupNavigation.Instance.PopAsync();
                        }
                        else if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 2].GetType() == typeof(AddCustomerPhotoPopup))
                        {
                            await PopupNavigation.Instance.PopAsync();
                        }

                        else if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() != typeof(ErrorWithClosePagePopup))
                        {
                            await PopupNavigation.Instance.PopAllAsync();
                        }
                    }
                }
                List <string> countryList = new List <string>();
                if (countryResponse.countryList.Count > 0)
                {
                    foreach (Country k in countryResponse.countryList)
                    {
                        countryList.Add(k.CountryName);
                    }
                    ;
                }
                //countryPicker.ItemsSource = countryList;
                FirstNameEntry.Text = customerReview.FirstName;

                oldEmail        = customerReview.Email;
                emailEntry.Text = customerReview.Email;

                LastNameEntry.Text   = customerReview.LastName;
                AddressEntry.Text    = customerReview.Address1 + " " + customerReview.Address2;
                CityEntry.Text       = customerReview.City;
                licenceNumber.Text   = customerReview.LicenseNumber;
                DateOfBithEntry.Date = (DateTime)customerReview.DateOfbirth;
                if (customerReview.LicenseIssueDate == null)
                {
                    licIssueDate.Placeholder = "Licence Issue Date";
                }
                else if (((DateTime)customerReview.LicenseIssueDate).Date == DateTime.Now.Date)
                {
                    licIssueDate.Placeholder = DateTime.Now.ToString("MM/dd/yyyy");
                    licIssueDate.Date        = (DateTime)customerReview.LicenseIssueDate;
                }
                else
                {
                    licIssueDate.Date = (DateTime)customerReview.LicenseIssueDate;
                }

                if (((DateTime)customerReview.LicenseExpiryDate).Date == DateTime.Now.Date)
                {
                    licenceexpiDate.Placeholder = DateTime.Now.ToString("dd/MM/yyyy");
                    licenceexpiDate.Date        = (DateTime)customerReview.LicenseExpiryDate;
                }
                else
                {
                    licenceexpiDate.Date = (DateTime)customerReview.LicenseExpiryDate;
                }


                //if (customerReview.LicenseIssueDate != null)
                //{
                //    licenceIssueDate.Date = (DateTime)customerReview.LicenseIssueDate;
                //}
                //licenceExpiryDate.Date = (DateTime)customerReview.LicenseExpiryDate;
                //countryPicker.SelectedItem = customerReview.CountryName;
                if (PortalDetailsMobileResponse.customerReview != null)
                {
                    if (PortalDetailsMobileResponse.customerReview.CustomerImages.Count > 0)
                    {
                        if (PortalDetailsMobileResponse.customerReview.CustomerImages[PortalDetailsMobileResponse.customerReview.CustomerImages.Count - 1].Base64 != null)
                        {
                            Images = PortalDetailsMobileResponse.customerReview.CustomerImages[PortalDetailsMobileResponse.customerReview.CustomerImages.Count - 1];
                            byte[] Base64Stream = Convert.FromBase64String(PortalDetailsMobileResponse.customerReview.CustomerImages[PortalDetailsMobileResponse.customerReview.CustomerImages.Count - 1].Base64);
                            profileImage.Source = ImageSource.FromStream(() => new MemoryStream(Base64Stream));
                        }
                    }
                }

                string        countryName         = customerReview.CountryName;
                List <string> stateList           = new List <string>();
                List <string> stateListForLicence = new List <string>();
                int?          counid = null;
                foreach (Country c in countryResponse.countryList)
                {
                    if (c.CountryName == countryName)
                    {
                        counid = c.CountryId;
                    }
                }
                ;

                if (counid != null)
                {
                    GetAllStateForMobileRequest stateRequest = new GetAllStateForMobileRequest();
                    stateRequest.CountryID = counid.Value;
                    stateResponse          = getStates(stateRequest, _token);
                    if (stateResponse.stateList.Count > 0)
                    {
                        foreach (State s in stateResponse.stateList)
                        {
                            stateList.Add(s.StateName); stateListForLicence.Add(s.StateCode);
                        }
                        ;
                    }
                    statePicker.ItemsSource    = stateList;
                    LicStatePicker.ItemsSource = stateListForLicence;
                }

                statePicker.SelectedItem = customerReview.StateName;
                if (stateListForLicence.Contains(customerReview.LicenseIssueState))
                {
                    LicStatePicker.SelectedItem = customerReview.LicenseIssueState;
                }
                PostalCodeEntry.Text = customerReview.ZipCode;
                ContactNoEntry.Text  = customerReview.hPhone;
            }
        }
Ejemplo n.º 10
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            if (PopupNavigation.Instance.PopupStack.Count > 0)
            {
                await PopupNavigation.Instance.PopAllAsync();
            }


            bool busy = false;

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

                    await Task.Run(async() =>
                    {
                        try
                        {
                            //customerReview = getCustomerById(customerId, token);
                            getMobileCustomerResponse   = getMobileCustomerById(getMobileCustomerByIDRequest, token);
                            PortalDetailsMobileResponse = getCustomerDetailsWithProfilePic(portalDetailsMobileRequest, token);
                            reservationCountResponse    = GetCustomerAgreementReservationCount(GetCustomerAgreementReservationCountRequest, token);
                        }
                        catch (Exception ex)
                        {
                            await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                        }
                    });
                }
                finally
                {
                    busy           = false;
                    customerReview = getMobileCustomerResponse.customerDetails;
                    if (PopupNavigation.Instance.PopupStack.Count == 1)
                    {
                        await PopupNavigation.Instance.PopAllAsync();
                    }
                    else if (PopupNavigation.Instance.PopupStack.Count > 1)
                    {
                        if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() != typeof(ErrorWithClosePagePopup))
                        {
                            await PopupNavigation.Instance.PopAllAsync();
                        }
                    }
                }
                if (getMobileCustomerResponse.message.ErrorCode == "200")
                {
                    if (customerReview != null)
                    {
                        firstNameLabel.Text = customerReview.FirstName;
                        LastNameLabel.Text  = customerReview.LastName;
                        dobLabel.Text       = string.Format("{0:MMMM d, yyyy}", customerReview.DateOfbirth);
                        addressLabel.Text   = customerReview.Address1 + customerReview.Address2 + ", " + customerReview.City + ", " + customerReview.ZipCode + ", " + customerReview.CountryName;
                        MobileNoLabel.Text  = String.Format("{0:(###) ###-####}", long.Parse(customerReview.hPhone));
                        EmailLabel.Text     = customerReview.Email;

                        if (PortalDetailsMobileResponse != null)
                        {
                            if (PortalDetailsMobileResponse.customerReview != null)
                            {
                                if (PortalDetailsMobileResponse.customerReview.CustomerImages.Count > 0)
                                {
                                    if (PortalDetailsMobileResponse.customerReview.CustomerImages[PortalDetailsMobileResponse.customerReview.CustomerImages.Count - 1].Base64 != null)
                                    {
                                        byte[] Base64Stream = Convert.FromBase64String(PortalDetailsMobileResponse.customerReview.CustomerImages[PortalDetailsMobileResponse.customerReview.CustomerImages.Count - 1].Base64);
                                        profileImage.Source = ImageSource.FromStream(() => new MemoryStream(Base64Stream));
                                    }
                                }
                            }
                        }
                    }
                    if (reservationCountResponse != null)
                    {
                        //totalReservationNoLabel.Text = reservationCountResponse.custTotcount.totalReservationCount.ToString();
                        totalagreementNoLabel.Text = reservationCountResponse.custTotcount.totalAgreementCount.ToString();
                    }
                    else
                    {
                        await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(reservationCountResponse.message.ErrorMessage + " Error in getting Toatal reservation and agreement count"));
                    }
                }

                else
                {
                    await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(getMobileCustomerResponse.message.ErrorMessage));
                }
            }
        }