Ejemplo n.º 1
0
 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);
 }
 /**
  * Main utility method to aid with data binding.  It is used by the default BindAllRows() databinder but
  * could and should be used by any custom databind methods that would be used for instances of this
  * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. 
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  *
  * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself
  * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query		 
  * @return void
  */
 public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     // Setup input parameters to default values if none passed in
     if (!$objCondition) {
         $objCondition = QQ::All();
     }
     $objClauses = $objOptionalClauses ? $objOptionalClauses : array();
     // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = AddressCustomFieldHelper::QueryCount($objCondition, $objClauses);
     }
     // 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->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from AddressCustomFieldHelper, given the clauses above
     $this->DataSource = AddressCustomFieldHelper::QueryArray($objCondition, $objClauses);
 }
 /**
  * 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;
     }
 }
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, AddressCustomFieldHelper::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
Ejemplo n.º 5
0
 /**
  * Override method to perform a property "Get"
  * This will get the value of $strName
  *
  * @param string $strName Name of the property to get
  * @return mixed
  */
 public function __get($strName)
 {
     switch ($strName) {
         ///////////////////
         // Member Variables
         ///////////////////
         case 'AddressId':
             // Gets the value for intAddressId (Read-Only PK)
             // @return integer
             return $this->intAddressId;
         case 'CompanyId':
             // Gets the value for intCompanyId (Not Null)
             // @return integer
             return $this->intCompanyId;
         case 'ShortDescription':
             // Gets the value for strShortDescription (Not Null)
             // @return string
             return $this->strShortDescription;
         case 'CountryId':
             // Gets the value for intCountryId (Not Null)
             // @return integer
             return $this->intCountryId;
         case 'Address1':
             // Gets the value for strAddress1 (Not Null)
             // @return string
             return $this->strAddress1;
         case 'Address2':
             // Gets the value for strAddress2
             // @return string
             return $this->strAddress2;
         case 'City':
             // Gets the value for strCity (Not Null)
             // @return string
             return $this->strCity;
         case 'StateProvinceId':
             // Gets the value for intStateProvinceId
             // @return integer
             return $this->intStateProvinceId;
         case 'PostalCode':
             // Gets the value for strPostalCode (Not Null)
             // @return string
             return $this->strPostalCode;
         case 'CreatedBy':
             // Gets the value for intCreatedBy
             // @return integer
             return $this->intCreatedBy;
         case 'CreationDate':
             // Gets the value for dttCreationDate
             // @return QDateTime
             return $this->dttCreationDate;
         case 'ModifiedBy':
             // Gets the value for intModifiedBy
             // @return integer
             return $this->intModifiedBy;
         case 'ModifiedDate':
             // Gets the value for strModifiedDate (Read-Only Timestamp)
             // @return string
             return $this->strModifiedDate;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Company':
             // Gets the value for the Company object referenced by intCompanyId (Not Null)
             // @return Company
             try {
                 if (!$this->objCompany && !is_null($this->intCompanyId)) {
                     $this->objCompany = Company::Load($this->intCompanyId);
                 }
                 return $this->objCompany;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Country':
             // Gets the value for the Country object referenced by intCountryId (Not Null)
             // @return Country
             try {
                 if (!$this->objCountry && !is_null($this->intCountryId)) {
                     $this->objCountry = Country::Load($this->intCountryId);
                 }
                 return $this->objCountry;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'StateProvince':
             // Gets the value for the StateProvince object referenced by intStateProvinceId
             // @return StateProvince
             try {
                 if (!$this->objStateProvince && !is_null($this->intStateProvinceId)) {
                     $this->objStateProvince = StateProvince::Load($this->intStateProvinceId);
                 }
                 return $this->objStateProvince;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CreatedByObject':
             // Gets the value for the UserAccount object referenced by intCreatedBy
             // @return UserAccount
             try {
                 if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) {
                     $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy);
                 }
                 return $this->objCreatedByObject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ModifiedByObject':
             // Gets the value for the UserAccount object referenced by intModifiedBy
             // @return UserAccount
             try {
                 if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) {
                     $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy);
                 }
                 return $this->objModifiedByObject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'AddressCustomFieldHelper':
             // Gets the value for the AddressCustomFieldHelper object that uniquely references this Address
             // by objAddressCustomFieldHelper (Unique)
             // @return AddressCustomFieldHelper
             try {
                 if ($this->objAddressCustomFieldHelper === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objAddressCustomFieldHelper) {
                     $this->objAddressCustomFieldHelper = AddressCustomFieldHelper::LoadByAddressId($this->intAddressId);
                 }
                 return $this->objAddressCustomFieldHelper;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             ////////////////////////////
             // Virtual Object References (Many to Many and Reverse References)
             // (If restored via a "Many-to" expansion)
             ////////////////////////////
         ////////////////////////////
         // Virtual Object References (Many to Many and Reverse References)
         // (If restored via a "Many-to" expansion)
         ////////////////////////////
         case '_Company':
             // Gets the value for the private _objCompany (Read-Only)
             // if set due to an expansion on the company.address_id reverse relationship
             // @return Company
             return $this->_objCompany;
         case '_CompanyArray':
             // Gets the value for the private _objCompanyArray (Read-Only)
             // if set due to an ExpandAsArray on the company.address_id reverse relationship
             // @return Company[]
             return (array) $this->_objCompanyArray;
         case '_Contact':
             // Gets the value for the private _objContact (Read-Only)
             // if set due to an expansion on the contact.address_id reverse relationship
             // @return Contact
             return $this->_objContact;
         case '_ContactArray':
             // Gets the value for the private _objContactArray (Read-Only)
             // if set due to an ExpandAsArray on the contact.address_id reverse relationship
             // @return Contact[]
             return (array) $this->_objContactArray;
         case '_ReceiptAsTo':
             // Gets the value for the private _objReceiptAsTo (Read-Only)
             // if set due to an expansion on the receipt.to_address_id reverse relationship
             // @return Receipt
             return $this->_objReceiptAsTo;
         case '_ReceiptAsToArray':
             // Gets the value for the private _objReceiptAsToArray (Read-Only)
             // if set due to an ExpandAsArray on the receipt.to_address_id reverse relationship
             // @return Receipt[]
             return (array) $this->_objReceiptAsToArray;
         case '_ShipmentAsFrom':
             // Gets the value for the private _objShipmentAsFrom (Read-Only)
             // if set due to an expansion on the shipment.from_address_id reverse relationship
             // @return Shipment
             return $this->_objShipmentAsFrom;
         case '_ShipmentAsFromArray':
             // Gets the value for the private _objShipmentAsFromArray (Read-Only)
             // if set due to an ExpandAsArray on the shipment.from_address_id reverse relationship
             // @return Shipment[]
             return (array) $this->_objShipmentAsFromArray;
         case '_ShipmentAsTo':
             // Gets the value for the private _objShipmentAsTo (Read-Only)
             // if set due to an expansion on the shipment.to_address_id reverse relationship
             // @return Shipment
             return $this->_objShipmentAsTo;
         case '_ShipmentAsToArray':
             // Gets the value for the private _objShipmentAsToArray (Read-Only)
             // if set due to an ExpandAsArray on the shipment.to_address_id reverse relationship
             // @return Shipment[]
             return (array) $this->_objShipmentAsToArray;
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } 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());
 }