/** * This will save this object's Shipment instance, * updating only the fields which have had a control created for it. */ public function SaveShipment() { try { // Update any fields for controls that have been created if ($this->txtShipmentNumber) { $this->objShipment->ShipmentNumber = $this->txtShipmentNumber->Text; } if ($this->lstTransaction) { $this->objShipment->TransactionId = $this->lstTransaction->SelectedValue; } if ($this->lstFromCompany) { $this->objShipment->FromCompanyId = $this->lstFromCompany->SelectedValue; } if ($this->lstFromContact) { $this->objShipment->FromContactId = $this->lstFromContact->SelectedValue; } if ($this->lstFromAddress) { $this->objShipment->FromAddressId = $this->lstFromAddress->SelectedValue; } if ($this->lstToCompany) { $this->objShipment->ToCompanyId = $this->lstToCompany->SelectedValue; } if ($this->lstToContact) { $this->objShipment->ToContactId = $this->lstToContact->SelectedValue; } if ($this->lstToAddress) { $this->objShipment->ToAddressId = $this->lstToAddress->SelectedValue; } if ($this->lstCourier) { $this->objShipment->CourierId = $this->lstCourier->SelectedValue; } if ($this->txtTrackingNumber) { $this->objShipment->TrackingNumber = $this->txtTrackingNumber->Text; } if ($this->calShipDate) { $this->objShipment->ShipDate = $this->calShipDate->DateTime; } if ($this->chkShippedFlag) { $this->objShipment->ShippedFlag = $this->chkShippedFlag->Checked; } if ($this->lstCreatedByObject) { $this->objShipment->CreatedBy = $this->lstCreatedByObject->SelectedValue; } if ($this->calCreationDate) { $this->objShipment->CreationDate = $this->calCreationDate->DateTime; } if ($this->lstModifiedByObject) { $this->objShipment->ModifiedBy = $this->lstModifiedByObject->SelectedValue; } // Update any UniqueReverseReferences (if any) for controls that have been created for it if ($this->lstShipmentCustomFieldHelper) { $this->objShipment->ShipmentCustomFieldHelper = ShipmentCustomFieldHelper::Load($this->lstShipmentCustomFieldHelper->SelectedValue); } // Save the Shipment object $this->objShipment->Save(); // Finally, update any ManyToManyReferences (if any) } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }
protected function UpdateShipmentFields() { $this->objShipment->ShipmentNumber = $this->txtShipmentNumber->Text; $this->objShipment->TransactionId = $this->lstTransaction->SelectedValue; $this->objShipment->FromCompanyId = $this->lstFromCompany->SelectedValue; $this->objShipment->FromContactId = $this->lstFromContact->SelectedValue; $this->objShipment->FromAddressId = $this->lstFromAddress->SelectedValue; $this->objShipment->ToCompanyId = $this->lstToCompany->SelectedValue; $this->objShipment->ToContactId = $this->lstToContact->SelectedValue; $this->objShipment->ToAddressId = $this->lstToAddress->SelectedValue; $this->objShipment->CourierId = $this->lstCourier->SelectedValue; $this->objShipment->TrackingNumber = $this->txtTrackingNumber->Text; $this->objShipment->ShipDate = $this->calShipDate->DateTime; $this->objShipment->ShippedFlag = $this->chkShippedFlag->Checked; $this->objShipment->CreatedBy = $this->lstCreatedByObject->SelectedValue; $this->objShipment->CreationDate = $this->calCreationDate->DateTime; $this->objShipment->ModifiedBy = $this->lstModifiedByObject->SelectedValue; $this->objShipment->ShipmentCustomFieldHelper = ShipmentCustomFieldHelper::Load($this->lstShipmentCustomFieldHelper->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 ShipmentCustomFieldHelperMetaControl * @param integer $intShipmentId primary key value * @param QMetaControlCreateType $intCreateType rules governing ShipmentCustomFieldHelper object creation - defaults to CreateOrEdit * @return ShipmentCustomFieldHelperMetaControl */ public static function Create($objParentObject, $intShipmentId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intShipmentId)) { $objShipmentCustomFieldHelper = ShipmentCustomFieldHelper::Load($intShipmentId); // ShipmentCustomFieldHelper was found -- return it! if ($objShipmentCustomFieldHelper) { return new ShipmentCustomFieldHelperMetaControl($objParentObject, $objShipmentCustomFieldHelper); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a ShipmentCustomFieldHelper object with PK arguments: ' . $intShipmentId); } } // 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 ShipmentCustomFieldHelperMetaControl($objParentObject, new ShipmentCustomFieldHelper()); }
/** * Reload this ShipmentCustomFieldHelper 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 ShipmentCustomFieldHelper object.'); } // Reload the Object $objReloaded = ShipmentCustomFieldHelper::Load($this->intShipmentId); // Update $this's local variables to match $this->ShipmentId = $objReloaded->ShipmentId; $this->__intShipmentId = $this->intShipmentId; }