/// <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; }
public Employee[] GetAllEmployees() { int x = 0; WSA5 service = new WSA5(); IEnumerator enumerator = service.data.order.orders.GetEnumerator(); Employee [] empList = null; while( enumerator.MoveNext() ) { empList[x] = new Employee(); empList[x++] = (Employee) enumerator.Current; } return empList; }
public Customer[] GetAllCustomers() { int x = 0; Customer [] custList = null; WSA5 service = new WSA5(); IEnumerator enumerator = service.data.order.orders.GetEnumerator(); while( enumerator.MoveNext() ) { custList[x] = new Customer(); custList[x++] = (Customer) enumerator.Current; } return custList; }