資源簡(jiǎn)介
網(wǎng)上書店系統(tǒng)
開發(fā)環(huán)境:Microsoft Visual Studio 2005
數(shù)據(jù)庫:SQL Server 2003或SQL Server 2005
Web服務(wù)器:IIS 5.1及以上版本
內(nèi)容:包括源代碼 數(shù)據(jù)庫文件 數(shù)據(jù)庫腳本語言。是一套不可多得ASP.NET開發(fā)實(shí)例,可用作企業(yè)開發(fā)參考或畢業(yè)論文。
代碼片段和文件信息
using?System;
using?System.Data;
using?System.Configuration;
using?System.Collections;
using?System.Web;
using?System.Web.Security;
using?System.Web.UI;
using?System.Web.UI.WebControls;
using?System.Web.UI.WebControls.WebParts;
using?System.Web.UI.HtmlControls;
public?partial?class?CheckOut?:?System.Web.UI.Page
{
????protected?void?Page_Load(object?sender?EventArgs?e)
????{
????????if?(billingForm.Address?==?null)
????????{
????????????//如果帳戶地址中沒有信息
????????????//可以提取Profile中的信息為其賦值
????????????billingForm.Address?=?Profile.AccountInfo;
????????}
????}
????///?
????///?當(dāng)用戶選擇“與帳戶地址相同”復(fù)選框時(shí)
????///?用帳戶地址的內(nèi)容填充送貨地址
????///?
????protected?void?chkShipToBilling_CheckedChanged(object?sender?EventArgs?e)
????{
????????if?(chkShipToBilling.Checked)
????????????shippingForm.Address?=?billingForm.Address;
????}
????protected?void?Wizard1_NextButtonclick(object?sender?WizardNavigationEventArgs?e)
????{
????????//如果當(dāng)前是第3步,則顯示帳戶地址和送貨地址
????????if?(Wizard1.ActiveStepIndex?==?2)
????????{
????????????//帳戶地址
????????????billingConfirm.Address?=?billingForm.Address;
????????????//送貨地址
????????????shippingConfirm.Address?=?shippingForm.Address;
????????????//總價(jià)格
????????????ltlTotal.Text?=?Profile.ShoppingCart.Total.ToString(“c“);
????????}
????}
????protected?void?Wizard1_FinishButtonclick(object?sender?WizardNavigationEventArgs?e)
????{
????????//首先判斷購物籃中的商品數(shù)目是否大于0
????????if?(Profile.ShoppingCart.CartItems.Count?>?0)
????????{
????????????if?(Profile.ShoppingCart.Count?>?0)
????????????{
????????????????//?綁定購物籃內(nèi)容到顯示控件
????????????????CartListOrdered.Bind(Profile.ShoppingCart.CartItems);
????????????????//?創(chuàng)建訂單
????????????????OrderInfo?order?=?new?OrderInfo(int.MinValue?DateTime.Now.Date?User.Identity.Name?GetCreditCardInfo()?billingForm.Address?shippingForm.Address?Profile.ShoppingCart.Total?Profile.ShoppingCart.GetOrderLineItems());
????????????????//?保存訂單
????????????????Order?newOrder?=?new?Order();
????????????????newOrder.Insert(order);
????????????????//清空購物籃
????????????????Profile.ShoppingCart.Clear();
????????????????Profile.Save();
????????????}
????????????lblMsg.Text?=?“您的訂單已經(jīng)提交,謝謝購買本站圖書!“;
????????}
????????else
????????{
????????????lblMsg.Text?=?“
不能提交訂單,因?yàn)槟馁徫锘@為空.
nkNewUser?href=Default.aspx>繼續(xù)購物“;
????????}
????}
????///?
????///?獲取付款信息
????///?
????private?PayInfo?GetCreditCardInfo()
????{
????????return?PayControl1.Pay;
????}
}
評(píng)論
共有 條評(píng)論