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);
 }
 /**
  * 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());
 }
 /**
  * Override method to perform a property "Get"
  * This will get the value of $strName
  *
  * @param string $strName Name of the property to get
  * @return mixed
  */
 public function __get($strName)
 {
     switch ($strName) {
         ///////////////////
         // Member Variables
         ///////////////////
         case 'AssetModelId':
             // Gets the value for intAssetModelId (Read-Only PK)
             // @return integer
             return $this->intAssetModelId;
         case 'CategoryId':
             // Gets the value for intCategoryId
             // @return integer
             return $this->intCategoryId;
         case 'ManufacturerId':
             // Gets the value for intManufacturerId
             // @return integer
             return $this->intManufacturerId;
         case 'AssetModelCode':
             // Gets the value for strAssetModelCode
             // @return string
             return $this->strAssetModelCode;
         case 'ShortDescription':
             // Gets the value for strShortDescription (Not Null)
             // @return string
             return $this->strShortDescription;
         case 'LongDescription':
             // Gets the value for strLongDescription
             // @return string
             return $this->strLongDescription;
         case 'ImagePath':
             // Gets the value for strImagePath
             // @return string
             return $this->strImagePath;
         case 'CreatedBy':
             // Gets the value for intCreatedBy
             // @return integer
             return $this->intCreatedBy;
         case 'CreationDate':
             // Gets the value for dttCreationDate
             // @return QDateTime
             return $this->dttCreationDate;
         case 'ModifiedBy':
             // Gets the value for intModifiedBy
             // @return integer
             return $this->intModifiedBy;
         case 'ModifiedDate':
             // Gets the value for strModifiedDate (Read-Only Timestamp)
             // @return string
             return $this->strModifiedDate;
         case 'DepreciationClassId':
             // Gets the value for intDepreciationClassId
             // @return integer
             return $this->intDepreciationClassId;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Category':
             // Gets the value for the Category object referenced by intCategoryId
             // @return Category
             try {
                 if (!$this->objCategory && !is_null($this->intCategoryId)) {
                     $this->objCategory = Category::Load($this->intCategoryId);
                 }
                 return $this->objCategory;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Manufacturer':
             // Gets the value for the Manufacturer object referenced by intManufacturerId
             // @return Manufacturer
             try {
                 if (!$this->objManufacturer && !is_null($this->intManufacturerId)) {
                     $this->objManufacturer = Manufacturer::Load($this->intManufacturerId);
                 }
                 return $this->objManufacturer;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CreatedByObject':
             // Gets the value for the UserAccount object referenced by intCreatedBy
             // @return UserAccount
             try {
                 if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) {
                     $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy);
                 }
                 return $this->objCreatedByObject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ModifiedByObject':
             // Gets the value for the UserAccount object referenced by intModifiedBy
             // @return UserAccount
             try {
                 if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) {
                     $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy);
                 }
                 return $this->objModifiedByObject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'DepreciationClass':
             // Gets the value for the DepreciationClass object referenced by intDepreciationClassId
             // @return DepreciationClass
             try {
                 if (!$this->objDepreciationClass && !is_null($this->intDepreciationClassId)) {
                     $this->objDepreciationClass = DepreciationClass::Load($this->intDepreciationClassId);
                 }
                 return $this->objDepreciationClass;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'AssetModelCustomFieldHelper':
             // Gets the value for the AssetModelCustomFieldHelper object that uniquely references this AssetModel
             // by objAssetModelCustomFieldHelper (Unique)
             // @return AssetModelCustomFieldHelper
             try {
                 if ($this->objAssetModelCustomFieldHelper === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objAssetModelCustomFieldHelper) {
                     $this->objAssetModelCustomFieldHelper = AssetModelCustomFieldHelper::LoadByAssetModelId($this->intAssetModelId);
                 }
                 return $this->objAssetModelCustomFieldHelper;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             ////////////////////////////
             // Virtual Object References (Many to Many and Reverse References)
             // (If restored via a "Many-to" expansion)
             ////////////////////////////
         ////////////////////////////
         // Virtual Object References (Many to Many and Reverse References)
         // (If restored via a "Many-to" expansion)
         ////////////////////////////
         case '_Asset':
             // Gets the value for the private _objAsset (Read-Only)
             // if set due to an expansion on the asset.asset_model_id reverse relationship
             // @return Asset
             return $this->_objAsset;
         case '_AssetArray':
             // Gets the value for the private _objAssetArray (Read-Only)
             // if set due to an ExpandAsArray on the asset.asset_model_id reverse relationship
             // @return Asset[]
             return (array) $this->_objAssetArray;
         case '_AssetCustomFieldAssetModel':
             // Gets the value for the private _objAssetCustomFieldAssetModel (Read-Only)
             // if set due to an expansion on the asset_custom_field_asset_model.asset_model_id reverse relationship
             // @return AssetCustomFieldAssetModel
             return $this->_objAssetCustomFieldAssetModel;
         case '_AssetCustomFieldAssetModelArray':
             // Gets the value for the private _objAssetCustomFieldAssetModelArray (Read-Only)
             // if set due to an ExpandAsArray on the asset_custom_field_asset_model.asset_model_id reverse relationship
             // @return AssetCustomFieldAssetModel[]
             return (array) $this->_objAssetCustomFieldAssetModelArray;
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
 /**
  * Main utility method to aid with data binding.  It is used by the default BindAllRows() databinder but
  * could and should be used by any custom databind methods that would be used for instances of this
  * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. 
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  *
  * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself
  * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query		 
  * @return void
  */
 public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     // Setup input parameters to default values if none passed in
     if (!$objCondition) {
         $objCondition = QQ::All();
     }
     $objClauses = $objOptionalClauses ? $objOptionalClauses : array();
     // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = AssetModelCustomFieldHelper::QueryCount($objCondition, $objClauses);
     }
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from AssetModelCustomFieldHelper, given the clauses above
     $this->DataSource = AssetModelCustomFieldHelper::QueryArray($objCondition, $objClauses);
 }
 /**
  * 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;
     }
 }
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, AssetModelCustomFieldHelper::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }