本文整理汇总了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));
}
}