Exemplo n.º 1
0
        /// <summary>
        /// 获取地址列表
        /// </summary>
        public async void InitAddressList()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                RestSharpService _restSharpService = new RestSharpService();

                string memberId = GlobalVariables.LoggedUser.id.ToString();

                AddressRD addressRD = await _restSharpService.GetAddressListById(memberId);

                if (addressRD.result.Count != 0)
                {
                    AddressList = new ObservableCollection <AddressInfo>(addressRD.result);
                    Visible     = false;
                }
                else
                {
                    Visible = true;
                    CrossToastPopUp.Current.ShowToastError("无收货地址列表,请添加。", ToastLength.Long);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        private async void InitAddress()
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                //RestSharpService _restSharpService = new RestSharpService();

                string memberId = GlobalVariables.LoggedUser.id.ToString();

                AddressRD addressRD = await RestSharpService.GetAddressListById(memberId);

                if (addressRD.result.Count != 0)
                {
                    foreach (var item in addressRD.result)
                    {
                        if (item.isDefault)
                        {
                            AddressId  = item.addressId;
                            UserName   = item.userName;
                            Tel        = item.tel;
                            IsDefault  = item.isDefault;
                            StreetName = item.streetName;
                            break;
                        }
                    }

                    if (AddressId == 0)
                    {
                        UserName = "******";
                    }
                }
                else
                {
                    CrossToastPopUp.Current.ShowToastError("无收货地址列表,请添加。", ToastLength.Long);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }