orderprocess.aspx.cs

来自「ASP.net网站开发四“酷”全书:新闻、论坛、电子商城、博客_源码」· CS 代码 · 共 50 行

CS
50
字号
using BookShop.Model;
using BookShop.BLL;
using BookShop.Web.Controls;
using System;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BookShop.Web {
	public class OrderProcess : Page {

		protected StaticAddress statAddrBill;
		protected StaticAddress statAddrShip;
		protected Repeater cart;
		protected NavBar header;
		protected System.Web.UI.WebControls.Label lblOrderDate;
		protected System.Web.UI.WebControls.Label lblUserId;
		protected System.Web.UI.WebControls.Label lblOrderId;
		protected System.Web.UI.WebControls.Label lblCardType;
		protected System.Web.UI.WebControls.Label lblCardExpiration;
		protected System.Web.UI.WebControls.Label lblCardNumber;
		protected System.Web.UI.WebControls.Label lblOrderTotal;

		protected OrderInfo myOrder;

		private void InitializeComponent() {}

		override protected void OnLoad(EventArgs e) {

			ProcessFlow.CartController cartController = new ProcessFlow.CartController();

			OrderInfo newOrder = cartController.PurchaseCart();

			//Display the order info to the user
			lblOrderId.Text = newOrder.OrderId.ToString();
			lblOrderDate.Text = newOrder.Date.ToLongDateString();;
			lblUserId.Text = newOrder.UserId;
			lblCardType.Text = newOrder.CreditCard.CardType;
			lblCardNumber.Text = newOrder.CreditCard.CardNumber;
			lblCardExpiration.Text = newOrder.CreditCard.CardExpiration;
			
			statAddrBill.address = newOrder.BillingAddress;
			statAddrShip.address = newOrder.ShippingAddress;
			
			cart.DataSource = newOrder.LineItems;
			cart.DataBind();

			lblOrderTotal.Text = newOrder.OrderTotal.ToString("c");
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?