/** * This will save this object's Receipt instance, * updating only the fields which have had a control created for it. */ public function SaveReceipt() { try { // Update any fields for controls that have been created if ($this->lstTransaction) { $this->objReceipt->TransactionId = $this->lstTransaction->SelectedValue; } if ($this->lstFromCompany) { $this->objReceipt->FromCompanyId = $this->lstFromCompany->SelectedValue; } if ($this->lstFromContact) { $this->objReceipt->FromContactId = $this->lstFromContact->SelectedValue; } if ($this->lstToContact) { $this->objReceipt->ToContactId = $this->lstToContact->SelectedValue; } if ($this->lstToAddress) { $this->objReceipt->ToAddressId = $this->lstToAddress->SelectedValue; } if ($this->txtReceiptNumber) { $this->objReceipt->ReceiptNumber = $this->txtReceiptNumber->Text; } if ($this->calDueDate) { $this->objReceipt->DueDate = $this->calDueDate->DateTime; } if ($this->calReceiptDate) { $this->objReceipt->ReceiptDate = $this->calReceiptDate->DateTime; } if ($this->chkReceivedFlag) { $this->objReceipt->ReceivedFlag = $this->chkReceivedFlag->Checked; } if ($this->lstCreatedByObject) { $this->objReceipt->CreatedBy = $this->lstCreatedByObject->SelectedValue; } if ($this->calCreationDate) { $this->objReceipt->CreationDate = $this->calCreationDate->DateTime; } if ($this->lstModifiedByObject) { $this->objReceipt->ModifiedBy = $this->lstModifiedByObject->SelectedValue; } // Update any UniqueReverseReferences (if any) for controls that have been created for it if ($this->lstReceiptCustomFieldHelper) { $this->objReceipt->ReceiptCustomFieldHelper = ReceiptCustomFieldHelper::Load($this->lstReceiptCustomFieldHelper->SelectedValue); } // Save the Receipt object $this->objReceipt->Save(); // Finally, update any ManyToManyReferences (if any) } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }
protected function UpdateReceiptFields() { $this->objReceipt->TransactionId = $this->lstTransaction->SelectedValue; $this->objReceipt->FromCompanyId = $this->lstFromCompany->SelectedValue; $this->objReceipt->FromContactId = $this->lstFromContact->SelectedValue; $this->objReceipt->ToContactId = $this->lstToContact->SelectedValue; $this->objReceipt->ToAddressId = $this->lstToAddress->SelectedValue; $this->objReceipt->ReceiptNumber = $this->txtReceiptNumber->Text; $this->objReceipt->DueDate = $this->calDueDate->DateTime; $this->objReceipt->ReceiptDate = $this->calReceiptDate->DateTime; $this->objReceipt->ReceivedFlag = $this->chkReceivedFlag->Checked; $this->objReceipt->CreatedBy = $this->lstCreatedByObject->SelectedValue; $this->objReceipt->CreationDate = $this->calCreationDate->DateTime; $this->objReceipt->ModifiedBy = $this->lstModifiedByObject->SelectedValue; $this->objReceipt->ReceiptCustomFieldHelper = ReceiptCustomFieldHelper::Load($this->lstReceiptCustomFieldHelper->SelectedValue); }
/** * 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 ReceiptCustomFieldHelperMetaControl * @param integer $intReceiptId primary key value * @param QMetaControlCreateType $intCreateType rules governing ReceiptCustomFieldHelper object creation - defaults to CreateOrEdit * @return ReceiptCustomFieldHelperMetaControl */ public static function Create($objParentObject, $intReceiptId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intReceiptId)) { $objReceiptCustomFieldHelper = ReceiptCustomFieldHelper::Load($intReceiptId); // ReceiptCustomFieldHelper was found -- return it! if ($objReceiptCustomFieldHelper) { return new ReceiptCustomFieldHelperMetaControl($objParentObject, $objReceiptCustomFieldHelper); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a ReceiptCustomFieldHelper object with PK arguments: ' . $intReceiptId); } } // 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 ReceiptCustomFieldHelperMetaControl($objParentObject, new ReceiptCustomFieldHelper()); }
/** * Reload this ReceiptCustomFieldHelper 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 ReceiptCustomFieldHelper object.'); } // Reload the Object $objReloaded = ReceiptCustomFieldHelper::Load($this->intReceiptId); // Update $this's local variables to match $this->ReceiptId = $objReloaded->ReceiptId; $this->__intReceiptId = $this->intReceiptId; }