예제 #1
0
 protected function UpdateCompanyFields()
 {
     $this->objCompany->AddressId = $this->lstAddress->SelectedValue;
     $this->objCompany->ShortDescription = $this->txtShortDescription->Text;
     $this->objCompany->Website = $this->txtWebsite->Text;
     $this->objCompany->Telephone = $this->txtTelephone->Text;
     $this->objCompany->Fax = $this->txtFax->Text;
     $this->objCompany->Email = $this->txtEmail->Text;
     $this->objCompany->LongDescription = $this->txtLongDescription->Text;
     $this->objCompany->CreatedBy = $this->lstCreatedByObject->SelectedValue;
     $this->objCompany->CreationDate = $this->calCreationDate->DateTime;
     $this->objCompany->ModifiedBy = $this->lstModifiedByObject->SelectedValue;
     $this->objCompany->CompanyCustomFieldHelper = CompanyCustomFieldHelper::Load($this->lstCompanyCustomFieldHelper->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 CompanyCustomFieldHelperMetaControl
  * @param integer $intCompanyId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing CompanyCustomFieldHelper object creation - defaults to CreateOrEdit
  * @return CompanyCustomFieldHelperMetaControl
  */
 public static function Create($objParentObject, $intCompanyId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intCompanyId)) {
         $objCompanyCustomFieldHelper = CompanyCustomFieldHelper::Load($intCompanyId);
         // CompanyCustomFieldHelper was found -- return it!
         if ($objCompanyCustomFieldHelper) {
             return new CompanyCustomFieldHelperMetaControl($objParentObject, $objCompanyCustomFieldHelper);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a CompanyCustomFieldHelper object with PK arguments: ' . $intCompanyId);
             }
         }
         // 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 CompanyCustomFieldHelperMetaControl($objParentObject, new CompanyCustomFieldHelper());
 }
 /**
  * Reload this CompanyCustomFieldHelper from the database.
  * @return void
  */
 public function Reload()
 {
     // Make sure we are actually Restored from the database
     if (!$this->__blnRestored) {
         throw new QCallerException('Cannot call Reload() on a new, unsaved CompanyCustomFieldHelper object.');
     }
     // Reload the Object
     $objReloaded = CompanyCustomFieldHelper::Load($this->intCompanyId);
     // Update $this's local variables to match
     $this->CompanyId = $objReloaded->CompanyId;
     $this->__intCompanyId = $this->intCompanyId;
 }
 /**
  * This will save this object's Company instance,
  * updating only the fields which have had a control created for it.
  */
 public function SaveCompany()
 {
     try {
         // Update any fields for controls that have been created
         if ($this->lstAddress) {
             $this->objCompany->AddressId = $this->lstAddress->SelectedValue;
         }
         if ($this->txtShortDescription) {
             $this->objCompany->ShortDescription = $this->txtShortDescription->Text;
         }
         if ($this->txtWebsite) {
             $this->objCompany->Website = $this->txtWebsite->Text;
         }
         if ($this->txtTelephone) {
             $this->objCompany->Telephone = $this->txtTelephone->Text;
         }
         if ($this->txtFax) {
             $this->objCompany->Fax = $this->txtFax->Text;
         }
         if ($this->txtEmail) {
             $this->objCompany->Email = $this->txtEmail->Text;
         }
         if ($this->txtLongDescription) {
             $this->objCompany->LongDescription = $this->txtLongDescription->Text;
         }
         if ($this->lstCreatedByObject) {
             $this->objCompany->CreatedBy = $this->lstCreatedByObject->SelectedValue;
         }
         if ($this->calCreationDate) {
             $this->objCompany->CreationDate = $this->calCreationDate->DateTime;
         }
         if ($this->lstModifiedByObject) {
             $this->objCompany->ModifiedBy = $this->lstModifiedByObject->SelectedValue;
         }
         // Update any UniqueReverseReferences (if any) for controls that have been created for it
         if ($this->lstCompanyCustomFieldHelper) {
             $this->objCompany->CompanyCustomFieldHelper = CompanyCustomFieldHelper::Load($this->lstCompanyCustomFieldHelper->SelectedValue);
         }
         // Save the Company object
         $this->objCompany->Save();
         // Finally, update any ManyToManyReferences (if any)
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }