예제 #1
0
        public override void AddLineItem(string skuId, int quantity)
        {
            XmlDocument shoppingCartData = this.GetShoppingCartData();
            XmlNode     xmlNode          = shoppingCartData.SelectSingleNode("//sc/lis");
            XmlNode     xmlNode2         = xmlNode.SelectSingleNode("l[@s='" + skuId + "']");

            if (xmlNode2 == null)
            {
                xmlNode2 = CookieShoppingData.CreateLineItemNode(shoppingCartData, skuId, quantity);
                xmlNode.InsertBefore(xmlNode2, xmlNode.FirstChild);
            }
            else
            {
                xmlNode2.Attributes["q"].Value = (int.Parse(xmlNode2.Attributes["q"].Value) + quantity).ToString(CultureInfo.InvariantCulture);
            }
            this.SaveShoppingCartData(shoppingCartData);
        }