public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, AssetCustomFieldHelper::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
예제 #2
0
 protected function UpdateAssetFields()
 {
     $this->objAsset->ParentAssetId = $this->lstParentAsset->SelectedValue;
     $this->objAsset->AssetModelId = $this->lstAssetModel->SelectedValue;
     $this->objAsset->LocationId = $this->lstLocation->SelectedValue;
     $this->objAsset->AssetCode = $this->txtAssetCode->Text;
     $this->objAsset->ImagePath = $this->txtImagePath->Text;
     $this->objAsset->CheckedOutFlag = $this->chkCheckedOutFlag->Checked;
     $this->objAsset->ReservedFlag = $this->chkReservedFlag->Checked;
     $this->objAsset->LinkedFlag = $this->chkLinkedFlag->Checked;
     $this->objAsset->ArchivedFlag = $this->chkArchivedFlag->Checked;
     $this->objAsset->CreatedBy = $this->lstCreatedByObject->SelectedValue;
     $this->objAsset->CreationDate = $this->calCreationDate->DateTime;
     $this->objAsset->ModifiedBy = $this->lstModifiedByObject->SelectedValue;
     $this->objAsset->AssetCustomFieldHelper = AssetCustomFieldHelper::Load($this->lstAssetCustomFieldHelper->SelectedValue);
 }
 /**
  * This will save this object's Asset instance,
  * updating only the fields which have had a control created for it.
  */
 public function SaveAsset()
 {
     try {
         // Update any fields for controls that have been created
         if ($this->lstParentAsset) {
             $this->objAsset->ParentAssetId = $this->lstParentAsset->SelectedValue;
         }
         if ($this->lstAssetModel) {
             $this->objAsset->AssetModelId = $this->lstAssetModel->SelectedValue;
         }
         if ($this->lstLocation) {
             $this->objAsset->LocationId = $this->lstLocation->SelectedValue;
         }
         if ($this->txtAssetCode) {
             $this->objAsset->AssetCode = $this->txtAssetCode->Text;
         }
         if ($this->txtImagePath) {
             $this->objAsset->ImagePath = $this->txtImagePath->Text;
         }
         if ($this->chkCheckedOutFlag) {
             $this->objAsset->CheckedOutFlag = $this->chkCheckedOutFlag->Checked;
         }
         if ($this->chkReservedFlag) {
             $this->objAsset->ReservedFlag = $this->chkReservedFlag->Checked;
         }
         if ($this->chkLinkedFlag) {
             $this->objAsset->LinkedFlag = $this->chkLinkedFlag->Checked;
         }
         if ($this->chkArchivedFlag) {
             $this->objAsset->ArchivedFlag = $this->chkArchivedFlag->Checked;
         }
         if ($this->lstCreatedByObject) {
             $this->objAsset->CreatedBy = $this->lstCreatedByObject->SelectedValue;
         }
         if ($this->calCreationDate) {
             $this->objAsset->CreationDate = $this->calCreationDate->DateTime;
         }
         if ($this->lstModifiedByObject) {
             $this->objAsset->ModifiedBy = $this->lstModifiedByObject->SelectedValue;
         }
         if ($this->chkDepreciationFlag) {
             $this->objAsset->DepreciationFlag = $this->chkDepreciationFlag->Checked;
         }
         if ($this->calPurchaseDate) {
             $this->objAsset->PurchaseDate = $this->calPurchaseDate->DateTime;
         }
         if ($this->txtPurchaseCost) {
             $this->objAsset->PurchaseCost = $this->txtPurchaseCost->Text;
         }
         // Update any UniqueReverseReferences (if any) for controls that have been created for it
         if ($this->lstAssetCustomFieldHelper) {
             $this->objAsset->AssetCustomFieldHelper = AssetCustomFieldHelper::Load($this->lstAssetCustomFieldHelper->SelectedValue);
         }
         // Save the Asset object
         $this->objAsset->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 AssetCustomFieldHelperMetaControl
  * @param integer $intAssetId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing AssetCustomFieldHelper object creation - defaults to CreateOrEdit
  * @return AssetCustomFieldHelperMetaControl
  */
 public static function Create($objParentObject, $intAssetId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intAssetId)) {
         $objAssetCustomFieldHelper = AssetCustomFieldHelper::Load($intAssetId);
         // AssetCustomFieldHelper was found -- return it!
         if ($objAssetCustomFieldHelper) {
             return new AssetCustomFieldHelperMetaControl($objParentObject, $objAssetCustomFieldHelper);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a AssetCustomFieldHelper object with PK arguments: ' . $intAssetId);
             }
         }
         // 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 AssetCustomFieldHelperMetaControl($objParentObject, new AssetCustomFieldHelper());
 }
 /**
  * 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 = AssetCustomFieldHelper::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 AssetCustomFieldHelper, given the clauses above
     $this->DataSource = AssetCustomFieldHelper::QueryArray($objCondition, $objClauses);
 }
예제 #6
0
 /**
  * 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 'AssetId':
             // Gets the value for intAssetId (Read-Only PK)
             // @return integer
             return $this->intAssetId;
         case 'ParentAssetId':
             // Gets the value for intParentAssetId
             // @return integer
             return $this->intParentAssetId;
         case 'AssetModelId':
             // Gets the value for intAssetModelId (Not Null)
             // @return integer
             return $this->intAssetModelId;
         case 'LocationId':
             // Gets the value for intLocationId
             // @return integer
             return $this->intLocationId;
         case 'AssetCode':
             // Gets the value for strAssetCode (Unique)
             // @return string
             return $this->strAssetCode;
         case 'ImagePath':
             // Gets the value for strImagePath
             // @return string
             return $this->strImagePath;
         case 'CheckedOutFlag':
             // Gets the value for blnCheckedOutFlag
             // @return boolean
             return $this->blnCheckedOutFlag;
         case 'ReservedFlag':
             // Gets the value for blnReservedFlag
             // @return boolean
             return $this->blnReservedFlag;
         case 'LinkedFlag':
             // Gets the value for blnLinkedFlag
             // @return boolean
             return $this->blnLinkedFlag;
         case 'ArchivedFlag':
             // Gets the value for blnArchivedFlag
             // @return boolean
             return $this->blnArchivedFlag;
         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 'DepreciationFlag':
             // Gets the value for blnDepreciationFlag
             // @return boolean
             return $this->blnDepreciationFlag;
         case 'PurchaseDate':
             // Gets the value for dttPurchaseDate
             // @return QDateTime
             return $this->dttPurchaseDate;
         case 'PurchaseCost':
             // Gets the value for fltPurchaseCost
             // @return double
             return $this->fltPurchaseCost;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'ParentAsset':
             // Gets the value for the Asset object referenced by intParentAssetId
             // @return Asset
             try {
                 if (!$this->objParentAsset && !is_null($this->intParentAssetId)) {
                     $this->objParentAsset = Asset::Load($this->intParentAssetId);
                 }
                 return $this->objParentAsset;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'AssetModel':
             // Gets the value for the AssetModel object referenced by intAssetModelId (Not Null)
             // @return AssetModel
             try {
                 if (!$this->objAssetModel && !is_null($this->intAssetModelId)) {
                     $this->objAssetModel = AssetModel::Load($this->intAssetModelId);
                 }
                 return $this->objAssetModel;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Location':
             // Gets the value for the Location object referenced by intLocationId
             // @return Location
             try {
                 if (!$this->objLocation && !is_null($this->intLocationId)) {
                     $this->objLocation = Location::Load($this->intLocationId);
                 }
                 return $this->objLocation;
             } 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 'AssetCustomFieldHelper':
             // Gets the value for the AssetCustomFieldHelper object that uniquely references this Asset
             // by objAssetCustomFieldHelper (Unique)
             // @return AssetCustomFieldHelper
             try {
                 if ($this->objAssetCustomFieldHelper === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objAssetCustomFieldHelper) {
                     $this->objAssetCustomFieldHelper = AssetCustomFieldHelper::LoadByAssetId($this->intAssetId);
                 }
                 return $this->objAssetCustomFieldHelper;
             } 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 '_ChildAsset':
             // Gets the value for the private _objChildAsset (Read-Only)
             // if set due to an expansion on the asset.parent_asset_id reverse relationship
             // @return Asset
             return $this->_objChildAsset;
         case '_ChildAssetArray':
             // Gets the value for the private _objChildAssetArray (Read-Only)
             // if set due to an ExpandAsArray on the asset.parent_asset_id reverse relationship
             // @return Asset[]
             return (array) $this->_objChildAssetArray;
         case '_AssetTransaction':
             // Gets the value for the private _objAssetTransaction (Read-Only)
             // if set due to an expansion on the asset_transaction.asset_id reverse relationship
             // @return AssetTransaction
             return $this->_objAssetTransaction;
         case '_AssetTransactionArray':
             // Gets the value for the private _objAssetTransactionArray (Read-Only)
             // if set due to an ExpandAsArray on the asset_transaction.asset_id reverse relationship
             // @return AssetTransaction[]
             return (array) $this->_objAssetTransactionArray;
         case '_AssetTransactionAsNew':
             // Gets the value for the private _objAssetTransactionAsNew (Read-Only)
             // if set due to an expansion on the asset_transaction.new_asset_id reverse relationship
             // @return AssetTransaction
             return $this->_objAssetTransactionAsNew;
         case '_AssetTransactionAsNewArray':
             // Gets the value for the private _objAssetTransactionAsNewArray (Read-Only)
             // if set due to an ExpandAsArray on the asset_transaction.new_asset_id reverse relationship
             // @return AssetTransaction[]
             return (array) $this->_objAssetTransactionAsNewArray;
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }