/// <summary> /// Parameter "thisOrder" refers to the Order for which you /// wish to query all the product categories for. /// The return value is the set of all Categories for that Order. /// </summary> /// <param name="thisOrder"></param> /// <returns></returns> public Category[] GetAllCategories( Order thisOrder ) { Category [] categories = null; for( int x = 0; x < thisOrder.orders.Length; ++x ) { categories[x] = thisOrder.orders[x].product.category; } return categories; }
public Category[] GetAllGategories( Order custOrder ) { if( CheckSession() ) { // Get the updated data sets. data = GetData(); return data.category.GetAllCategories( custOrder ); } else return null; }
/// <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 Customer() { CustomerID = 0; CompanyName = ""; custOrder = new Order(); }
static void Main(string[] args) { Customer customerX = new Customer( 99, "Corillian" ); Order order = new Order(); order.orders[0] = new OrderDetail(); order.orders = new OrderDetail[1]; order.orders[0].orderingCustomer = customerX; order.orders[0].OrderID = 1; order.orders[0].product.category.CategoryName = "General"; order.orders[0].product.category.CategoryID = 2; order.orders[0].product.Discontinued = false; order.orders[0].product.ProductID = 10; order.orders[0].product.ProductName = "Marmelaid"; order.orders[0].product.supply.supplier = new Supplier[1]; order.orders[0].product.supply.supplier[0] = new Supplier(); order.orders[0].product.supply.supplier[0].CompanyName = "Supplier Inc."; order.orders[0].product.supply.supplier[0].SupplierID = 121; order.orders[0].Quantity = 10; order.orders[0].UnitPrice = 9.99; Console.WriteLine("The new order placement status is: {0}.", customerX.PlaceOrder(customerX, order, 9.99) ); Console.WriteLine("The number of Orders that were placed for customerX is: {0}.", order.orders.Length); }
/// <summary> /// Default constructor /// </summary> public Shipper() { ShipperID = 0; CompanyName = ""; shippingOrder = new Order(); }
/// <summary> /// Default constructor /// </summary> public Employee() { EmployeeID = 0; FirstName = ""; LastName = ""; IsManager = false; orderHandle = new Order(); }
/// <summary> /// Default constructor /// </summary> public Data() { _session = new _Session(); category = new Category(); customer = new Customer(); employee = new Employee(); order = new Order(); }
/// <summary> /// </summary> /// <param name="neworder"></param> /// <returns></returns> /// <summary> /// The parameter "neworders" requires that all the data fields for /// this "Order" must be filled in. /// The return values indicates whether your order was placed or not. /// </summary> /// <param name="orderingCustomer"></param> /// <param name="processingEmployee"></param> /// <param name="neworder"></param> /// <param name="ammountEnclosed"></param> /// <returns>The return values indicates whether your order was placed or not.</returns> public bool PlaceOrder( Customer orderingCustomer, Order neworder, double ammountEnclosed ) { for( int x = 0; x < neworder.orders.Length; ++x ) { if( neworder.orders[x].orderingCustomer.CompanyName != "" || neworder.orders[x].orderingCustomer.CustomerID != 0 || neworder.orders[x].processingEmployee.EmployeeID != 0 || neworder.orders[x].processingEmployee.FirstName != "" || neworder.orders[x].processingEmployee.LastName != "" || neworder.orders[x].OrderID == 0 || neworder.orders[x].Quantity == 0 || neworder.orders[x].UnitPrice == 0.0 || neworder.orders[x].Discount == 0.0 || neworder.orders[x].product.ProductName == "" || neworder.orders[x].product.Discontinued == true || neworder.orders[x].product.category.CategoryName == "" || neworder.orders[x].product.supply.supplier[0].SupplierID == 0 || neworder.orders[x].product.supply.supplier[0].CompanyName == "" ) { return false; } } // Order placement succeeded Customer [] customers = GetAllCustomers(); for( int x = 0; x < customers.Length; ++x ) { if( customers[x] == orderingCustomer ) { customers[x].custOrder = neworder; customers[x].AmountPaid = ammountEnclosed; return true; } } WSA5 service = new WSA5(); // Customer is not in our records, create a new record. for( int x = 0; x < service.data.order.orders.Length; ++x ) { service.data.order.orders[x].orderingCustomer = orderingCustomer; service.data.order.orders[x].orderingCustomer.custOrder = neworder; service.data.order.orders[x].orderingCustomer.AmountPaid = ammountEnclosed; } return true; }
/// <summary> /// Three arguement constructor /// </summary> /// <param name="customerid"></param> /// <param name="companyname"></param> /// <param name="customerOrder"></param> public Customer( int customerID, string companyname, Order customerOrder ) { CustomerID = customerID; CompanyName = companyname; custOrder = customerOrder; }
public bool PlaceOrder( Customer orderingCustomer, Order neworders, double ammountEnclosed ) { if( CheckSession() ) { // Get the updated data sets. data = GetData(); bool result = data.customer.PlaceOrder( orderingCustomer, neworders, ammountEnclosed ); SaveData( data ); return result; } else return false; }
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; }