?? checkout.aspx.cs
字號:
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 EMall
{
/// <summary>
/// CheckOut 的摘要說明。
/// </summary>
public class CheckOut : System.Web.UI.Page
{
protected Pub pub = new Pub();
protected System.Web.UI.WebControls.Label lbMsg;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Web.UI.WebControls.Label lbTotal;
protected System.Web.UI.WebControls.ImageButton ImageButton1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Panel Panel1;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此處放置用戶代碼以初始化頁面
// 其實, 一開始的頁面處理還是跟ShoppingCart.aspx一樣的
// 另外, 此時的用戶安全認證, 由Web.Config文件已經進行定義
ShoppingCartList();
}
/// <summary>
/// 顯示當前用戶(不論是已經登錄用戶還是訪客)的購物清單
/// </summary>
private void ShoppingCartList()
{
// 獲取當前用戶的ShoppingCardID
String CartID = pub.GetShoppingCartID();
DataGrid1.DataSource = pub.spShoppingCartList(CartID);
DataGrid1.DataBind();
DispInfo(CartID);
}
private void DispInfo(String CartID)
{
lbTotal.Text = String.Format("{0:c}", pub.spShoppingCartTotal(CartID));
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:該調用是 ASP.NET Web 窗體設計器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 設計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內容。
/// </summary>
private void InitializeComponent()
{
this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
// 最終確認用戶的購物車ID
String CartID = pub.GetShoppingCartID();
// 最終確認用戶唯一標識
String CustomerId = User.Identity.Name;
if (((CartID != null) && (CustomerId != null)) || ((CartID != "") && (CustomerId != "")))
{
// 此時將購物車轉入客戶訂單之中
int OrderId = pub.spOrdersInsert(Int32.Parse(CustomerId), CartID, TextBox1.Text.Trim());
lbMsg.Text="系統提示: 祝賀您, 您的訂單已經成功發送, 我們的工作人員正在處理您的訂單,請稍候......!";
lbMsg.Text = "<br><b>請記下您的訂單號: </b>" + OrderId;
ImageButton1.Visible = false;
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -