コード例 #1
0
        private void FinishReplace()
        {
            int num = 0;

            if (HttpContext.Current.Request.QueryString["replaceId"] != null)
            {
                int.TryParse(HttpContext.Current.Request.QueryString["replaceId"], out num);
            }
            ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(num);

            if (replaceInfo == null)
            {
                this.ShowMessage("错误的换货信息", false, "", 1);
            }
            else
            {
                OrderInfo orderInfo = TradeHelper.GetOrderInfo(replaceInfo.OrderId);
                if (orderInfo == null)
                {
                    this.ShowMessage("错误的订单信息", false, "", 1);
                }
                else if (orderInfo.LineItems.ContainsKey(replaceInfo.SkuId))
                {
                    if (orderInfo.LineItems[replaceInfo.SkuId].Status != LineItemStatus.MerchantsDeliveryForRepalce)
                    {
                        this.ShowMessage("商品换货状态不正确", false, "", 1);
                    }
                    else if (TradeHelper.FinishReplace(replaceInfo.ReplaceId, replaceInfo.AdminRemark, replaceInfo.OrderId, replaceInfo.SkuId))
                    {
                        this.ShowMessage("确认收货完成换货成功", true, this.returnUrl, 2);
                    }
                    else
                    {
                        this.ShowMessage("确认收货完成换货失败", false, "", 1);
                    }
                }
                else
                {
                    this.ShowMessage("订单中不包含商品信息", false, "", 1);
                }
            }
        }