当前位置: 首页>>代码示例>>C#>>正文


C# ShoppingCart.CreateCart方法代码示例

本文整理汇总了C#中ShoppingCart.CreateCart方法的典型用法代码示例。如果您正苦于以下问题:C# ShoppingCart.CreateCart方法的具体用法?C# ShoppingCart.CreateCart怎么用?C# ShoppingCart.CreateCart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ShoppingCart的用法示例。


在下文中一共展示了ShoppingCart.CreateCart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: lstProductHot_ItemCommand

 protected void lstProductHot_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     var item = e.Item as ListViewDataItem;
     var cmd = e.CommandName;
     var ProductOptionCategoryID = (item.FindControl("hdnProductOptionCategoryID2") as HiddenField).Value;
     var ProductOptionCategoryName = (item.FindControl("hdnProductOptionCategoryName2") as HiddenField).Value;
     var ProductID = (item.FindControl("hdnProductID2") as HiddenField).Value;
     var ProductName = (item.FindControl("lblProductName2") as Label).Text;
     var ProductNameEn = (item.FindControl("lblProductNameEn2") as Label).Text;
     var ImageName = (item.FindControl("hdnImageName2") as HiddenField).Value;
     var ProductCode = (item.FindControl("hdnProductCode2") as HiddenField).Value;
     var ProductLengthID = (item.FindControl("hdnProductLengthID2") as HiddenField).Value;
     var ProductLengthName = (item.FindControl("hdnProductLengthName2") as HiddenField).Value;
     var Quantity = "1";
     double Price = Convert.ToDouble((item.FindControl("hdnPrice2") as HiddenField).Value);
     string ProductSizeColorID1 = "";
     string QuantityList = "";
     int SizeColorQuantity1 = 0;
     var oProductSizeColor = new ProductSizeColor();
     if (cmd == "AddToCart")
     {
         if (ProductID != "" && ProductLengthID != "" && ProductLengthID != "")
         {
             var dv = oProductSizeColor.ProductSizeColorSelectAll(ProductLengthID, ProductOptionCategoryID, ProductID, "True",
                                                              "True", "", "True").DefaultView;
             ProductSizeColorID1 = dv[0]["ProductSizeColorID"].ToString();
             SizeColorQuantity1 = Convert.ToInt32(dv[0]["Quantity"].ToString()) - Convert.ToInt32(dv[0]["QuantitySale"].ToString());
             for (int i = 1; i <= SizeColorQuantity1; i++)
             {
                 QuantityList = QuantityList + i + ",";
             }
         }
         var oShoppingCart = new ShoppingCart();
         oShoppingCart.CreateCart(ProductID,
             ImageName,
             ProductName,
             ProductNameEn,
             ProductCode,
             ProductOptionCategoryID,
             ProductOptionCategoryName,
             ProductLengthID,
             ProductLengthName,
             ProductSizeColorID1,
             Quantity,
             SizeColorQuantity1.ToString(),
             Price,
             false
             );
         ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "runtime", "myconfirmPopup('" + "<strong>" + ProductName + " - " + ProductCode + " - " + ProductOptionCategoryName + "</strong><br/> đã được thêm vào giỏ hàng" + "')", true);
     }
     else if (cmd == "AddToWishList")
     {
         if (Session["UserName"] != null)
         {
             var oWishList = new WishList();
             oWishList.WishListInsert1(
                 ProductID,
                 User.Identity.Name,
                 "1",
                 Price.ToString(),
                 ImageName,
                 ProductName,
                 "",
                 ProductCode,
                 ProductOptionCategoryID,
                 ProductOptionCategoryName,
                 ProductLengthID,
                 ProductLengthName,
                 ProductSizeColorID1,
                 ""
                 );
         }
         else
             Response.Redirect("~/Login.aspx?returnurl=" + Request.Url.AbsolutePath.Substring(Request.Url.AbsolutePath.LastIndexOf("/") + 1));
     }
 }
开发者ID:hungtien408,项目名称:web-quanaotreem,代码行数:76,代码来源:Default.aspx.cs


注:本文中的ShoppingCart.CreateCart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。