TBeContactBusinessController
TBeContactBusinessController
Die Klasse TBeContactBusinessController kapselt wichtige Funktionen zum Erstellen und Löschen der Datensätze eines TBecontactBusinessObjects.
Funktionen
| Funktion | Parameter | Beschreibung | 
|---|---|---|
| CbInsertContact:N Erstellt einen neuen Kontakt und bleibt im Edit-Modus | aType:C | Kontakt-Typ K(Kunde), V(Verteter) oder Z(Zulieferer) | 
| aPersNo:N | Nummer des Kunden, Vertreter oder Zulieferers | |
| aContactBO:O | Verwendetes Kontakt-BO | |
| CbDeleteContact:L Löscht den aktuellen Kontakt | aContactBO:O | Verwendetes Kontakt-BO | 
| CbPostContact:L Speichert die aktuellen Änderungen am Kontakt | aContactBO:O | Verwendetes Kontakt-BO | 
Beispiel
//##############################################################################
//##############################################################################
// Beschreibung: TBeContactBO
//               BusinessObject zum Auslesen der Kontakt-Daten
//               BusinessController zum Erstellen neuer Kontakte
//##############################################################################
//##############################################################################
| m_oContactBO, m_oContactBusinessController |
//******************************************************************************
// Datensatz einfügen
//******************************************************************************
function InsertPostContact()
| cType, nPersNo |
   nPersNo := 255,
   cType   := 'K',
   DBStartTrans(m_oContactBO.CbDataModule.ADSConnection),
   startseq
      m_oContactBusinessController.CbInsertContact(cType, nPersNo, m_oContactBO),
      m_oContactBusinessController.CbPostContact(m_oContactBO),
      DBCommit(m_oContactBO.CbDataModule.ADSConnection),
   always
      if DBInTrans(m_oContactBO.CbDataModule.ADSConnection) then
         DBRollback(m_oContactBO.CbDataModule.ADSConnection),
      endif,
   stopseq
end,
//******************************************************************************
// Datensatz auslesen
//******************************************************************************
function ReadContactInformation(),
   // Schreibt die Informationen des aktuellen Datensatzes
   WriteLn('Der Typ des aktuellen Kontakts ist: ' + m_oContactBO.CbMasterType),
   WriteLn('Der Kontakt ist der Nummer zugeordnet: ' + Str(m_oContactBO.CbMasterID)),
end,
//******************************************************************************
// Datensatz löschen
//******************************************************************************
function DeleteContact()
   DBStartTrans(m_oContactBO.CbDataModule.ADSConnection),
   startseq
      m_oContactBusinessController.CbDeleteContact(m_oContactBO),
      DBCommit(m_oContactBO.CbDataModule.ADSConnection),
   always
      if DBInTrans(m_oContactBO.CbDataModule.ADSConnection) then
         DBRollback(m_oContactBO.CbDataModule.ADSConnection),
      endif,
   stopseq
end,
//******************************************************************************
// Hauptfunktion
//******************************************************************************
function InsertDeleteContact()
   m_oContactBO := CreateObject('TBeContactBO'),
   startseq
      m_oContactBusinessController := CreateObject('TBeContactBusinessController'),
      startseq
         m_oContactBusinessController.CbDataModule := m_oContactBO.CbDataModule,
         InsertPostContact(),
         ReadContactInformation(),
         DeleteContact(),
      always
         DestroyObject(m_oContactBusinessController),
      stopseq
   always
      DestroyObject(m_oContactBO),
   stopseq
end,
//******************************************************************************
// Aufruf der Hauptfunktion
//******************************************************************************
InsertDeleteContact()
