TAILIEUCHUNG - ASP.NET 2.0 Instant Results phần 7

Menu này chứa các mục cho giao diện quản trị được nạp theo mặc định trong trang chủ Quản lý. Một khác biệt nữa là cách siêu dữ liệu được thêm vào phần của trang chủ công cộng tự động. Để xem cách làm việc này, mở ra tập tin trong thư mục gốc của trang web, | Wrox WebShop New Customer CType .ProviderUserKey Guid _ _ Dim orderId As Integer theCustomer OrderNumber _ Total c Catch ex As Exception True False End Try The customer details come from two different sources the customer ID is taken from the MembershipUser class which exposes a ProviderUserKey property that is unique for each user in the system. All the other properties come from the user s profile. The FinalizeOrder method in the ShopManager class performs two actions. First it inserts the order and order details in the database by calling FinalizeOrder on the ShopManagerDB class. When the order has been saved successfully the cart is then emptied to avoid the same order from being saved twice. The FinalizeOrder method in the ShopManagerDB class contains quite a bit of code so the method is broken down in pieces and discussed line by line. The code begins by declaring a variable called myTransaction of type Public Shared Function FinalizeOrder ByVal theShoppingCart As ShoppingCart _ ByVal theCustomer As Customer As Integer Dim myTransaction As Nothing The order is saved partially in the OrderBase table and partially in the OrderDetail table. This is done with multiple INSERT statements. If any of the statements fails you want to roll back the entire operation to avoid having incomplete orders in the database. It s the SqlTransaction object s responsibility to manage that process. All you need to do is wrap the code in a Try Catch block assign the transaction object to each SqlCommand object you want to execute and call Commit or Rollback depending on the success of the operation. The SqlTransaction object is instantiated by calling the .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.