protected function lstDefaultCustomFieldValue_Create()
 {
     $this->lstDefaultCustomFieldValue = new QListBox($this);
     $this->lstDefaultCustomFieldValue->Name = QApplication::Translate('Default Custom Field Value');
     $this->lstDefaultCustomFieldValue->AddItem(QApplication::Translate('- Select One -'), null);
     $objDefaultCustomFieldValueArray = CustomFieldValue::LoadAll();
     if ($objDefaultCustomFieldValueArray) {
         foreach ($objDefaultCustomFieldValueArray as $objDefaultCustomFieldValue) {
             $objListItem = new QListItem($objDefaultCustomFieldValue->__toString(), $objDefaultCustomFieldValue->CustomFieldValueId);
             if ($this->objCustomField->DefaultCustomFieldValue && $this->objCustomField->DefaultCustomFieldValue->CustomFieldValueId == $objDefaultCustomFieldValue->CustomFieldValueId) {
                 $objListItem->Selected = true;
             }
             $this->lstDefaultCustomFieldValue->AddItem($objListItem);
         }
     }
 }
 protected function dtgCustomFieldValue_Bind()
 {
     // Because we want to enable pagination AND sorting, we need to setup the $objClauses array to send to LoadAll()
     // Remember!  We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     $this->dtgCustomFieldValue->TotalItemCount = CustomFieldValue::CountAll();
     // Setup the $objClauses Array
     $objClauses = array();
     // 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->dtgCustomFieldValue->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->dtgCustomFieldValue->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be the array of all CustomFieldValue objects, given the clauses above
     $this->dtgCustomFieldValue->DataSource = CustomFieldValue::LoadAll($objClauses);
 }
 public function dtgCustomFieldValue_Bind()
 {
     // Get Total Count b/c of Pagination
     $this->dtgCustomFieldValue->TotalItemCount = CustomFieldValue::CountAll();
     $objClauses = array();
     if ($objClause = $this->dtgCustomFieldValue->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = $this->dtgCustomFieldValue->LimitClause) {
         array_push($objClauses, $objClause);
     }
     $this->dtgCustomFieldValue->DataSource = CustomFieldValue::LoadAll($objClauses);
 }
 /**
  * Refresh this MetaControl with Data from the local CustomField object.
  * @param boolean $blnReload reload CustomField from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objCustomField->Reload();
     }
     if ($this->lblCustomFieldId) {
         if ($this->blnEditMode) {
             $this->lblCustomFieldId->Text = $this->objCustomField->CustomFieldId;
         }
     }
     if ($this->lstCustomFieldQtype) {
         $this->lstCustomFieldQtype->SelectedValue = $this->objCustomField->CustomFieldQtypeId;
     }
     if ($this->lblCustomFieldQtypeId) {
         $this->lblCustomFieldQtypeId->Text = $this->objCustomField->CustomFieldQtypeId ? CustomFieldQtype::$NameArray[$this->objCustomField->CustomFieldQtypeId] : null;
     }
     if ($this->lstDefaultCustomFieldValue) {
         $this->lstDefaultCustomFieldValue->RemoveAllItems();
         $this->lstDefaultCustomFieldValue->AddItem(QApplication::Translate('- Select One -'), null);
         $objDefaultCustomFieldValueArray = CustomFieldValue::LoadAll();
         if ($objDefaultCustomFieldValueArray) {
             foreach ($objDefaultCustomFieldValueArray as $objDefaultCustomFieldValue) {
                 $objListItem = new QListItem($objDefaultCustomFieldValue->__toString(), $objDefaultCustomFieldValue->CustomFieldValueId);
                 if ($this->objCustomField->DefaultCustomFieldValue && $this->objCustomField->DefaultCustomFieldValue->CustomFieldValueId == $objDefaultCustomFieldValue->CustomFieldValueId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstDefaultCustomFieldValue->AddItem($objListItem);
             }
         }
     }
     if ($this->lblDefaultCustomFieldValueId) {
         $this->lblDefaultCustomFieldValueId->Text = $this->objCustomField->DefaultCustomFieldValue ? $this->objCustomField->DefaultCustomFieldValue->__toString() : null;
     }
     if ($this->txtShortDescription) {
         $this->txtShortDescription->Text = $this->objCustomField->ShortDescription;
     }
     if ($this->lblShortDescription) {
         $this->lblShortDescription->Text = $this->objCustomField->ShortDescription;
     }
     if ($this->chkActiveFlag) {
         $this->chkActiveFlag->Checked = $this->objCustomField->ActiveFlag;
     }
     if ($this->lblActiveFlag) {
         $this->lblActiveFlag->Text = $this->objCustomField->ActiveFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->chkRequiredFlag) {
         $this->chkRequiredFlag->Checked = $this->objCustomField->RequiredFlag;
     }
     if ($this->lblRequiredFlag) {
         $this->lblRequiredFlag->Text = $this->objCustomField->RequiredFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->chkAllAssetModelsFlag) {
         $this->chkAllAssetModelsFlag->Checked = $this->objCustomField->AllAssetModelsFlag;
     }
     if ($this->lblAllAssetModelsFlag) {
         $this->lblAllAssetModelsFlag->Text = $this->objCustomField->AllAssetModelsFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->chkSearchableFlag) {
         $this->chkSearchableFlag->Checked = $this->objCustomField->SearchableFlag;
     }
     if ($this->lblSearchableFlag) {
         $this->lblSearchableFlag->Text = $this->objCustomField->SearchableFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->lstCreatedByObject) {
         $this->lstCreatedByObject->RemoveAllItems();
         $this->lstCreatedByObject->AddItem(QApplication::Translate('- Select One -'), null);
         $objCreatedByObjectArray = UserAccount::LoadAll();
         if ($objCreatedByObjectArray) {
             foreach ($objCreatedByObjectArray as $objCreatedByObject) {
                 $objListItem = new QListItem($objCreatedByObject->__toString(), $objCreatedByObject->UserAccountId);
                 if ($this->objCustomField->CreatedByObject && $this->objCustomField->CreatedByObject->UserAccountId == $objCreatedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCreatedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCreatedBy) {
         $this->lblCreatedBy->Text = $this->objCustomField->CreatedByObject ? $this->objCustomField->CreatedByObject->__toString() : null;
     }
     if ($this->calCreationDate) {
         $this->calCreationDate->DateTime = $this->objCustomField->CreationDate;
     }
     if ($this->lblCreationDate) {
         $this->lblCreationDate->Text = sprintf($this->objCustomField->CreationDate) ? $this->objCustomField->__toString($this->strCreationDateDateTimeFormat) : null;
     }
     if ($this->lstModifiedByObject) {
         $this->lstModifiedByObject->RemoveAllItems();
         $this->lstModifiedByObject->AddItem(QApplication::Translate('- Select One -'), null);
         $objModifiedByObjectArray = UserAccount::LoadAll();
         if ($objModifiedByObjectArray) {
             foreach ($objModifiedByObjectArray as $objModifiedByObject) {
                 $objListItem = new QListItem($objModifiedByObject->__toString(), $objModifiedByObject->UserAccountId);
                 if ($this->objCustomField->ModifiedByObject && $this->objCustomField->ModifiedByObject->UserAccountId == $objModifiedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstModifiedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblModifiedBy) {
         $this->lblModifiedBy->Text = $this->objCustomField->ModifiedByObject ? $this->objCustomField->ModifiedByObject->__toString() : null;
     }
     if ($this->lblModifiedDate) {
         if ($this->blnEditMode) {
             $this->lblModifiedDate->Text = $this->objCustomField->ModifiedDate;
         }
     }
 }