Ejemplo n.º 1
0
        async void PopulateFields(string username)
        {
            try
            {
                if (string.IsNullOrEmpty(username))
                {
                    return;                                 //return if null
                }
                Dictionary <string, object> userdata = await _userProfileData.FetchUserProfileData(userName : username);

                if (userdata != null)
                {
                    if (userdata.ContainsKey("facebook"))
                    {
                        _facebook.Text = userdata["facebook"].ToString();
                    }


                    if (userdata.ContainsKey("instagram"))
                    {
                        _instagram.Text = userdata["instagram"].ToString();
                    }


                    if (userdata.ContainsKey("twitter"))
                    {
                        _twitter.Text = userdata["twitter"].ToString();
                    }

                    if (userdata.ContainsKey("linkedin"))
                    {
                        _linkedin.Text = userdata["linkedin"].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                var message = string.Format("Error occured setting profile info please check asap {0} {1}", ex.Message,
                                            ex.StackTrace);
                Console.WriteLine(message);
                MetricsManager.TrackEvent(message);
            }
        }
Ejemplo n.º 2
0
        async void PopulateFields(string username)
        {
            try
            {
                string accountType = "Private Party";

                if (string.IsNullOrEmpty(username))
                {
                    return;                                 //return if null
                }
                Dictionary <string, object> ownerData = await _userProfileData.FetchUserProfileData(userName : username);

                if (ownerData != null)
                {
                    _usernameTextView.Text = username;
                    //get the profile picture
                    var profilePicUrl = await _dataManager.FetchUserProfileImage(username);

                    if (profilePicUrl != null)
                    {
                        //use cache image
                        _imageLoader.DisplayImage(profilePicUrl.AbsoluteUri, _profilePhotoView);
                    }

                    if (ownerData.ContainsKey("usertype"))
                    {
                        accountType = ownerData["usertype"].ToString();
                    }

                    //if dealer get dealer profile
                    if (string.Equals(accountType, "Dealer"))
                    {
                        _companyNameTextView.Visibility = ViewStates.Visible;
                        _addressTextView.Visibility     = ViewStates.Visible;

                        var dealerData = await _userProfileData.FetchDealerProfile(userName : username);

                        if (dealerData.ContainsKey("address"))
                        {
                            _addressTextView.Text = dealerData["address"].ToString();
                        }
                        if (dealerData.ContainsKey("company"))
                        {
                            _companyNameTextView.Text = dealerData["company"].ToString();
                        }
                    }
                    else //private party specific views and data
                    {
                        //Hide the fields for the dealer data
                        _companyNameTextView.Visibility = ViewStates.Gone;
                        _addressTextView.Visibility     = ViewStates.Gone;
                    }

                    if (ownerData.ContainsKey("city"))
                    {
                        _cityTextView.Text = ownerData["city"].ToString();
                    }


                    if (ownerData.ContainsKey("lastname"))
                    {
                        _lastNameTextView.Text = ownerData["lastname"].ToString();
                    }


                    if (ownerData.ContainsKey("firstname"))
                    {
                        _firstNameTextView.Text = ownerData["firstname"].ToString();
                    }

                    if (ownerData.ContainsKey("country"))
                    {
                        var country = ownerData["country"].ToString();
                        _countryEditText.Text = country;
                        _countryTextView.Text = country;
                    }

                    if (ownerData.ContainsKey("email"))
                    {
                        _emailTextView.Text = ownerData["email"].ToString();
                    }

                    if (ownerData.ContainsKey("phone"))
                    {
                        _phoneTextView.Text = ownerData["phone"].ToString();
                    }


                    if (ownerData.ContainsKey("state"))
                    {
                    }

                    /*
                     *
                     * if (user.ContainsKey("facebookUsername"))
                     * {
                     *
                     * }
                     *
                     *
                     * if (user.ContainsKey("instagramUsername"))
                     * {
                     *
                     * }
                     *
                     *
                     * if (user.ContainsKey("twitterUsername"))
                     * {
                     *
                     * }
                     *
                     * if (user.ContainsKey("linkedinUsername"))
                     * {
                     *
                     * }
                     *
                     * if (user.ContainsKey("ipAddress"))
                     * {
                     *
                     * }
                     *
                     * if (user.ContainsKey("macAddress"))
                     * {
                     *
                     * }
                     */

                    if (ownerData.ContainsKey("zipCode"))
                    {
                    }

                    if (ownerData.ContainsKey("appAccessStartDate"))
                    {
                    }

                    if (ownerData.ContainsKey("appAccessEndDate"))
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(string.Format("Error happened please check asap {0} {1}", ex.Message, ex.StackTrace));
            }
        }