Esempio n. 1
0
    /// <summary>
    /// 获取购物车产品列表
    /// </summary>
    private void GetList()
    {
        IList <OrderProduct> list = shopCarBLL.GetList();
        int count = list.Count;

        StringBuilder result = new StringBuilder();

        result.Append("{result:[");
        if (count > 0)
        {
            for (int i = 0; i < count; i++)
            {
                OrderProduct orderProduct = list[i];
                result.Append("{NO:").Append((i + 1).ToString()).Append(",");
                result.Append("ProductID:\"").Append(orderProduct.ProductID).Append("\",");
                result.Append("ProductName:\"").Append(orderProduct.ProductName).Append("\",");
                result.Append("Price:").Append(orderProduct.Price).Append(",");
                result.Append("Num:").Append(orderProduct.Num).Append("}");
                if (i < count - 1)
                {
                    result.Append(",");
                }
            }
        }

        result.Append("]}");

        Response.Write(result.ToString());
        Response.End();
    }
Esempio n. 2
0
 private void BindRepeater()
 {
     lblTotal.Text  = string.Format(@"合计:${0}", _shopCarBLL.Total.ToString("#"));
     rpt.DataSource = _shopCarBLL.GetList();
     rpt.DataBind();
 }