protected function lstInventoryModelCustomFieldHelper_Create() { $this->lstInventoryModelCustomFieldHelper = new QListBox($this); $this->lstInventoryModelCustomFieldHelper->Name = QApplication::Translate('Inventory Model Custom Field Helper'); $this->lstInventoryModelCustomFieldHelper->AddItem(QApplication::Translate('- Select One -'), null); $objInventoryModelCustomFieldHelperArray = InventoryModelCustomFieldHelper::LoadAll(); if ($objInventoryModelCustomFieldHelperArray) { foreach ($objInventoryModelCustomFieldHelperArray as $objInventoryModelCustomFieldHelper) { $objListItem = new QListItem($objInventoryModelCustomFieldHelper->__toString(), $objInventoryModelCustomFieldHelper->InventoryModelId); if ($objInventoryModelCustomFieldHelper->InventoryModelId == $this->objInventoryModel->InventoryModelId) { $objListItem->Selected = true; } $this->lstInventoryModelCustomFieldHelper->AddItem($objListItem); } } // Because InventoryModelCustomFieldHelper's InventoryModelCustomFieldHelper is not null, if a value is already selected, it cannot be changed. if ($this->lstInventoryModelCustomFieldHelper->SelectedValue) { $this->lstInventoryModelCustomFieldHelper->Enabled = false; } }
/** * Refresh this MetaControl with Data from the local InventoryModel object. * @param boolean $blnReload reload InventoryModel from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objInventoryModel->Reload(); } if ($this->lblInventoryModelId) { if ($this->blnEditMode) { $this->lblInventoryModelId->Text = $this->objInventoryModel->InventoryModelId; } } if ($this->lstCategory) { $this->lstCategory->RemoveAllItems(); $this->lstCategory->AddItem(QApplication::Translate('- Select One -'), null); $objCategoryArray = Category::LoadAll(); if ($objCategoryArray) { foreach ($objCategoryArray as $objCategory) { $objListItem = new QListItem($objCategory->__toString(), $objCategory->CategoryId); if ($this->objInventoryModel->Category && $this->objInventoryModel->Category->CategoryId == $objCategory->CategoryId) { $objListItem->Selected = true; } $this->lstCategory->AddItem($objListItem); } } } if ($this->lblCategoryId) { $this->lblCategoryId->Text = $this->objInventoryModel->Category ? $this->objInventoryModel->Category->__toString() : null; } if ($this->lstManufacturer) { $this->lstManufacturer->RemoveAllItems(); $this->lstManufacturer->AddItem(QApplication::Translate('- Select One -'), null); $objManufacturerArray = Manufacturer::LoadAll(); if ($objManufacturerArray) { foreach ($objManufacturerArray as $objManufacturer) { $objListItem = new QListItem($objManufacturer->__toString(), $objManufacturer->ManufacturerId); if ($this->objInventoryModel->Manufacturer && $this->objInventoryModel->Manufacturer->ManufacturerId == $objManufacturer->ManufacturerId) { $objListItem->Selected = true; } $this->lstManufacturer->AddItem($objListItem); } } } if ($this->lblManufacturerId) { $this->lblManufacturerId->Text = $this->objInventoryModel->Manufacturer ? $this->objInventoryModel->Manufacturer->__toString() : null; } if ($this->txtInventoryModelCode) { $this->txtInventoryModelCode->Text = $this->objInventoryModel->InventoryModelCode; } if ($this->lblInventoryModelCode) { $this->lblInventoryModelCode->Text = $this->objInventoryModel->InventoryModelCode; } if ($this->txtShortDescription) { $this->txtShortDescription->Text = $this->objInventoryModel->ShortDescription; } if ($this->lblShortDescription) { $this->lblShortDescription->Text = $this->objInventoryModel->ShortDescription; } if ($this->txtLongDescription) { $this->txtLongDescription->Text = $this->objInventoryModel->LongDescription; } if ($this->lblLongDescription) { $this->lblLongDescription->Text = $this->objInventoryModel->LongDescription; } if ($this->txtImagePath) { $this->txtImagePath->Text = $this->objInventoryModel->ImagePath; } if ($this->lblImagePath) { $this->lblImagePath->Text = $this->objInventoryModel->ImagePath; } if ($this->txtPrice) { $this->txtPrice->Text = $this->objInventoryModel->Price; } if ($this->lblPrice) { $this->lblPrice->Text = $this->objInventoryModel->Price; } 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->objInventoryModel->CreatedByObject && $this->objInventoryModel->CreatedByObject->UserAccountId == $objCreatedByObject->UserAccountId) { $objListItem->Selected = true; } $this->lstCreatedByObject->AddItem($objListItem); } } } if ($this->lblCreatedBy) { $this->lblCreatedBy->Text = $this->objInventoryModel->CreatedByObject ? $this->objInventoryModel->CreatedByObject->__toString() : null; } if ($this->calCreationDate) { $this->calCreationDate->DateTime = $this->objInventoryModel->CreationDate; } if ($this->lblCreationDate) { $this->lblCreationDate->Text = sprintf($this->objInventoryModel->CreationDate) ? $this->objInventoryModel->__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->objInventoryModel->ModifiedByObject && $this->objInventoryModel->ModifiedByObject->UserAccountId == $objModifiedByObject->UserAccountId) { $objListItem->Selected = true; } $this->lstModifiedByObject->AddItem($objListItem); } } } if ($this->lblModifiedBy) { $this->lblModifiedBy->Text = $this->objInventoryModel->ModifiedByObject ? $this->objInventoryModel->ModifiedByObject->__toString() : null; } if ($this->lblModifiedDate) { if ($this->blnEditMode) { $this->lblModifiedDate->Text = $this->objInventoryModel->ModifiedDate; } } if ($this->lstInventoryModelCustomFieldHelper) { $this->lstInventoryModelCustomFieldHelper->RemoveAllItems(); $this->lstInventoryModelCustomFieldHelper->AddItem(QApplication::Translate('- Select One -'), null); $objInventoryModelCustomFieldHelperArray = InventoryModelCustomFieldHelper::LoadAll(); if ($objInventoryModelCustomFieldHelperArray) { foreach ($objInventoryModelCustomFieldHelperArray as $objInventoryModelCustomFieldHelper) { $objListItem = new QListItem($objInventoryModelCustomFieldHelper->__toString(), $objInventoryModelCustomFieldHelper->InventoryModelId); if ($objInventoryModelCustomFieldHelper->InventoryModelId == $this->objInventoryModel->InventoryModelId) { $objListItem->Selected = true; } $this->lstInventoryModelCustomFieldHelper->AddItem($objListItem); } } // Because InventoryModelCustomFieldHelper's InventoryModelCustomFieldHelper is not null, if a value is already selected, it cannot be changed. if ($this->lstInventoryModelCustomFieldHelper->SelectedValue) { $this->lstInventoryModelCustomFieldHelper->Enabled = false; } else { $this->lstInventoryModelCustomFieldHelper->Enabled = true; } } if ($this->lblInventoryModelCustomFieldHelper) { $this->lblInventoryModelCustomFieldHelper->Text = $this->objInventoryModel->InventoryModelCustomFieldHelper ? $this->objInventoryModel->InventoryModelCustomFieldHelper->__toString() : null; } }