protected function UpdateAddressFields()
 {
     $this->objAddress->CompanyId = $this->lstCompany->SelectedValue;
     $this->objAddress->ShortDescription = $this->txtShortDescription->Text;
     $this->objAddress->CountryId = $this->lstCountry->SelectedValue;
     $this->objAddress->Address1 = $this->txtAddress1->Text;
     $this->objAddress->Address2 = $this->txtAddress2->Text;
     $this->objAddress->City = $this->txtCity->Text;
     $this->objAddress->StateProvinceId = $this->lstStateProvince->SelectedValue;
     $this->objAddress->PostalCode = $this->txtPostalCode->Text;
     $this->objAddress->CreatedBy = $this->lstCreatedByObject->SelectedValue;
     $this->objAddress->CreationDate = $this->calCreationDate->DateTime;
     $this->objAddress->ModifiedBy = $this->lstModifiedByObject->SelectedValue;
     $this->objAddress->AddressCustomFieldHelper = AddressCustomFieldHelper::Load($this->lstAddressCustomFieldHelper->SelectedValue);
 }
 /**
  * Reload this AddressCustomFieldHelper 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 AddressCustomFieldHelper object.');
     }
     // Reload the Object
     $objReloaded = AddressCustomFieldHelper::Load($this->intAddressId);
     // Update $this's local variables to match
     $this->AddressId = $objReloaded->AddressId;
     $this->__intAddressId = $this->intAddressId;
 }
 /**
  * This will save this object's Address instance,
  * updating only the fields which have had a control created for it.
  */
 public function SaveAddress()
 {
     try {
         // Update any fields for controls that have been created
         if ($this->lstCompany) {
             $this->objAddress->CompanyId = $this->lstCompany->SelectedValue;
         }
         if ($this->txtShortDescription) {
             $this->objAddress->ShortDescription = $this->txtShortDescription->Text;
         }
         if ($this->lstCountry) {
             $this->objAddress->CountryId = $this->lstCountry->SelectedValue;
         }
         if ($this->txtAddress1) {
             $this->objAddress->Address1 = $this->txtAddress1->Text;
         }
         if ($this->txtAddress2) {
             $this->objAddress->Address2 = $this->txtAddress2->Text;
         }
         if ($this->txtCity) {
             $this->objAddress->City = $this->txtCity->Text;
         }
         if ($this->lstStateProvince) {
             $this->objAddress->StateProvinceId = $this->lstStateProvince->SelectedValue;
         }
         if ($this->txtPostalCode) {
             $this->objAddress->PostalCode = $this->txtPostalCode->Text;
         }
         if ($this->lstCreatedByObject) {
             $this->objAddress->CreatedBy = $this->lstCreatedByObject->SelectedValue;
         }
         if ($this->calCreationDate) {
             $this->objAddress->CreationDate = $this->calCreationDate->DateTime;
         }
         if ($this->lstModifiedByObject) {
             $this->objAddress->ModifiedBy = $this->lstModifiedByObject->SelectedValue;
         }
         // Update any UniqueReverseReferences (if any) for controls that have been created for it
         if ($this->lstAddressCustomFieldHelper) {
             $this->objAddress->AddressCustomFieldHelper = AddressCustomFieldHelper::Load($this->lstAddressCustomFieldHelper->SelectedValue);
         }
         // Save the Address object
         $this->objAddress->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 AddressCustomFieldHelperMetaControl
  * @param integer $intAddressId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing AddressCustomFieldHelper object creation - defaults to CreateOrEdit
  * @return AddressCustomFieldHelperMetaControl
  */
 public static function Create($objParentObject, $intAddressId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intAddressId)) {
         $objAddressCustomFieldHelper = AddressCustomFieldHelper::Load($intAddressId);
         // AddressCustomFieldHelper was found -- return it!
         if ($objAddressCustomFieldHelper) {
             return new AddressCustomFieldHelperMetaControl($objParentObject, $objAddressCustomFieldHelper);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a AddressCustomFieldHelper object with PK arguments: ' . $intAddressId);
             }
         }
         // 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 AddressCustomFieldHelperMetaControl($objParentObject, new AddressCustomFieldHelper());
 }