Exemplo n.º 1
0
 protected function lstCompanyCustomFieldHelper_Create()
 {
     $this->lstCompanyCustomFieldHelper = new QListBox($this);
     $this->lstCompanyCustomFieldHelper->Name = QApplication::Translate('Company Custom Field Helper');
     $this->lstCompanyCustomFieldHelper->AddItem(QApplication::Translate('- Select One -'), null);
     $objCompanyCustomFieldHelperArray = CompanyCustomFieldHelper::LoadAll();
     if ($objCompanyCustomFieldHelperArray) {
         foreach ($objCompanyCustomFieldHelperArray as $objCompanyCustomFieldHelper) {
             $objListItem = new QListItem($objCompanyCustomFieldHelper->__toString(), $objCompanyCustomFieldHelper->CompanyId);
             if ($objCompanyCustomFieldHelper->CompanyId == $this->objCompany->CompanyId) {
                 $objListItem->Selected = true;
             }
             $this->lstCompanyCustomFieldHelper->AddItem($objListItem);
         }
     }
     // Because CompanyCustomFieldHelper's CompanyCustomFieldHelper is not null, if a value is already selected, it cannot be changed.
     if ($this->lstCompanyCustomFieldHelper->SelectedValue) {
         $this->lstCompanyCustomFieldHelper->Enabled = false;
     }
 }
 /**
  * Refresh this MetaControl with Data from the local Company object.
  * @param boolean $blnReload reload Company from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objCompany->Reload();
     }
     if ($this->lblCompanyId) {
         if ($this->blnEditMode) {
             $this->lblCompanyId->Text = $this->objCompany->CompanyId;
         }
     }
     if ($this->lstAddress) {
         $this->lstAddress->RemoveAllItems();
         $this->lstAddress->AddItem(QApplication::Translate('- Select One -'), null);
         $objAddressArray = Address::LoadAll();
         if ($objAddressArray) {
             foreach ($objAddressArray as $objAddress) {
                 $objListItem = new QListItem($objAddress->__toString(), $objAddress->AddressId);
                 if ($this->objCompany->Address && $this->objCompany->Address->AddressId == $objAddress->AddressId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstAddress->AddItem($objListItem);
             }
         }
     }
     if ($this->lblAddressId) {
         $this->lblAddressId->Text = $this->objCompany->Address ? $this->objCompany->Address->__toString() : null;
     }
     if ($this->txtShortDescription) {
         $this->txtShortDescription->Text = $this->objCompany->ShortDescription;
     }
     if ($this->lblShortDescription) {
         $this->lblShortDescription->Text = $this->objCompany->ShortDescription;
     }
     if ($this->txtWebsite) {
         $this->txtWebsite->Text = $this->objCompany->Website;
     }
     if ($this->lblWebsite) {
         $this->lblWebsite->Text = $this->objCompany->Website;
     }
     if ($this->txtTelephone) {
         $this->txtTelephone->Text = $this->objCompany->Telephone;
     }
     if ($this->lblTelephone) {
         $this->lblTelephone->Text = $this->objCompany->Telephone;
     }
     if ($this->txtFax) {
         $this->txtFax->Text = $this->objCompany->Fax;
     }
     if ($this->lblFax) {
         $this->lblFax->Text = $this->objCompany->Fax;
     }
     if ($this->txtEmail) {
         $this->txtEmail->Text = $this->objCompany->Email;
     }
     if ($this->lblEmail) {
         $this->lblEmail->Text = $this->objCompany->Email;
     }
     if ($this->txtLongDescription) {
         $this->txtLongDescription->Text = $this->objCompany->LongDescription;
     }
     if ($this->lblLongDescription) {
         $this->lblLongDescription->Text = $this->objCompany->LongDescription;
     }
     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->objCompany->CreatedByObject && $this->objCompany->CreatedByObject->UserAccountId == $objCreatedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCreatedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCreatedBy) {
         $this->lblCreatedBy->Text = $this->objCompany->CreatedByObject ? $this->objCompany->CreatedByObject->__toString() : null;
     }
     if ($this->calCreationDate) {
         $this->calCreationDate->DateTime = $this->objCompany->CreationDate;
     }
     if ($this->lblCreationDate) {
         $this->lblCreationDate->Text = sprintf($this->objCompany->CreationDate) ? $this->objCompany->__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->objCompany->ModifiedByObject && $this->objCompany->ModifiedByObject->UserAccountId == $objModifiedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstModifiedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblModifiedBy) {
         $this->lblModifiedBy->Text = $this->objCompany->ModifiedByObject ? $this->objCompany->ModifiedByObject->__toString() : null;
     }
     if ($this->lblModifiedDate) {
         if ($this->blnEditMode) {
             $this->lblModifiedDate->Text = $this->objCompany->ModifiedDate;
         }
     }
     if ($this->lstCompanyCustomFieldHelper) {
         $this->lstCompanyCustomFieldHelper->RemoveAllItems();
         $this->lstCompanyCustomFieldHelper->AddItem(QApplication::Translate('- Select One -'), null);
         $objCompanyCustomFieldHelperArray = CompanyCustomFieldHelper::LoadAll();
         if ($objCompanyCustomFieldHelperArray) {
             foreach ($objCompanyCustomFieldHelperArray as $objCompanyCustomFieldHelper) {
                 $objListItem = new QListItem($objCompanyCustomFieldHelper->__toString(), $objCompanyCustomFieldHelper->CompanyId);
                 if ($objCompanyCustomFieldHelper->CompanyId == $this->objCompany->CompanyId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCompanyCustomFieldHelper->AddItem($objListItem);
             }
         }
         // Because CompanyCustomFieldHelper's CompanyCustomFieldHelper is not null, if a value is already selected, it cannot be changed.
         if ($this->lstCompanyCustomFieldHelper->SelectedValue) {
             $this->lstCompanyCustomFieldHelper->Enabled = false;
         } else {
             $this->lstCompanyCustomFieldHelper->Enabled = true;
         }
     }
     if ($this->lblCompanyCustomFieldHelper) {
         $this->lblCompanyCustomFieldHelper->Text = $this->objCompany->CompanyCustomFieldHelper ? $this->objCompany->CompanyCustomFieldHelper->__toString() : null;
     }
 }