Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 10 Checking Out Objective: Understanding Transaction.

Similar presentations


Presentation on theme: "Chapter 10 Checking Out Objective: Understanding Transaction."— Presentation transcript:

1 Chapter 10 Checking Out Objective: Understanding Transaction.
Processing Orders.

2 Understanding Transaction
After successfully selecting the items from the various category, the next thing is to click checkout button. Two things will occur after the previous step: All items in shopping cart are transferred to the order table. The items are deleted from the shopping cart. The above step is perfect example of transaction. In a transaction, a series of steps either succeeds or fails as a whole Three types: ASP Page Transaction, ADO Transaction & Database Transaction.

3 Contd…. A transaction strictly abides by the slogan:
If it’s worth doing at all, its worth doing it right. Every transaction should satisfy a set of properties collectively known as the ACID properties. ACID stands for: Atomic Consistent Isolated Durable

4 1. ASP Page Transaction In a transactional ASP page, changes made within the page are automatically rolled back if an error occurs or the transaction is explicitly aborted. Both PWS & IIS use MS Transaction Server to manage transactions in an ASP page. MS Transaction Server only supports rolling back certain types of transactions. Ex: It cannot roll back transaction made to application and session variables, the file system or component that weren’t designed to support transactions.

5 Contd… Generally, transactional ASP is used to roll back only database changes. Transactional ASP page is created by directive at the top of the page. It must appear as first line in the page. ObjectContext object is an built-in ASP object which supports events. The events are: OnTransactionAbort OnTransactionCommit

6 OnTransactionAbort Event
OnTransactionAbort event occurs whenever there is an error in a page. OnTransactionAbort is useful in two situation: To roll back changes made by the script that aren’t handled by MS Transaction Server. To trap and gracefully report errors.

7 OnTransactionCommit Event
This event is called when a page completes successfully. In an transaction ASP page either of the two events are called. The ObjectContext object has two methods: SetAbort() – calls OnTransactionAbort SetComplete() – Forces OnTransactionCommit Event to occur.

8 2. ADO Transaction ASP Transaction apply to a whole page. To process only database operations within the transactions you can use ADO transactions The ADO Connection object has three methods – BeginTrans() CommitTrans() RollbackTrans()

9 3. Database Transaction MS SQL Server Database uses a transaction log to record almost every change made to the database. This allows changes to be rolled back in case of trouble. The Transact –SQL language, is a language used to interact with SQL Server, has several statements for controlling transactions. You can use these statements within SQL stored procedures to mark the beginning and end of transactions.

10 Completing Order After shopping the customer is presented with two pages: Page to accept address & payment information. Page to Thank & The items are transaferred from the shopping cart to the order table.

11 Retrieving Address and Payment Information
The data from the User table is retrieved and display in the form fields. If need be make the changes. The credit card number is treated different from the other data. The credit card number is hidden only the first two & last two digits of the credit card number are shown. This is for the security reasons.

12 Updating Address And Payment Information
The changes made to the address and credit card information is updated to the User table. Contains script that transfers the items from shopping cart to the order table.

13 Transferring the Shopping Cart
The items from shopping cart is transferred to the order table. Order Table contains the following coulmns: Order_id Order_productID Order_quantity Order_userID Order_entrydata Order_status Order_shipdate

14 Contd… Transfer data from shopping cart to order table is a transaction that include five operations. Call BeginTrans() Method of the ADO Connection object. The records are transferred. The items in shopping cart are deleted. Greets the customer.

15 Processing Orders The order placed by customer is processed.
This page is used by administrator and not customers. It provides the method to view the status of each order. The status value can be: Pending [Default] Credit Card Declined Nit in Stock Shipped


Download ppt "Chapter 10 Checking Out Objective: Understanding Transaction."

Similar presentations


Ads by Google