【正文】
返回該用戶的 ID // 否則,返回空值 //該方法調(diào)用 CustomerLogin存儲過程 //******************************************************* public String Login(string , string password) { // 創(chuàng)建一個連接 SqlConnection和 SqlCommand對象。 (parameterEmail)。 ()。 在 3個用戶控件以及對它們 的引用,代碼 414如下: 代碼 414 : % Register TagPrefix=OnNetBookSell TagName=Header Src= % 用戶進入 查看圖書 以會員身份登錄 購買圖書 請先登錄,若未注冊請注冊成為會員 會員注冊 圖書查詢 訂單查詢 以管理員身份登錄 商品添加 商品審查 處理訂單 發(fā)貨查詢 會員審查 管理員添加 管理員審查 管理員退出 購買圖書 21 % Register TagPrefix=OnNetBookSell TagName=Menu Src= % % Register TagPrefix=OnNetBookSell TagName=PopularItems Src= % % Page Language=c CodeBehind= AutoEventWireup=false Inherits= % 這里對控件的注冊使用 OnNetBookSell作為命名空間的別名。 ⑶ 用戶沒有注冊,然后購買圖書,在結(jié)賬時,系統(tǒng)自動轉(zhuǎn)到登錄頁面,此時用戶可以注冊一個新賬號,然后登錄。 String customerId = (, ())。 } } } 圖書列表頁面 圖書 列表頁面 。在查找時,可能 不止一本圖書,所以在頁面布局代碼中使用了 DataList控件。 BookDetails myBookDetails = (BookID)。 = BookID。 購物車 查看商品 滿意嗎 下訂單 調(diào)整商品 是 否 30 圖 410中可以看到使用了 DataGrid的模板列。 CheckBox remove = (CheckBox) [i].FindControl(Remove)。 圖 411 訂單詳情頁面 。 訂單功能實現(xiàn)時,怎樣顯示同一訂單購物信息,通過傳遞訂單號和客戶名字,利用了數(shù)據(jù)庫的交叉連接。 動態(tài)更新是本系統(tǒng)的一大特色,這主要歸功于數(shù)據(jù)庫的完美設(shè)計。s development tendency is tallies. The database and it contains the data is regarded as is one kind of important public property, moreover in the very many IT department, started to appear one kind of special data bank administration anization (DBA), they are responsible to maintain the database, defines data which and renews it to contain, provides visit to database work and so on constitutive property. The IT department or in the pany other departments other anization is responsible to develop the visit database the application procedure, the report form, the inquiry or other logical programs. But the database security, the visit form which permits, generally speaking related database domain all work, all pletes by DBA. In the modern enterprise scope the relational database two important characteristics memories process and the trigger have bee this kind of tendency the constituent. The memory process provides the performance uses in the database interior execution and the database interior execution and database correlation application processing. For example, a memory 39 process may plete such application task, namely accepts a customer the order form or from a bank account to another account shift currency. The trigger uses in the condition automatic initiation memory process processing performance which acts according to in the database to appear. For example, if the expense account appears overdraws, then the trigger may automatically from the deposit account shift fund to the expense account in. The memory process and the trigger characteristic obtained the enormous expansion in the 1990s last stages pop。個人交易平臺包括我要買書和我要賣書兩部分。 心得與收獲 代碼理解不難,主要是開發(fā)思想的建立 圖書電子交易系統(tǒng)屬于電子商 務(wù)購物系統(tǒng)范疇,難點和重點是 購物車功能和訂單功能的實現(xiàn)。} } } catch { = There has been a problem with one or more of your inputs.。 i++) { // Obtain references to row39。 } 購物車頁面 購物車流程圖 用于顯示當(dāng)前購物車上圖書的信息。 = ?BookID= + BookID。 開始搜索 輸入條件 搜索結(jié)果 查看商品 購物車 下訂單 繼續(xù)搜索 是 否 28 } } 代碼 420 ,cs添加事件代碼: private void Page_Load(object sender, e) { // 獲取圖書編號 int BookID = ([BookID])。 } 26 圖 46 圖書詳情頁面 ,主要由 HTML代碼組成,在隱藏文件中通過另外頁面?zhèn)鬟f過來的 BookID參數(shù)進行顯示。 } //頁面轉(zhuǎn)向用戶最初請求頁面 (customerId, )。 String tempCartID = ()。 圖 44 當(dāng)購買圖書時有 3種情況: ⑴ 用戶曾經(jīng)注冊過,在進入主頁時,登錄然后購買圖書。 } } 頁面設(shè)計與實現(xiàn) 系統(tǒng)功能模塊圖 主頁面 主頁面由 , 主要是起頁面導(dǎo)航功能,顯示給用戶本系統(tǒng)主要有什么內(nèi)容。 (parameterCustomerID)。 SqlParameter parameterEmail = new SqlParameter(Email, , 50)。 } 在 try語句中,還使用 int customerId = (int)獲取用戶的 ID,這樣應(yīng)用程序就可以使用該編號跟蹤用戶,免得重新從數(shù)據(jù)庫中讀 取。 (parameterCustomerID)。 SqlParameter parameterCustomerAddress = new SqlParameter(CustomerAddress, , 50)。 = CustomerSex。 ③ 接下來就是要 傳遞存儲過程所需要的參數(shù)。 ⒉ 更新數(shù)據(jù)庫 當(dāng)應(yīng)用程序添加、刪除或更改了用戶信息,就需要把更改后的數(shù)據(jù)保存到數(shù)據(jù)庫中。 = (string)。 ④ 數(shù)據(jù)庫連接和數(shù)據(jù)庫執(zhí)行的參數(shù)都準備好了,下一步就打開數(shù)據(jù)庫執(zhí)行命令。pwd=’ ’ ”/ /appSettings /configuration 這是一種典型的數(shù)據(jù)庫連接配置的方法,在 中配置,然后通過使用[“ConnectionString”]方法即可讀取連接字符串。 因為在數(shù)據(jù)庫設(shè)計中通常利用一個自增的 ID 作為表的主鍵,這個 ID 是 SQL Server 自動維護的。 //******************************************************* public class CustomerDetails { 15 public String CustomerName。通過 DESC 將圖書按照銷售量降序排列,利用TOP5 返回前 5 本圖書,這樣就實現(xiàn)了“暢銷書”。表 46所示為訂單詳情表 : 表 46 OrderDetails 表 名稱 數(shù)據(jù)類型 長度 允許空 作用 OrderID int 4 否 訂單編號,外鍵,主鍵 BookID int 4 否 圖書編號,外鍵,主鍵 Quantity int 4 否 數(shù)量 UnitCost money 8 否 圖書價格 ⒎ 評論表( Reviews 表) 評論表記錄了用戶對圖書的評價。 另外, Quantity 記錄每次購物的數(shù)量,在設(shè)計數(shù)據(jù)庫時,默認將該值設(shè)置為1, 以減少用戶的輸入。 ⒉ 圖書表( Books 表) Books 表存放圖書信息,包括圖書編號、圖書名稱、圖書類表、圖 書 ISBN、圖書 URL 地址、圖書價格和內(nèi)容介紹,設(shè)計結(jié)構(gòu)如表 42所示: 表 42 Books 表 名稱 數(shù)據(jù)類型 長度 允許空 作用 BookID int 4 否 圖書的 ID 編號,主鍵,自增 CategoryID int 4 否 種類 ID 編號,外鍵 BookISBN varchar 50 是 圖書的 ISBN BookName varchar 50 是 圖書名 BookImage varchar 50 是 圖書的封面 UnitCost money 8 否 圖書價格 10 Description varchar 1000 是 內(nèi)容介紹 在 Books 表 中, BookID 作為表的主鍵,圖書表里的 CategoryID 是 Categories表的外鍵。具體實現(xiàn)是從數(shù)據(jù)庫設(shè)計開始的。 瀏覽商品 選擇商品 訂購商品 去購物車 去收銀臺 提交訂單 未注冊用戶 已登錄注冊用戶 未登錄注冊用戶 注冊 登錄 系統(tǒng)首頁 用戶登錄頁面 功能選擇 新用戶注冊 管理員登錄 書籍查詢 查看購物車 結(jié)帳 功能選擇 書籍管理 用戶管理 處理顧客訂單 7 商品列表瀏覽 未注冊用戶未登錄已注冊用戶登 錄選擇商品購 買提交訂單修改所選商品完 成 查詢訂單 圖 34 網(wǎng)上書店系統(tǒng)的用戶購物流程 Brower/Server 結(jié)構(gòu) B/S 的多層結(jié)構(gòu)是在傳統(tǒng)的 C/S 結(jié)構(gòu)基礎(chǔ)上產(chǎn)生的。 IIS 通過使用超文本傳輸協(xié)議( HTTP)傳輸信息,并將信息加載到網(wǎng)站上,當(dāng)然還可以配置 IIS 提供文件傳輸協(xié)議( FTP)服務(wù),以