/** * This will save this object's AssetTransaction instance, * updating only the fields which have had a control created for it. */ public function SaveAssetTransaction() { try { // Update any fields for controls that have been created if ($this->lstAsset) { $this->objAssetTransaction->AssetId = $this->lstAsset->SelectedValue; } if ($this->lstTransaction) { $this->objAssetTransaction->TransactionId = $this->lstTransaction->SelectedValue; } if ($this->lstParentAssetTransaction) { $this->objAssetTransaction->ParentAssetTransactionId = $this->lstParentAssetTransaction->SelectedValue; } if ($this->lstSourceLocation) { $this->objAssetTransaction->SourceLocationId = $this->lstSourceLocation->SelectedValue; } if ($this->lstDestinationLocation) { $this->objAssetTransaction->DestinationLocationId = $this->lstDestinationLocation->SelectedValue; } if ($this->chkNewAssetFlag) { $this->objAssetTransaction->NewAssetFlag = $this->chkNewAssetFlag->Checked; } if ($this->lstNewAsset) { $this->objAssetTransaction->NewAssetId = $this->lstNewAsset->SelectedValue; } if ($this->chkScheduleReceiptFlag) { $this->objAssetTransaction->ScheduleReceiptFlag = $this->chkScheduleReceiptFlag->Checked; } if ($this->calScheduleReceiptDueDate) { $this->objAssetTransaction->ScheduleReceiptDueDate = $this->calScheduleReceiptDueDate->DateTime; } if ($this->lstCreatedByObject) { $this->objAssetTransaction->CreatedBy = $this->lstCreatedByObject->SelectedValue; } if ($this->calCreationDate) { $this->objAssetTransaction->CreationDate = $this->calCreationDate->DateTime; } if ($this->lstModifiedByObject) { $this->objAssetTransaction->ModifiedBy = $this->lstModifiedByObject->SelectedValue; } // Update any UniqueReverseReferences (if any) for controls that have been created for it if ($this->lstAssetTransactionCheckout) { $this->objAssetTransaction->AssetTransactionCheckout = AssetTransactionCheckout::Load($this->lstAssetTransactionCheckout->SelectedValue); } // Save the AssetTransaction object $this->objAssetTransaction->Save(); // Finally, update any ManyToManyReferences (if any) } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }
/** * Static Helper Method to Create using PK arguments * You must pass in the PK arguments on an object to load, or leave it blank to create a new one. * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo * static helper methods. Finally, specify a CreateType to define whether or not we are only allowed to * edit, or if we are also allowed to create a new one, etc. * * @param mixed $objParentObject QForm or QPanel which will be using this AssetTransactionCheckoutMetaControl * @param integer $intAssetTransactionCheckoutId primary key value * @param QMetaControlCreateType $intCreateType rules governing AssetTransactionCheckout object creation - defaults to CreateOrEdit * @return AssetTransactionCheckoutMetaControl */ public static function Create($objParentObject, $intAssetTransactionCheckoutId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intAssetTransactionCheckoutId)) { $objAssetTransactionCheckout = AssetTransactionCheckout::Load($intAssetTransactionCheckoutId); // AssetTransactionCheckout was found -- return it! if ($objAssetTransactionCheckout) { return new AssetTransactionCheckoutMetaControl($objParentObject, $objAssetTransactionCheckout); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a AssetTransactionCheckout object with PK arguments: ' . $intAssetTransactionCheckoutId); } } // If EditOnly is specified, throw an exception } else { if ($intCreateType == QMetaControlCreateType::EditOnly) { throw new QCallerException('No PK arguments specified'); } } // If we are here, then we need to create a new record return new AssetTransactionCheckoutMetaControl($objParentObject, new AssetTransactionCheckout()); }
/** * Reload this AssetTransactionCheckout from the database. * @return void */ public function Reload() { // Make sure we are actually Restored from the database if (!$this->__blnRestored) { throw new QCallerException('Cannot call Reload() on a new, unsaved AssetTransactionCheckout object.'); } // Reload the Object $objReloaded = AssetTransactionCheckout::Load($this->intAssetTransactionCheckoutId); // Update $this's local variables to match $this->AssetTransactionId = $objReloaded->AssetTransactionId; $this->ToContactId = $objReloaded->ToContactId; $this->ToUserId = $objReloaded->ToUserId; $this->dttDueDate = $objReloaded->dttDueDate; $this->CreatedBy = $objReloaded->CreatedBy; $this->dttCreationDate = $objReloaded->dttCreationDate; $this->ModifiedBy = $objReloaded->ModifiedBy; $this->strModifiedDate = $objReloaded->strModifiedDate; }