home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue71 / CSharp / CS / Delphi / Package.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-05-18  |  1.6 KB  |  66 lines

  1. unit Package;
  2.  
  3. interface
  4.  
  5. uses
  6.   ComObj, ActiveX, TDMWebLib_TLB, StdVcl;
  7.  
  8. type
  9.   TPackage = class(TAutoObject, IPackage)
  10.   protected
  11.     function Basic(iOption: Integer): Double; safecall;
  12.     function Advanced(iOption: Integer): Double; safecall;
  13.     function Professional(iOption: Integer): Double; safecall;
  14.     { Protected declarations }
  15.   end;
  16.  
  17. implementation
  18.  
  19. uses ComServ;
  20.  
  21. (* ************************************************************************* *)
  22.  
  23. function optionCost(iOption : Integer) : Double;
  24. var lCost : Double;
  25. begin
  26.     lCost := 0;
  27.  
  28.     if ((iOption AND 1) > 0) then  lCost := lCost + 12;
  29.     if ((iOption AND 2) > 0) then  lCost := lCost + 30;
  30.     if ((iOption AND 4) > 0) then  lCost := lCost + 30;
  31.     if ((iOption AND 8) > 0) then  lCost := lCost + 30;
  32.     if ((iOption AND 16) > 0) then lCost := lCost + 100;
  33.  
  34.     Result := lCost;
  35. end;
  36.  
  37. (* ************************************************************************* *)
  38.  
  39. function TPackage.Basic(iOption: Integer): Double;
  40. begin
  41. Result := 60 + optionCost(iOption);
  42. end;
  43.  
  44. (* ************************************************************************* *)
  45.  
  46. function TPackage.Advanced(iOption: Integer): Double;
  47. begin
  48.     Result := 100 + optionCost(iOption);
  49. end;
  50.  
  51. (* ************************************************************************* *)
  52.  
  53. function TPackage.Professional(iOption: Integer): Double;
  54. begin
  55.     Result := 150 + optionCost(iOption);
  56. end;
  57.  
  58. (* ************************************************************************* *)
  59.  
  60. initialization
  61.   TAutoObjectFactory.Create(ComServer, TPackage, Class_Package,
  62.     ciMultiInstance, tmApartment);
  63. end.
  64.  
  65.  
  66.