protected function UpdateAssetModelFields()
 {
     $this->objAssetModel->CategoryId = $this->lstCategory->SelectedValue;
     $this->objAssetModel->ManufacturerId = $this->lstManufacturer->SelectedValue;
     $this->objAssetModel->AssetModelCode = $this->txtAssetModelCode->Text;
     $this->objAssetModel->ShortDescription = $this->txtShortDescription->Text;
     $this->objAssetModel->LongDescription = $this->txtLongDescription->Text;
     $this->objAssetModel->ImagePath = $this->txtImagePath->Text;
     $this->objAssetModel->CreatedBy = $this->lstCreatedByObject->SelectedValue;
     $this->objAssetModel->CreationDate = $this->calCreationDate->DateTime;
     $this->objAssetModel->ModifiedBy = $this->lstModifiedByObject->SelectedValue;
     $this->objAssetModel->AssetModelCustomFieldHelper = AssetModelCustomFieldHelper::Load($this->lstAssetModelCustomFieldHelper->SelectedValue);
 }
 /**
  * This will save this object's AssetModel instance,
  * updating only the fields which have had a control created for it.
  */
 public function SaveAssetModel()
 {
     try {
         // Update any fields for controls that have been created
         if ($this->lstCategory) {
             $this->objAssetModel->CategoryId = $this->lstCategory->SelectedValue;
         }
         if ($this->lstManufacturer) {
             $this->objAssetModel->ManufacturerId = $this->lstManufacturer->SelectedValue;
         }
         if ($this->txtAssetModelCode) {
             $this->objAssetModel->AssetModelCode = $this->txtAssetModelCode->Text;
         }
         if ($this->txtShortDescription) {
             $this->objAssetModel->ShortDescription = $this->txtShortDescription->Text;
         }
         if ($this->txtLongDescription) {
             $this->objAssetModel->LongDescription = $this->txtLongDescription->Text;
         }
         if ($this->txtImagePath) {
             $this->objAssetModel->ImagePath = $this->txtImagePath->Text;
         }
         if ($this->lstCreatedByObject) {
             $this->objAssetModel->CreatedBy = $this->lstCreatedByObject->SelectedValue;
         }
         if ($this->calCreationDate) {
             $this->objAssetModel->CreationDate = $this->calCreationDate->DateTime;
         }
         if ($this->lstModifiedByObject) {
             $this->objAssetModel->ModifiedBy = $this->lstModifiedByObject->SelectedValue;
         }
         if ($this->lstDepreciationClass) {
             $this->objAssetModel->DepreciationClassId = $this->lstDepreciationClass->SelectedValue;
         }
         // Update any UniqueReverseReferences (if any) for controls that have been created for it
         if ($this->lstAssetModelCustomFieldHelper) {
             $this->objAssetModel->AssetModelCustomFieldHelper = AssetModelCustomFieldHelper::Load($this->lstAssetModelCustomFieldHelper->SelectedValue);
         }
         // Save the AssetModel object
         $this->objAssetModel->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 AssetModelCustomFieldHelperMetaControl
  * @param integer $intAssetModelId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing AssetModelCustomFieldHelper object creation - defaults to CreateOrEdit
  * @return AssetModelCustomFieldHelperMetaControl
  */
 public static function Create($objParentObject, $intAssetModelId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intAssetModelId)) {
         $objAssetModelCustomFieldHelper = AssetModelCustomFieldHelper::Load($intAssetModelId);
         // AssetModelCustomFieldHelper was found -- return it!
         if ($objAssetModelCustomFieldHelper) {
             return new AssetModelCustomFieldHelperMetaControl($objParentObject, $objAssetModelCustomFieldHelper);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a AssetModelCustomFieldHelper object with PK arguments: ' . $intAssetModelId);
             }
         }
         // 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 AssetModelCustomFieldHelperMetaControl($objParentObject, new AssetModelCustomFieldHelper());
 }
 /**
  * Reload this AssetModelCustomFieldHelper 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 AssetModelCustomFieldHelper object.');
     }
     // Reload the Object
     $objReloaded = AssetModelCustomFieldHelper::Load($this->intAssetModelId);
     // Update $this's local variables to match
     $this->AssetModelId = $objReloaded->AssetModelId;
     $this->__intAssetModelId = $this->intAssetModelId;
 }