public Employee[] GetAllEmployees()
 {
     if( CheckSession() )
     {
         // Get the updated data sets.
         data = GetData();
         return data.employee.GetAllEmployees();
     }
     else
         return null;
 }
 public Category[] GetAllGategories( Order custOrder )
 {
     if( CheckSession() )
     {
         // Get the updated data sets.
         data = GetData();
         return data.category.GetAllCategories( custOrder );
     }
     else
         return null;
 }
 public Customer[] GetAllCustomers()
 {
     if( CheckSession() )
     {
         // Get the updated data sets.
         data = GetData();
         return data.customer.GetAllCustomers();
     }
     else
         return null;
 }
 public OrderDetail[] GetAllOrders()
 {
     if( CheckSession() )
     {
         // Get the updated data sets.
         data = GetData();
         return data.order.GetAllOrders();
     }
     else
         return null;
 }
 // To build, uncomment the following lines then save and build the project
 // To test this web service, press F5
 /// <summary>
 /// Saves the current service related.
 /// </summary>
 /// <param name="data"></param>
 private void SaveData( Data data )
 {
     XmlSerializer ser = new XmlSerializer( typeof(Data) );
     FileStream stream = new FileStream(
         "http://matthew.klump-pdx.com/thepuzzler_3dstyle/WSA5_WebService/data.xml",
         FileMode.OpenOrCreate );
     ser.Serialize( stream, data );
     stream.Close();
 }
 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 bool Login( int employee_ID, int customer_ID, string Name, int admin )
 {
     data = new Data();
     session = data._session;
     Employee [] allEmployees = GetAllEmployees();
     IEnumerator iter = allEmployees.GetEnumerator();
     while( iter.MoveNext() )
     {
         Employee emp = (Employee) iter.Current;
         if( emp.EmployeeID == employee_ID && emp.LastName == Name )
         {
             // Build the session token and set terminated flag to false for employee.
             data._session = new _Session( AddToSession(employee_ID.ToString()) );
             SaveData( data );
             return true;
         }
     }
     Customer [] allCustomers = GetAllCustomers();
     iter = allCustomers.GetEnumerator();
     while( iter.MoveNext() )
     {
         Customer cust = (Customer) iter.Current;
         if( cust.CustomerID == customer_ID && cust.CompanyName == Name )
         {
             // Build the session token and set terminated flag to false for customer.
             data._session = new _Session( AddToSession(customer_ID.ToString()) );
             SaveData( data );
             return true;
         }
     }
     if( admin == 123456 )
     {
         // Build the session token and set terminated flag to false for customer.
         data._session = new _Session( "123456" );
         SaveData( data );
         return true;
     }
     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;
 }