本文整理汇总了C#中ShoppingCart.Cart方法的典型用法代码示例。如果您正苦于以下问题:C# ShoppingCart.Cart方法的具体用法?C# ShoppingCart.Cart怎么用?C# ShoppingCart.Cart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShoppingCart
的用法示例。
在下文中一共展示了ShoppingCart.Cart方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_PreRender
protected void Page_PreRender(object sender, EventArgs e)
{
if (Session["Cart"] != null)
{
var oShoppingCart = new ShoppingCart();
var dt = oShoppingCart.Cart();
if (dt.Rows.Count == 0)
{
lblCountProduct.Text = "0";
}
else
{
int quantity = 0;
foreach (DataRow dr in dt.Rows)
{
var Quantity = Convert.ToInt32(string.IsNullOrEmpty(dr["Quantity"].ToString()) ? "0" : dr["Quantity"]);
//var Price = Convert.ToDouble(string.IsNullOrEmpty(dr["Price"].ToString()) ? 0 : dr["Price"]);
//Total += Quantity * Price;
quantity += Quantity;
}
lblCountProduct.Text = quantity.ToString();
//lblTotalPrice.Text = string.Format("{0:##,###.##}", Total).Replace('.', '*').Replace(',', '.').Replace('*', ',');
}
}
}
示例2: Page_PreRender
protected void Page_PreRender(object sender, EventArgs e)
{
if (Session["Cart"] != null)
{
var oShoppingCart = new ShoppingCart();
var dt = oShoppingCart.Cart();
if (dt.Rows.Count == 0)
{
lblSummary.Text = "0";
}
else
{
int quantity = 0;
double Total = 0;
//for (int i = 0; i < dt.Rows.Count; i++)
//{
// quantity += int.Parse(dt.Rows[i]["Quantity"].ToString());
//}
foreach (DataRow dr in dt.Rows)
{
var Quantity = Convert.ToInt32(string.IsNullOrEmpty(dr["Quantity"].ToString()) ? "0" : dr["Quantity"]);
var Price = Convert.ToDouble(string.IsNullOrEmpty(dr["Price"].ToString()) ? 0 : dr["Price"]);
Total += Quantity * Price;
quantity += Quantity;
}
lblSummary.Text = quantity.ToString();
//lblTotalPrice.Text = string.Format("{0:##,###.##}", Total).Replace('.', '*').Replace(',', '.').Replace('*', ',') + "đ";
}
}
if (Session["IsLogin"] != null)
{
var oWishList = new WishList();
var dv = oWishList.WishListSelectAll("", "", Session["UserName"].ToString(), "", "", "", "").DefaultView;
//lblWishList.Text = dv.Count.ToString();
}
}