Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string url = "//mvip.tdw.cn" + Request.RawUrl;

            Context.Response.Redirect(url);
            return;

            Guid pId = WEBRequest.GetGuid("Id");

            if (pId == Guid.Empty)
            {
                Response.Redirect("productList.aspx");
            }

            //根据prodectid获取商品详情
            this.VipProduct   = MVipProductBLL.GetVipProductDetail(pId);
            CurrSkuPriceValue = VipProduct.ProductValues.Where(en => VipProduct.SkuId == en.SkuId).FirstOrDefault().PriceValue;
            if (this.VipProduct.ProductValues != null && this.VipProduct.ProductValues.Any())
            {
                var attrs  = this.VipProduct.ProductValues.GroupBy(g => new { AttributeId = g.AttributeId, AttributeName = g.AttributeName });
                var DefSKU = this.VipProduct.ProductValues.Where(a => a.SkuId == this.VipProduct.SkuId).GroupBy(b => b.ValueId).Select(c => c.Key).ToList();
                foreach (var attr in attrs)
                {
                    if (attr.Key.AttributeId != null && attr.Key.AttributeId != Guid.Empty)
                    {
                        //添加属性值
                        var key    = new KeyValuePair <Guid, string>(attr.Key.AttributeId, attr.Key.AttributeName);
                        var values = this.VipProduct.ProductValues.Where(a => a.AttributeId == attr.Key.AttributeId).GroupBy(b => new
                        {
                            ValueId  = b.ValueId,
                            ValueStr = b.ValueStr
                        }).Select(en => new AttrValues
                        {
                            ValueId   = en.Key.ValueId,
                            ValueStr  = en.Key.ValueStr,
                            IsDefault = false//DefSKU.Contains(en.Key.ValueId)
                        }).ToList();
                        if (values.Count > 0)
                        {
                            Attrs.Add(key, values);
                        }
                    }
                    AttributesJson = JsonConvert.SerializeObject(this.VipProduct.ProductValues);
                }
            }

            if (VipProduct.SubType == 22 && VipProduct.Type == 1)
            {
                GetIsExchangeHF(pId.ToString());
            }
            else if (VipProduct.SubType == 25 && VipProduct.Type == 1)
            {
                GetIsExchangeFlow();
            }

            //获取特价商品详情
            GetScareBuyingProduct(pId.ToString());

            GetLimitNum();
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string url = "//mvip.tdw.cn" + Request.RawUrl;

            Context.Response.Redirect(url);
            return;

            string productid = Tool.WEBRequest.GetString("productid");;

            if (!string.IsNullOrEmpty(productid))
            {
                ProductId = Guid.Parse(productid);
            }
            else
            {
                Response.Redirect("myProduct.aspx");
            }

            Num     = Tool.WEBRequest.GetInt("num", 1);
            OrderId = Tool.WEBRequest.GetGuid("orderid");
            var userId = WebUserAuth.UserId.Value;

            this.VipProduct = MVipProductBLL.GetVipProductDetail(ProductId);
            this.ValueStr   = string.Join(",", VipProduct.ProductValues.Select(en => en.ValueStr).ToArray());
            this.PriceValue = VipProduct.ProductValues.FirstOrDefault().PriceValue;
            //如果有选择非默认地址
            string addrId = Tool.WEBRequest.GetQueryString("addrid");

            if (!string.IsNullOrEmpty(addrId))
            {
                var addr = bll.GetMUserShippingAddressesById(Guid.Parse(addrId));
                if (addr != null)
                {
                    this.DefAddressId = addr.Id.ToString();
                    this.DefAddress   = bll.GetPrivinceById(Convert.ToString(addr.Privince)) +
                                        bll.GetCityById(Convert.ToString(addr.City)) +
                                        bll.GetAreaById(Convert.ToString(addr.Area)) + addr.Address;
                    this.DefTelNo = addr.CellPhone;
                    DefName       = addr.ShipTo;
                }
            }
            else
            {
                //获取用户默认地址或者没有默认地址时使用其中一条有的地址
                ShippingAddress = bll.GetMUserShippingAddressesByUserId(userId);
                if (this.ShippingAddress != null && this.ShippingAddress.Count > 0)
                {
                    var addr = this.ShippingAddress.OrderByDescending(o => o.IsDefault).FirstOrDefault();
                    this.DefAddressId = addr.Id.ToString();
                    this.DefAddress   = bll.GetPrivinceById(Convert.ToString(addr.Privince)) +
                                        bll.GetCityById(Convert.ToString(addr.City)) +
                                        bll.GetAreaById(Convert.ToString(addr.Area)) + addr.Address;
                    this.DefTelNo = addr.CellPhone;
                    DefName       = addr.ShipTo;
                }
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string url = "//mvip.tdw.cn" + Request.RawUrl;

            Context.Response.Redirect(url);
            return;

            productId = Request.QueryString["productid"];
            string skuId = Request.QueryString["skuid"];

            if (!string.IsNullOrEmpty(skuId))
            {
                SkuId = Guid.Parse(skuId);
            }
            else
            {
                Response.Redirect("productDetail.aspx?id=" + productId);
            }

            Num = int.Parse(Request.QueryString["num"]);

            var userId = WebUserAuth.UserId.Value;

            if (userId == Guid.Empty)
            {
                Response.Redirect("/Index.aspx");
            }

            this.VipProduct = MVipProductBLL.GetVipProductBySkuId(SkuId);
            this.ValueStr   = string.Join(",", VipProduct.ProductValues.Select(en => en.ValueStr).ToArray());
            //如果是特价商品,则显示特价
            MVipScareBuying buyingModel = new MVipScareBuyingBLL().GetBuyingModel(VipProduct.Id);

            if (buyingModel != null && !buyingModel.IsDone && buyingModel.BuyingEndDate > DateTime.Now && buyingModel.BuyingStartDate < DateTime.Now)
            {
                this.PriceValue = buyingModel.BuyingPrice;
            }
            else
            {
                this.PriceValue = VipProduct.ProductValues.FirstOrDefault().PriceValue;
            }

            //如果有选择非默认地址
            string addrId = Tool.WEBRequest.GetQueryString("addrid");

            if (!string.IsNullOrEmpty(addrId))
            {
                var addr = bll.GetMUserShippingAddressesById(Guid.Parse(addrId));
                if (addr != null)
                {
                    this.DefAddressId = addr.Id.ToString();
                    this.DefAddress   = bll.GetPrivinceById(Convert.ToString(addr.Privince)) +
                                        bll.GetCityById(Convert.ToString(addr.City)) +
                                        bll.GetAreaById(Convert.ToString(addr.Area)) + addr.Address;
                    this.DefTelNo = addr.CellPhone;
                    DefName       = addr.ShipTo;
                }
            }
            else
            {
                //获取用户默认地址或者没有默认地址时使用其中一条有的地址
                ShippingAddress = bll.GetMUserShippingAddressesByUserId(userId);
                if (this.ShippingAddress != null && ShippingAddress.Count > 0)
                {
                    var addr = this.ShippingAddress.OrderByDescending(o => o.IsDefault).FirstOrDefault();
                    this.DefAddressId = addr.Id.ToString();
                    this.DefAddress   = bll.GetPrivinceById(Convert.ToString(addr.Privince)) +
                                        bll.GetCityById(Convert.ToString(addr.City)) +
                                        bll.GetAreaById(Convert.ToString(addr.Area)) + addr.Address;
                    this.DefTelNo = addr.CellPhone;
                    DefName       = addr.ShipTo;
                }
            }

            GetLimitNum(VipProduct.Id);
        }