home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 April / Chip_1997-04_cd.bin / prezent / cb / data.z / BRPARTS.CPP < prev    next >
C/C++ Source or Header  |  1997-01-16  |  2KB  |  70 lines

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