求在线购物的ASP.NET代码,最好是Code Behind的

km168 2003-11-21 10:40:52
如题
...全文
42 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
chegan 2003-11-24
  • 打赏
  • 举报
回复
http://www.asp.net/Default.aspx?tabindex=7&tabid=41
有一些例子,可以参考。
km168 2003-11-23
  • 打赏
  • 举报
回复
装完以后打开:

显示“解决方案看起来是受原代码管理,但无法找到它的绑定信息。保存解决方案的原代码管理设置的MSSCCPRJ.SCC文件或其他项可能已被删除。由于无法自动恢复这些缺少的信息,缺少绑定的项目将被视为不受源代码管理”。

点“确定”后,

又显示“项目似乎处于源代码管理下,但此计算机上没有安装原代码管理提供程序。对此项目将禁用原代码管理集成”

怎么办?
km168 2003-11-23
  • 打赏
  • 举报
回复
up
km168 2003-11-22
  • 打赏
  • 举报
回复
哪里能下载PetShop代码?
loulanlouzhu 2003-11-22
  • 打赏
  • 举报
回复
http://download.microsoft.com/download/.netframesdk/petshop/2.0/NT5XP/EN-US/petshop.msi


===弯弯的月亮小小的船,小小的船,两头尖,我在小小的船里坐,只看见闪闪
的星星蓝蓝的天.

===本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利
asp111222 2003-11-21
  • 打赏
  • 举报
回复
using System;
using System.Collections;

//References to PetShop specific libraries
//PetShop busines entity library
using PetShop.Model;

namespace PetShop.BLL {

/// <summary>
/// An object to represent a customer's shopping cart
/// </summary>
[Serializable]
public class Cart : IEnumerable {

/// <summary>
/// Internal storage for a cart
/// </summary>
private ArrayList _items = new ArrayList();

private decimal _total=0;

/// <summary>
/// Returns an enumerator for the cart items in a cart
/// </summary>
/// <returns></returns>
public IEnumerator GetEnumerator() {
return _items.GetEnumerator();
}

// Properties
public decimal Total {
get { return _total; }
set { _total = value; }
}

/// <summary>
/// Returns number of items in cart
/// </summary>
public int Count {
get { return _items.Count; }
}

/// <summary>
/// Return CartItem representation of object at a given address
/// </summary>
public CartItemInfo this[int index] {
get { return (CartItemInfo)_items[index]; }
}

/// <summary>
/// Add an item to the cart
/// </summary>
/// <param name="ItemId">ItemId of item to add</param>
public void Add(string ItemId) {
foreach (CartItemInfo cartItem in _items) {
if (ItemId == cartItem.ItemId) {
cartItem.Quantity++;
cartItem.InStock = (GetInStock(ItemId) - cartItem.Quantity) >= 0 ? true : false;
_total = _total+(cartItem.Price*cartItem.Quantity);
return;
}
}

Item item = new Item();

ItemInfo data = item.GetItem(ItemId);
CartItemInfo newItem = new CartItemInfo(ItemId,data.Name, (data.Quantity >= 1), 1, (decimal)data.Price);
_items.Add(newItem);
_total = _total+(data.Price);
}

/// <summary>
/// Remove item from the cart based on itemId
/// </summary>
/// <param name="itemId">ItemId of item to remove</param>
public void Remove(string itemId) {
foreach (CartItemInfo item in _items) {
if (itemId == item.ItemId) {
_items.Remove(item);
_total = _total-(item.Price*item.Quantity);
return;
}
}
}

/// <summary>
/// Removes item from cart at specific index
/// </summary>
/// <param name="index">Element number of item to remove</param>
public void RemoveAt(int index) {
CartItemInfo item = (CartItemInfo)_items[index];
_total = _total-(item.Price*item.Quantity);
_items.RemoveAt(index);

}

/// <summary>
/// Returs internal array list of cart items
/// </summary>
/// <returns></returns>
public ArrayList GetCartItems() {
return _items;
}

/// <summary>
/// Method to convert internal array of cart items to order line items
/// </summary>
/// <returns>New array list of order line items</returns>
public ArrayList GetOrderLineItems() {

ArrayList orderLineItems = new ArrayList();

int lineNum = 1;

foreach (CartItemInfo item in _items) {

LineItemInfo lineItem = new LineItemInfo(item.ItemId, item.Name, lineNum, item.Quantity, item.Price);
orderLineItems.Add(lineItem);
lineNum++;
}

return orderLineItems;
}


/// <summary>
/// Internal method to get the stock level of an item
/// </summary>
/// <param name="ItemId">Unique identifier of item to get stock level of</param>
/// <returns></returns>
private int GetInStock(string ItemId){
Inventory inventory = new Inventory();

return inventory.CurrentQuantityInStock(ItemId);
}
}
}
asp111222 2003-11-21
  • 打赏
  • 举报
回复
PetShop
webdiyer 2003-11-21
  • 打赏
  • 举报
回复
PetShop
或者
Duwamish

都是精典
loulanlouzhu 2003-11-21
  • 打赏
  • 举报
回复
参见vs.net自带duwamish例子!


===弯弯的月亮小小的船,小小的船,两头尖,我在小小的船里坐,只看见闪闪
的星星蓝蓝的天.


===本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利

62,244

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧