IBuySpy Store, Part II: JScript Components: Component Contents - Doc JavaScript | WebReference

IBuySpy Store, Part II: JScript Components: Component Contents - Doc JavaScript


IBuySpy Store, Part II: JScript Components

Component Contents

The JScript .NET component ProductsDB.js handles the business logic of the IBuySpy Store products. In particular, it extracts products and categories from the database, according to different criteria and cross sections.

All IBuySpy components share the same IBuySpy namespace. The ProdjctsDB.js component includes two classes: ProductDetails and ProductsDB. The ProductDetails class includes only parameters:

public class ProductDetails {
  public var ModelNumber : String;
  public var ModelName : String;
  public var ProductImage : String;
  public var UnitCost : decimal;
  public var Description : String;
} 

The ProductsDB class is the main class. It includes the following method declarations:

public class ProductsDB {
  public function GetProductCategories()
    : SqlDataReader {...}
  public function GetProducts(categoryID: int)
    : SqlDataReader {...}
  public function GetProductDetails(productID: int)
    : ProductDetails {...}
  public function GetProductDetails(productID: int)
    : ProductDetails {...}
  public function GetMostPopularProductsOfWeek()
    : SqlDataReader{...}
  public function SearchProductDescriptions(searchString
    : String) : SqlDataReader {...}
}

The JScript .NET component CustomersDB.js handles the business logic of the IBuySpy Store customers. In particular, it extracts customers from the database, adds customers to the database, and logs customers in the database. The CustomersDB.js component includes two classes: CustomerDetails and CustomersDB. The CustomerDetails class includes only parameters:

public class CustomerDetails {
  public var FullName : String;
  public var Email : String ;
  public var Password : String ;
} 

The CustomersDB class is the main class. It includes the following method declarations:

public class CustomersDB {
  public function GetCustomerDetails(customerID: String)
    : CustomerDetails {...}
  public function AddCustomer(fullName: String, email:
    String, password: String) : String {...}
  public function Login(email: String, password : String) : String {...}
}

The JScript .NET component OrdersDB.js handles the business logic of the IBuySpy Store orders. In particular, it extracts orders from the database, adds orders to the database, and computes the shipping date. The OrdersDB.js component includes two classes: OrderDetails and OrdersDB. The OrderDetails class includes only parameters:

public class OrderDetails {
  public var OrderDate : DateTime;
  public var ShipDate : DateTime;
  public var OrderTotal : decimal;
  public var OrderItems : DataSet;
} 

The OrdersDB class is the main class. It includes the following method declarations:

public class OrdersDB {
  public function GetCustomerOrders(customerID: String)
    : SqlDataReader {...}
  public function GetOrderDetails(orderID: int, customerID: String)
    : OrderDetails {...}
  public function CalculateShippingDate(customerID: String, cartID:
    String) : DateTime {...}
  public function PlaceOrder(customerID: String, cartID: String)
    : int {...}
}

The JScript .NET component ReviwsDB.js handles the business logic of the IBuySpy Store reviews. In particular, it extracts reviews from the database, and adds new reviews to the database. The ReviewsDB.js component includes a single class: ReviewsDB. The ReviewsDB class includes the following method declarations:

public class ReviewsDB {
  public function GetReviews(productID : int) : SqlDataReader {...}
  public function AddReview(productID: int, customerName: String,
    customerEmail: String, rating: int , comments: String ) : void {...}
}

The JScript .NET component ShoppingCartDB.js handles the business logic of the IBuySpy Store shopping cart. In particular, it extracts an item from the shopping cart, adds an item to the cart, computes the total amount of items in the cart, counts the items in cart, updates an item in the cart, and removes an item from the cart. The ShoppingCartDB.js component includes a single class: ShoppingCartDB. The ShoppingCartDB class includes the following method declarations:

public class ShoppingCartDB {
  public function GetItems(cartID: String ) : SqlDataReader {...}
  public function AddItem(cartID: String, productID: int, quantity: int)
    : void {...}
  public function UpdateItem(cartID: String, productID: int, quantity: int)
    : void {...}
  public function RemoveItem(cartID: String, productID: int) : void {...}
  public function GetItemCount(cartID: String ) : int {...}
  public function GetTotal(cartID: String ) : decimal {...}
  public function MigrateCart(oldCartId: String, newCartId: String)
    : void {...}
  public function EmptyCart(cartID: String) : void {...}
  public function GetShoppingCartId() : String {...}
}

Next: A Final Word


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: October 7, 2002
Revised: October 7, 2002

URL: http://www.webreference.com/js/column120/6.html