home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 May / VPR9705A.ISO / VPR_DATA / PROGRAM / CBTRIAL / SETUP / DATA.Z / BRPARTS.CPP < prev    next >
C/C++ Source or Header  |  1997-02-14  |  2KB  |  74 lines

  1. //---------------------------------------------------------------------------
  2. // Borland C++Builder
  3. // Copyright (c) 1987, 1997 Borland International Inc.  All Rights Reserved.
  4. //---------------------------------------------------------------------------
  5. //---------------------------------------------------------------------------
  6. #include <vcl\vcl.h>
  7. #pragma hdrstop
  8.  
  9. #include "brparts.h"
  10. #include "Datamod.h"
  11. #include "edparts.h"
  12. //---------------------------------------------------------------------------
  13. #pragma resource "*.dfm"
  14. TBrPartsForm *BrPartsForm;
  15. //---------------------------------------------------------------------------
  16. __fastcall TBrPartsForm::TBrPartsForm(TComponent* Owner)
  17.     : TForm(Owner)
  18. {
  19. }
  20. //---------------------------------------------------------------------------
  21. double TBrPartsForm::GetPartNo()
  22. {
  23.   return MastData->PartsSource->DataSet->Fields[0]->AsFloat;
  24. }
  25. //---------------------------------------------------------------------------
  26. void TBrPartsForm::SetPartNo(double NewPartNo)
  27. {
  28.   TLocateOptions flags;
  29.   MastData->PartsSource->DataSet = MastData->Parts;
  30.   MastData->Parts->Locate("PartNo", NewPartNo, flags);
  31. }
  32. //---------------------------------------------------------------------------
  33. void __fastcall TBrPartsForm::EditBtnClick(TObject *Sender)
  34. {
  35.   if (ActivateBtn->Down)
  36.   {
  37.     EdPartsForm->Edit(MastData->PartsQueryPartNo->Value);
  38.     MastData->PartsQuery->Close();
  39.     MastData->PartsQuery->Open();
  40.   }
  41.   else
  42.     EdPartsForm->Edit(MastData->PartsPartNo->Value);
  43.  
  44. }
  45. //---------------------------------------------------------------------------
  46. void __fastcall TBrPartsForm::CloseBtnClick(TObject *Sender)
  47. {
  48.  Close();
  49. }
  50. //---------------------------------------------------------------------------
  51. void __fastcall TBrPartsForm::ActivateQuery(TObject *Sender)
  52. {
  53.   if (!ActivateBtn->Down)
  54.     MastData->PartsSource->DataSet = MastData->Parts;
  55.   else
  56.     try
  57.     {
  58.       MastData->PartsQuery->Close();
  59.       MastData->PartsQuery->Open();
  60.       MastData->PartsSource->DataSet = MastData->PartsQuery;
  61.     }
  62.     catch(...)
  63.     {
  64.       MastData->PartsSource->DataSet = MastData->Parts;
  65.     }
  66.   PartsGrid->Update();
  67. }
  68. //---------------------------------------------------------------------------
  69. void __fastcall TBrPartsForm::FormShow(TObject *Sender)
  70. {
  71.   MastData->Parts->Open();
  72. }
  73. //---------------------------------------------------------------------------
  74.