/** * This will save this object's Shipment instance, * updating only the fields which have had a control created for it. */ public function SaveShipment() { try { // Update any fields for controls that have been created if ($this->txtShipmentNumber) { $this->objShipment->ShipmentNumber = $this->txtShipmentNumber->Text; } if ($this->lstTransaction) { $this->objShipment->TransactionId = $this->lstTransaction->SelectedValue; } if ($this->lstFromCompany) { $this->objShipment->FromCompanyId = $this->lstFromCompany->SelectedValue; } if ($this->lstFromContact) { $this->objShipment->FromContactId = $this->lstFromContact->SelectedValue; } if ($this->lstFromAddress) { $this->objShipment->FromAddressId = $this->lstFromAddress->SelectedValue; } if ($this->lstToCompany) { $this->objShipment->ToCompanyId = $this->lstToCompany->SelectedValue; } if ($this->lstToContact) { $this->objShipment->ToContactId = $this->lstToContact->SelectedValue; } if ($this->lstToAddress) { $this->objShipment->ToAddressId = $this->lstToAddress->SelectedValue; } if ($this->lstCourier) { $this->objShipment->CourierId = $this->lstCourier->SelectedValue; } if ($this->txtTrackingNumber) { $this->objShipment->TrackingNumber = $this->txtTrackingNumber->Text; } if ($this->calShipDate) { $this->objShipment->ShipDate = $this->calShipDate->DateTime; } if ($this->chkShippedFlag) { $this->objShipment->ShippedFlag = $this->chkShippedFlag->Checked; } if ($this->lstCreatedByObject) { $this->objShipment->CreatedBy = $this->lstCreatedByObject->SelectedValue; } if ($this->calCreationDate) { $this->objShipment->CreationDate = $this->calCreationDate->DateTime; } if ($this->lstModifiedByObject) { $this->objShipment->ModifiedBy = $this->lstModifiedByObject->SelectedValue; } // Update any UniqueReverseReferences (if any) for controls that have been created for it if ($this->lstShipmentCustomFieldHelper) { $this->objShipment->ShipmentCustomFieldHelper = ShipmentCustomFieldHelper::Load($this->lstShipmentCustomFieldHelper->SelectedValue); } // Save the Shipment object $this->objShipment->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 ShipmentCustomFieldHelperMetaControl * @param integer $intShipmentId primary key value * @param QMetaControlCreateType $intCreateType rules governing ShipmentCustomFieldHelper object creation - defaults to CreateOrEdit * @return ShipmentCustomFieldHelperMetaControl */ public static function Create($objParentObject, $intShipmentId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intShipmentId)) { $objShipmentCustomFieldHelper = ShipmentCustomFieldHelper::Load($intShipmentId); // ShipmentCustomFieldHelper was found -- return it! if ($objShipmentCustomFieldHelper) { return new ShipmentCustomFieldHelperMetaControl($objParentObject, $objShipmentCustomFieldHelper); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a ShipmentCustomFieldHelper object with PK arguments: ' . $intShipmentId); } } // 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 ShipmentCustomFieldHelperMetaControl($objParentObject, new ShipmentCustomFieldHelper()); }
protected function UpdateShipmentFields() { $this->objShipment->ShipmentNumber = $this->txtShipmentNumber->Text; $this->objShipment->TransactionId = $this->lstTransaction->SelectedValue; $this->objShipment->FromCompanyId = $this->lstFromCompany->SelectedValue; $this->objShipment->FromContactId = $this->lstFromContact->SelectedValue; $this->objShipment->FromAddressId = $this->lstFromAddress->SelectedValue; $this->objShipment->ToCompanyId = $this->lstToCompany->SelectedValue; $this->objShipment->ToContactId = $this->lstToContact->SelectedValue; $this->objShipment->ToAddressId = $this->lstToAddress->SelectedValue; $this->objShipment->CourierId = $this->lstCourier->SelectedValue; $this->objShipment->TrackingNumber = $this->txtTrackingNumber->Text; $this->objShipment->ShipDate = $this->calShipDate->DateTime; $this->objShipment->ShippedFlag = $this->chkShippedFlag->Checked; $this->objShipment->CreatedBy = $this->lstCreatedByObject->SelectedValue; $this->objShipment->CreationDate = $this->calCreationDate->DateTime; $this->objShipment->ModifiedBy = $this->lstModifiedByObject->SelectedValue; $this->objShipment->ShipmentCustomFieldHelper = ShipmentCustomFieldHelper::Load($this->lstShipmentCustomFieldHelper->SelectedValue); }
/** * 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 'ShipmentId': // Gets the value for intShipmentId (Read-Only PK) // @return integer return $this->intShipmentId; case 'ShipmentNumber': // Gets the value for strShipmentNumber (Unique) // @return string return $this->strShipmentNumber; case 'TransactionId': // Gets the value for intTransactionId (Unique) // @return integer return $this->intTransactionId; case 'FromCompanyId': // Gets the value for intFromCompanyId (Not Null) // @return integer return $this->intFromCompanyId; case 'FromContactId': // Gets the value for intFromContactId (Not Null) // @return integer return $this->intFromContactId; case 'FromAddressId': // Gets the value for intFromAddressId (Not Null) // @return integer return $this->intFromAddressId; case 'ToCompanyId': // Gets the value for intToCompanyId (Not Null) // @return integer return $this->intToCompanyId; case 'ToContactId': // Gets the value for intToContactId (Not Null) // @return integer return $this->intToContactId; case 'ToAddressId': // Gets the value for intToAddressId (Not Null) // @return integer return $this->intToAddressId; case 'CourierId': // Gets the value for intCourierId // @return integer return $this->intCourierId; case 'TrackingNumber': // Gets the value for strTrackingNumber // @return string return $this->strTrackingNumber; case 'ShipDate': // Gets the value for dttShipDate (Not Null) // @return QDateTime return $this->dttShipDate; case 'ShippedFlag': // Gets the value for blnShippedFlag // @return boolean return $this->blnShippedFlag; 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 'Transaction': // Gets the value for the Transaction object referenced by intTransactionId (Unique) // @return Transaction try { if (!$this->objTransaction && !is_null($this->intTransactionId)) { $this->objTransaction = Transaction::Load($this->intTransactionId); } return $this->objTransaction; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'FromCompany': // Gets the value for the Company object referenced by intFromCompanyId (Not Null) // @return Company try { if (!$this->objFromCompany && !is_null($this->intFromCompanyId)) { $this->objFromCompany = Company::Load($this->intFromCompanyId); } return $this->objFromCompany; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'FromContact': // Gets the value for the Contact object referenced by intFromContactId (Not Null) // @return Contact try { if (!$this->objFromContact && !is_null($this->intFromContactId)) { $this->objFromContact = Contact::Load($this->intFromContactId); } return $this->objFromContact; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'FromAddress': // Gets the value for the Address object referenced by intFromAddressId (Not Null) // @return Address try { if (!$this->objFromAddress && !is_null($this->intFromAddressId)) { $this->objFromAddress = Address::Load($this->intFromAddressId); } return $this->objFromAddress; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ToCompany': // Gets the value for the Company object referenced by intToCompanyId (Not Null) // @return Company try { if (!$this->objToCompany && !is_null($this->intToCompanyId)) { $this->objToCompany = Company::Load($this->intToCompanyId); } return $this->objToCompany; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ToContact': // Gets the value for the Contact object referenced by intToContactId (Not Null) // @return Contact try { if (!$this->objToContact && !is_null($this->intToContactId)) { $this->objToContact = Contact::Load($this->intToContactId); } return $this->objToContact; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ToAddress': // Gets the value for the Address object referenced by intToAddressId (Not Null) // @return Address try { if (!$this->objToAddress && !is_null($this->intToAddressId)) { $this->objToAddress = Address::Load($this->intToAddressId); } return $this->objToAddress; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Courier': // Gets the value for the Courier object referenced by intCourierId // @return Courier try { if (!$this->objCourier && !is_null($this->intCourierId)) { $this->objCourier = Courier::Load($this->intCourierId); } return $this->objCourier; } 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 'ShipmentCustomFieldHelper': // Gets the value for the ShipmentCustomFieldHelper object that uniquely references this Shipment // by objShipmentCustomFieldHelper (Unique) // @return ShipmentCustomFieldHelper try { if ($this->objShipmentCustomFieldHelper === false) { // We've attempted early binding -- and the reverse reference object does not exist return null; } if (!$this->objShipmentCustomFieldHelper) { $this->objShipmentCustomFieldHelper = ShipmentCustomFieldHelper::LoadByShipmentId($this->intShipmentId); } return $this->objShipmentCustomFieldHelper; } 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 '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } 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, ShipmentCustomFieldHelper::GetSoapObjectFromObject($objObject, true)); } return unserialize(serialize($objArrayToReturn)); }
/** * 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 = ShipmentCustomFieldHelper::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 ShipmentCustomFieldHelper, given the clauses above $this->DataSource = ShipmentCustomFieldHelper::QueryArray($objCondition, $objClauses); }