/// <summary> /// Accepts a category to query all the products by, and the Order Set /// to search. /// Returns the set of all Products that have that Category. /// </summary> /// <param name="orderToSearch"></param> /// <param name="query"></param> /// <returns></returns> public Product[] GetAllProductsByCategory( Order orderToSearch, Category query ) { int y = 0; Product [] categoryMatch = null; for( int x = 0; x < orderToSearch.orders.Length; ++x ) { if( orderToSearch.orders[x].product.category.CategoryName == query.CategoryName && orderToSearch.orders[x].product.category.CategoryID == query.CategoryID ) { categoryMatch[y++] = orderToSearch.orders[x].product; } } return categoryMatch; }
/// <summary> /// Default constructor /// </summary> public Data() { _session = new _Session(); category = new Category(); customer = new Customer(); employee = new Employee(); order = new Order(); }
/// <summary> /// Default constructor /// </summary> public Product() { ProductID = 0; ProductName = ""; Discontinued = true; category = new Category(); supply = new Supply(); }
public Product[] GetAllProductsByCategory( Order orderSource, Category itemQuery ) { if( CheckSession() ) { // Get the updated data sets. data = GetData(); return data.category.GetAllProductsByCategory( orderSource, itemQuery ); } else return null; }