Ejemplo n.º 1
0
        /// <summary>
        /// 获取商品详情
        /// </summary>
        /// <param name="productId"></param>
        /// <returns></returns>
        public async Task <ProductDetailRD> GetProductDetail(string productId)
        {
            string          url             = "/goods/productDet?productId=" + productId;
            ProductDetailRD productDetailRD = await RestSharpHelper <ProductDetailRD> .GetAsync(url);

            return(productDetailRD);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取商品详细信息,初始化页面
        /// </summary>
        /// <param name="productId"></param>
        private async void InitProductDetailPageAsync(string productId)
        {
            try
            {
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                ProductDetailRD productDetailRD = await _restSharpService.GetProductDetail(productId);

                if (GlobalVariables.IsLogged)
                {
                    string judgeRD = await _restSharpService.JudgeCollection(productId);

                    var json = JObject.Parse(judgeRD);
                    isCollected = (bool)json["success"];
                }
                else
                {
                    isCollected = false;
                }

                if (productDetailRD.result != null)
                {
                    Product    = productDetailRD.result;
                    StarSource = isCollected ? "star_yellow.png" : "star_gray.png";
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取商品详情
        /// </summary>
        /// <param name="productId"></param>
        /// <returns></returns>
        public async Task <ProductDetailRD> GetProductDetail(string productId)
        {
            string url          = rootUrl3 + "/goods/productDet?productId=" + productId;
            string responseBody = await GetStringDataAsync(url);

            ProductDetailRD productDetailRD = JsonConvert.DeserializeObject <ProductDetailRD>(responseBody);

            return(productDetailRD);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取商品详情
        /// </summary>
        /// <param name="productId"></param>
        /// <returns></returns>
        public static async Task <ProductDetailRD> GetProductDetail(string productId)
        {
            try
            {
                string url = "/goods/productDet?productId=" + productId;
                if (GlobalVariables.IsLogged)
                {
                    url += "&userId=" + GlobalVariables.LoggedUser.id;
                }
                ProductDetailRD productDetailRD = await RestSharpHelper <ProductDetailRD> .GetAsync(url);

                return(productDetailRD);
            }
            catch (ApplicationException ex)
            {
                throw ex;
            }
        }