Beispiel #1
0
 protected function lstCountry_Select()
 {
     // Save the currently selected StateProvince
     $intStateProvinceId = $this->lstStateProvince->SelectedValue;
     // Clear out the items from lstAddress
     $this->lstStateProvince->RemoveAllItems();
     if ($this->lstCountry->SelectedValue) {
         // Load the selected country
         $objCountry = Country::Load($this->lstCountry->SelectedValue);
         // Get all available state/provinces for that company
         $objStateProvinceArray = $objCountry->GetStateProvinceArray();
     } else {
         // Or load all addresses for all companies
         $objStateProvinceArray = StateProvince::LoadAll();
     }
     $this->lstStateProvince->AddItem('- Select One -', null);
     if ($objStateProvinceArray) {
         foreach ($objStateProvinceArray as $objStateProvince) {
             // Create a new ListItem Object
             $objListItem = new QListItem($objStateProvince->__toString(), $objStateProvince->StateProvinceId);
             // If this State/Province is the one previously selected, make it selected again
             if ($intStateProvinceId == $objStateProvince->StateProvinceId) {
                 $objListItem->Selected = true;
             }
             // Add the ListItem object
             $this->lstStateProvince->AddItem($objListItem);
             // Enable the input
             $this->lstStateProvince->Enabled = true;
         }
     } else {
         $this->lstStateProvince->Enabled = false;
     }
 }
Beispiel #2
0
 protected function lstCountry_Select($strFormId, $strControlId, $strParameter)
 {
     // Save the currently selected StateProvince
     $intStateProvinceId = $this->lstStateProvince->SelectedValue;
     // Clear out the items from lstAddress
     $this->lstStateProvince->RemoveAllItems();
     if ($this->lstCountry->SelectedValue) {
         // Load the selected country
         $objCountry = Country::Load($this->lstCountry->SelectedValue);
         // Get all available state/provinces for that company
         $objStateProvinceArray = $objCountry->GetStateProvinceArray();
     } else {
         // Or load all addresses for all companies
         $objStateProvinceArray = StateProvince::LoadAll();
     }
     $this->lstStateProvince->AddItem('- Select One -', null);
     if ($objStateProvinceArray) {
         foreach ($objStateProvinceArray as $objStateProvince) {
             $objListItem = new QListItem($objStateProvince->__toString(), $objStateProvince->StateProvinceId);
             if ($intStateProvinceId == $objStateProvince->StateProvinceId) {
                 $objListItem->Selected = true;
             }
             $this->lstStateProvince->AddItem($objListItem);
             $this->lstStateProvince->Enabled = true;
         }
     } else {
         $this->lstStateProvince->Enabled = false;
     }
 }
 protected function lstStateProvince_Create()
 {
     $this->lstStateProvince = new QListBox($this);
     $this->lstStateProvince->Name = QApplication::Translate('State Province');
     $this->lstStateProvince->AddItem(QApplication::Translate('- Select One -'), null);
     $objStateProvinceArray = StateProvince::LoadAll();
     if ($objStateProvinceArray) {
         foreach ($objStateProvinceArray as $objStateProvince) {
             $objListItem = new QListItem($objStateProvince->__toString(), $objStateProvince->StateProvinceId);
             if ($this->objAddress->StateProvince && $this->objAddress->StateProvince->StateProvinceId == $objStateProvince->StateProvinceId) {
                 $objListItem->Selected = true;
             }
             $this->lstStateProvince->AddItem($objListItem);
         }
     }
 }
 protected function lstHoldAtLocationStateObject_Create()
 {
     $this->lstHoldAtLocationStateObject = new QListBox($this);
     $this->lstHoldAtLocationStateObject->Name = QApplication::Translate('Hold At Location State Object');
     $this->lstHoldAtLocationStateObject->AddItem(QApplication::Translate('- Select One -'), null);
     $objHoldAtLocationStateObjectArray = StateProvince::LoadAll();
     if ($objHoldAtLocationStateObjectArray) {
         foreach ($objHoldAtLocationStateObjectArray as $objHoldAtLocationStateObject) {
             $objListItem = new QListItem($objHoldAtLocationStateObject->__toString(), $objHoldAtLocationStateObject->StateProvinceId);
             if ($this->objFedexShipment->HoldAtLocationStateObject && $this->objFedexShipment->HoldAtLocationStateObject->StateProvinceId == $objHoldAtLocationStateObject->StateProvinceId) {
                 $objListItem->Selected = true;
             }
             $this->lstHoldAtLocationStateObject->AddItem($objListItem);
         }
     }
 }
 /**
  * Refresh this MetaControl with Data from the local Address object.
  * @param boolean $blnReload reload Address from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objAddress->Reload();
     }
     if ($this->lblAddressId) {
         if ($this->blnEditMode) {
             $this->lblAddressId->Text = $this->objAddress->AddressId;
         }
     }
     if ($this->lstCompany) {
         $this->lstCompany->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstCompany->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objCompanyArray = Company::LoadAll();
         if ($objCompanyArray) {
             foreach ($objCompanyArray as $objCompany) {
                 $objListItem = new QListItem($objCompany->__toString(), $objCompany->CompanyId);
                 if ($this->objAddress->Company && $this->objAddress->Company->CompanyId == $objCompany->CompanyId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCompany->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCompanyId) {
         $this->lblCompanyId->Text = $this->objAddress->Company ? $this->objAddress->Company->__toString() : null;
     }
     if ($this->txtShortDescription) {
         $this->txtShortDescription->Text = $this->objAddress->ShortDescription;
     }
     if ($this->lblShortDescription) {
         $this->lblShortDescription->Text = $this->objAddress->ShortDescription;
     }
     if ($this->lstCountry) {
         $this->lstCountry->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstCountry->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objCountryArray = Country::LoadAll();
         if ($objCountryArray) {
             foreach ($objCountryArray as $objCountry) {
                 $objListItem = new QListItem($objCountry->__toString(), $objCountry->CountryId);
                 if ($this->objAddress->Country && $this->objAddress->Country->CountryId == $objCountry->CountryId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCountry->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCountryId) {
         $this->lblCountryId->Text = $this->objAddress->Country ? $this->objAddress->Country->__toString() : null;
     }
     if ($this->txtAddress1) {
         $this->txtAddress1->Text = $this->objAddress->Address1;
     }
     if ($this->lblAddress1) {
         $this->lblAddress1->Text = $this->objAddress->Address1;
     }
     if ($this->txtAddress2) {
         $this->txtAddress2->Text = $this->objAddress->Address2;
     }
     if ($this->lblAddress2) {
         $this->lblAddress2->Text = $this->objAddress->Address2;
     }
     if ($this->txtCity) {
         $this->txtCity->Text = $this->objAddress->City;
     }
     if ($this->lblCity) {
         $this->lblCity->Text = $this->objAddress->City;
     }
     if ($this->lstStateProvince) {
         $this->lstStateProvince->RemoveAllItems();
         $this->lstStateProvince->AddItem(QApplication::Translate('- Select One -'), null);
         $objStateProvinceArray = StateProvince::LoadAll();
         if ($objStateProvinceArray) {
             foreach ($objStateProvinceArray as $objStateProvince) {
                 $objListItem = new QListItem($objStateProvince->__toString(), $objStateProvince->StateProvinceId);
                 if ($this->objAddress->StateProvince && $this->objAddress->StateProvince->StateProvinceId == $objStateProvince->StateProvinceId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstStateProvince->AddItem($objListItem);
             }
         }
     }
     if ($this->lblStateProvinceId) {
         $this->lblStateProvinceId->Text = $this->objAddress->StateProvince ? $this->objAddress->StateProvince->__toString() : null;
     }
     if ($this->txtPostalCode) {
         $this->txtPostalCode->Text = $this->objAddress->PostalCode;
     }
     if ($this->lblPostalCode) {
         $this->lblPostalCode->Text = $this->objAddress->PostalCode;
     }
     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->objAddress->CreatedByObject && $this->objAddress->CreatedByObject->UserAccountId == $objCreatedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCreatedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCreatedBy) {
         $this->lblCreatedBy->Text = $this->objAddress->CreatedByObject ? $this->objAddress->CreatedByObject->__toString() : null;
     }
     if ($this->calCreationDate) {
         $this->calCreationDate->DateTime = $this->objAddress->CreationDate;
     }
     if ($this->lblCreationDate) {
         $this->lblCreationDate->Text = sprintf($this->objAddress->CreationDate) ? $this->objAddress->__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->objAddress->ModifiedByObject && $this->objAddress->ModifiedByObject->UserAccountId == $objModifiedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstModifiedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblModifiedBy) {
         $this->lblModifiedBy->Text = $this->objAddress->ModifiedByObject ? $this->objAddress->ModifiedByObject->__toString() : null;
     }
     if ($this->lblModifiedDate) {
         if ($this->blnEditMode) {
             $this->lblModifiedDate->Text = $this->objAddress->ModifiedDate;
         }
     }
     if ($this->lstAddressCustomFieldHelper) {
         $this->lstAddressCustomFieldHelper->RemoveAllItems();
         $this->lstAddressCustomFieldHelper->AddItem(QApplication::Translate('- Select One -'), null);
         $objAddressCustomFieldHelperArray = AddressCustomFieldHelper::LoadAll();
         if ($objAddressCustomFieldHelperArray) {
             foreach ($objAddressCustomFieldHelperArray as $objAddressCustomFieldHelper) {
                 $objListItem = new QListItem($objAddressCustomFieldHelper->__toString(), $objAddressCustomFieldHelper->AddressId);
                 if ($objAddressCustomFieldHelper->AddressId == $this->objAddress->AddressId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstAddressCustomFieldHelper->AddItem($objListItem);
             }
         }
         // Because AddressCustomFieldHelper's AddressCustomFieldHelper is not null, if a value is already selected, it cannot be changed.
         if ($this->lstAddressCustomFieldHelper->SelectedValue) {
             $this->lstAddressCustomFieldHelper->Enabled = false;
         } else {
             $this->lstAddressCustomFieldHelper->Enabled = true;
         }
     }
     if ($this->lblAddressCustomFieldHelper) {
         $this->lblAddressCustomFieldHelper->Text = $this->objAddress->AddressCustomFieldHelper ? $this->objAddress->AddressCustomFieldHelper->__toString() : null;
     }
 }
Beispiel #6
0
 protected function lstHoldAtLocationState_Create()
 {
     $this->lstHoldAtLocationState = new QListBox($this->pnlFedExShipment);
     $this->lstHoldAtLocationState->Name = QApplication::Translate('Hold at Location State');
     $this->lstHoldAtLocationState->AddItem(QApplication::Translate('- Select One -'), null);
     $objStateProvinceArray = StateProvince::LoadAll();
     if ($objStateProvinceArray) {
         foreach ($objStateProvinceArray as $objStateProvince) {
             $objListItem = new QListItem($objStateProvince->__toString(), $objStateProvince->StateProvinceId);
             if ($this->blnEditMode && $this->objFedexShipment && $this->objFedexShipment->HoldAtLocationState && $this->objFedexShipment->HoldAtLocationState == $objStateProvince->StateProvinceId) {
                 $objListItem->Selected = true;
             }
             $this->lstHoldAtLocationState->AddItem($objListItem);
         }
     }
     $this->lstHoldAtLocationState->TabIndex = 30;
 }
 public function dtgStateProvince_Bind()
 {
     // Get Total Count b/c of Pagination
     $this->dtgStateProvince->TotalItemCount = StateProvince::CountAll();
     $objClauses = array();
     if ($objClause = $this->dtgStateProvince->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = $this->dtgStateProvince->LimitClause) {
         array_push($objClauses, $objClause);
     }
     $this->dtgStateProvince->DataSource = StateProvince::LoadAll($objClauses);
 }