85 lines
3.2 KiB
C++
85 lines
3.2 KiB
C++
|
|
//---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
#include <vcl.h>
|
||
|
|
#pragma hdrstop
|
||
|
|
|
||
|
|
#include "MasterDetailMultiDemoData.h"
|
||
|
|
//---------------------------------------------------------------------------
|
||
|
|
#pragma package(smart_init)
|
||
|
|
#pragma link "cxClasses"
|
||
|
|
#pragma link "cxGridTableView"
|
||
|
|
#pragma link "cxStyles"
|
||
|
|
#pragma link "cxGridBandedTableView"
|
||
|
|
#pragma link "cxGridCardView"
|
||
|
|
#pragma resource "*.dfm"
|
||
|
|
TMasterDetailMultiDemoDataDM *MasterDetailMultiDemoDataDM;
|
||
|
|
//---------------------------------------------------------------------------
|
||
|
|
__fastcall TMasterDetailMultiDemoDataDM::TMasterDetailMultiDemoDataDM(TComponent* Owner)
|
||
|
|
: TDataModule(Owner)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
//---------------------------------------------------------------------------
|
||
|
|
void __fastcall TMasterDetailMultiDemoDataDM::qryFilmsPersonsCalcFields(
|
||
|
|
TDataSet *DataSet)
|
||
|
|
{
|
||
|
|
qryFilmsPersonsName->AsString = qryFilmsPersonsFIRSTNAME->AsString + " " +
|
||
|
|
qryFilmsPersonsSECONDNAME->AsString;
|
||
|
|
}
|
||
|
|
//---------------------------------------------------------------------------
|
||
|
|
void TMasterDetailMultiDemoDataDM::InsertNewPerson()
|
||
|
|
{
|
||
|
|
tblPersonsHelper->Insert();
|
||
|
|
|
||
|
|
tblPersonsHelperFIRSTNAME->AsString = qryFilmsPersonsFIRSTNAME->AsString;
|
||
|
|
tblPersonsHelperSECONDNAME->Value = qryFilmsPersonsSECONDNAME->Value;
|
||
|
|
tblPersonsHelperGENDER->AsBoolean = qryFilmsPersonsGender->AsBoolean;
|
||
|
|
tblPersonsHelperBIRTHNAME->AsString = qryFilmsPersonsBIRTHNAME->AsString;
|
||
|
|
tblPersonsHelperDATEOFBIRTH->AsDateTime = qryFilmsPersonsDATEOFBIRTH->AsDateTime;
|
||
|
|
tblPersonsHelperBIRTHCOUNTRY->AsString = qryFilmsPersonsBIRTHCOUNTRY->AsString;
|
||
|
|
tblPersonsHelperLOCATIONOFBIRTH->AsString =
|
||
|
|
qryFilmsPersonsLOCATIONOFBIRTH->AsString;
|
||
|
|
tblPersonsHelperBIOGRAPHY->AsString = qryFilmsPersonsBIOGRAPHY->AsString;
|
||
|
|
tblPersonsHelperNICKNAME->AsString = qryFilmsPersonsNICKNAME->AsString;
|
||
|
|
tblPersonsHelperHOMEPAGE->AsString = qryFilmsPersonsHOMEPAGE->AsString;
|
||
|
|
|
||
|
|
tblPersonsHelper->Post();
|
||
|
|
}
|
||
|
|
//---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
void TMasterDetailMultiDemoDataDM::InsertNewPersonStaff()
|
||
|
|
{
|
||
|
|
tblPersonsStaffHelper->Insert();
|
||
|
|
tblPersonsStaffHelperPERSONID->AsInteger = tblPersonsHelperID->AsInteger;
|
||
|
|
tblPersonsStaffHelperPERSONLINEID->AsInteger =
|
||
|
|
qryFilmsPersonsPersonLineID->AsInteger;
|
||
|
|
tblPersonsStaffHelper->Post();
|
||
|
|
}
|
||
|
|
//---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
void __fastcall TMasterDetailMultiDemoDataDM::qryFilmsPersonsBeforePost(
|
||
|
|
TDataSet *DataSet)
|
||
|
|
{
|
||
|
|
if (FIsInserting) {
|
||
|
|
InsertNewPerson();
|
||
|
|
InsertNewPersonStaff();
|
||
|
|
DataSet->Cancel();
|
||
|
|
DataSet->Close();
|
||
|
|
DataSet->Open();
|
||
|
|
TLocateOptions ALocateOptions;
|
||
|
|
ALocateOptions.Clear();
|
||
|
|
DataSet->Locate("ID",tblPersonsStaffHelperID->AsInteger,ALocateOptions);
|
||
|
|
Abort;
|
||
|
|
FIsInserting = false;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
//---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
void __fastcall TMasterDetailMultiDemoDataDM::qryFilmsPersonsAfterInsert(
|
||
|
|
TDataSet *DataSet)
|
||
|
|
{
|
||
|
|
FIsInserting = true;
|
||
|
|
}
|
||
|
|
//---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
|