home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / EODEV.Z / CustomerSelection.m < prev    next >
Encoding:
Text File  |  1996-08-23  |  1.0 KB  |  37 lines

  1. /*
  2.         Copyright (c) 1996, NeXT Software, Inc.
  3.         All rights reserved.
  4.  
  5.         You may freely copy, distribute and reuse the code in this example.
  6.         NeXT disclaims any warranty of any kind, expressed or implied,
  7.         as to its fitness for any particular use.
  8. */
  9. #import <EOControl/EOControl.h>
  10. #import <BusinessLogic/BusinessLogic.h>
  11. #import <AppKit/AppKit.h>
  12. #import "CustomerSelection.h"
  13. #import "Transaction.h"
  14.  
  15. @implementation CustomerSelection
  16.  
  17. - (void)StartASale:(id)sender
  18. {
  19.     id selectedCustomer = [customerDisplayGroup selectedObject];
  20.     EOGlobalID *customerGID;
  21.  
  22.     customerGID = [[selectedCustomer editingContext] globalIDForObject:selectedCustomer];
  23.  
  24.     if(!customerGID) {
  25.         NSRunAlertPanel(@"Error", @"Please select a customer", @"OK", nil, nil);
  26.         return;
  27.     }
  28.  
  29.     if([selectedCustomer hasOverdueProducts]) {
  30.         NSRunAlertPanel(@"Error", @"Customer cannot rent new products due to outstanding overdue rentals.", @"OK", nil, nil);
  31.     }
  32.  
  33.     [[Transaction alloc] initWithCustomerGlobalID:customerGID];
  34. }
  35.  
  36. @end
  37.