shopcartsimple.aspx.cs
来自「网上书店系统由两部分组成:购书网站和订单处理中心。其中购书网站是一个Web应用程」· CS 代码 · 共 67 行
CS
67 行
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace Bookshop
{
/// <summary>
/// ShopCartSimple 的摘要说明。
/// </summary>
public class ShopCartSimple : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if( Session["uid"] == null )
{
Label1.Text = "You haven't login the shop system";
}
else
{
ArrayList temp = ((ArrayList)Session["bookCart"]);
Label1.Text = "<table cellpadding=3 border=2>";
Label1.Text += "<tr><td class=temp><b>Book Name</b></td><td class=temp><b>Book Price</b></td></tr>";
float sum = 0;
for( int i = 0; i < temp.Count; i++ )
{
BookInfo tempBook = (BookInfo)temp[i];
Label1.Text += "<tr><td class=temp>" + tempBook.bookName + "</td><td class=temp>" + tempBook.bookPrice + "</td></tr>";
sum += tempBook.bookPrice;
}
Label1.Text += "<tr><td class=temp><b>In All</b></td><td class=temp>" + sum + "</td></tr></table>";
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?