/**
  * Refresh this MetaControl with Data from the local Person object.
  * @param boolean $blnReload reload Person from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objPerson->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objPerson->Id;
         }
     }
     if ($this->lstPersonType) {
         $this->lstPersonType->SelectedValue = $this->objPerson->PersonTypeId;
     }
     if ($this->lblPersonTypeId) {
         $this->lblPersonTypeId->Text = $this->objPerson->PersonTypeId ? PersonType::$NameArray[$this->objPerson->PersonTypeId] : null;
     }
     if ($this->txtUsername) {
         $this->txtUsername->Text = $this->objPerson->Username;
     }
     if ($this->lblUsername) {
         $this->lblUsername->Text = $this->objPerson->Username;
     }
     if ($this->txtPassword) {
         $this->txtPassword->Text = $this->objPerson->Password;
     }
     if ($this->lblPassword) {
         $this->lblPassword->Text = $this->objPerson->Password;
     }
     if ($this->txtFirstName) {
         $this->txtFirstName->Text = $this->objPerson->FirstName;
     }
     if ($this->lblFirstName) {
         $this->lblFirstName->Text = $this->objPerson->FirstName;
     }
     if ($this->txtLastName) {
         $this->txtLastName->Text = $this->objPerson->LastName;
     }
     if ($this->lblLastName) {
         $this->lblLastName->Text = $this->objPerson->LastName;
     }
     if ($this->txtEmail) {
         $this->txtEmail->Text = $this->objPerson->Email;
     }
     if ($this->lblEmail) {
         $this->lblEmail->Text = $this->objPerson->Email;
     }
     if ($this->txtDisplayName) {
         $this->txtDisplayName->Text = $this->objPerson->DisplayName;
     }
     if ($this->lblDisplayName) {
         $this->lblDisplayName->Text = $this->objPerson->DisplayName;
     }
     if ($this->chkPasswordResetFlag) {
         $this->chkPasswordResetFlag->Checked = $this->objPerson->PasswordResetFlag;
     }
     if ($this->lblPasswordResetFlag) {
         $this->lblPasswordResetFlag->Text = $this->objPerson->PasswordResetFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->chkDisplayRealNameFlag) {
         $this->chkDisplayRealNameFlag->Checked = $this->objPerson->DisplayRealNameFlag;
     }
     if ($this->lblDisplayRealNameFlag) {
         $this->lblDisplayRealNameFlag->Text = $this->objPerson->DisplayRealNameFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->chkDisplayEmailFlag) {
         $this->chkDisplayEmailFlag->Checked = $this->objPerson->DisplayEmailFlag;
     }
     if ($this->lblDisplayEmailFlag) {
         $this->lblDisplayEmailFlag->Text = $this->objPerson->DisplayEmailFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->chkOptInFlag) {
         $this->chkOptInFlag->Checked = $this->objPerson->OptInFlag;
     }
     if ($this->lblOptInFlag) {
         $this->lblOptInFlag->Text = $this->objPerson->OptInFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->chkDonatedFlag) {
         $this->chkDonatedFlag->Checked = $this->objPerson->DonatedFlag;
     }
     if ($this->lblDonatedFlag) {
         $this->lblDonatedFlag->Text = $this->objPerson->DonatedFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->txtLocation) {
         $this->txtLocation->Text = $this->objPerson->Location;
     }
     if ($this->lblLocation) {
         $this->lblLocation->Text = $this->objPerson->Location;
     }
     if ($this->lstCountry) {
         $this->lstCountry->RemoveAllItems();
         $this->lstCountry->AddItem(QApplication::Translate('- Select One -'), null);
         $objCountryArray = Country::LoadAll();
         if ($objCountryArray) {
             foreach ($objCountryArray as $objCountry) {
                 $objListItem = new QListItem($objCountry->__toString(), $objCountry->Id);
                 if ($this->objPerson->Country && $this->objPerson->Country->Id == $objCountry->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCountry->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCountryId) {
         $this->lblCountryId->Text = $this->objPerson->Country ? $this->objPerson->Country->__toString() : null;
     }
     if ($this->txtUrl) {
         $this->txtUrl->Text = $this->objPerson->Url;
     }
     if ($this->lblUrl) {
         $this->lblUrl->Text = $this->objPerson->Url;
     }
     if ($this->lstTimezone) {
         $this->lstTimezone->RemoveAllItems();
         $this->lstTimezone->AddItem(QApplication::Translate('- Select One -'), null);
         $objTimezoneArray = Timezone::LoadAll();
         if ($objTimezoneArray) {
             foreach ($objTimezoneArray as $objTimezone) {
                 $objListItem = new QListItem($objTimezone->__toString(), $objTimezone->Id);
                 if ($this->objPerson->Timezone && $this->objPerson->Timezone->Id == $objTimezone->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstTimezone->AddItem($objListItem);
             }
         }
     }
     if ($this->lblTimezoneId) {
         $this->lblTimezoneId->Text = $this->objPerson->Timezone ? $this->objPerson->Timezone->__toString() : null;
     }
     if ($this->calRegistrationDate) {
         $this->calRegistrationDate->DateTime = $this->objPerson->RegistrationDate;
     }
     if ($this->lblRegistrationDate) {
         $this->lblRegistrationDate->Text = sprintf($this->objPerson->RegistrationDate) ? $this->objPerson->__toString($this->strRegistrationDateDateTimeFormat) : null;
     }
     if ($this->lstTopicsAsEmail) {
         $this->lstTopicsAsEmail->RemoveAllItems();
         $objAssociatedArray = $this->objPerson->GetTopicAsEmailArray();
         $objTopicArray = Topic::LoadAll();
         if ($objTopicArray) {
             foreach ($objTopicArray as $objTopic) {
                 $objListItem = new QListItem($objTopic->__toString(), $objTopic->Id);
                 foreach ($objAssociatedArray as $objAssociated) {
                     if ($objAssociated->Id == $objTopic->Id) {
                         $objListItem->Selected = true;
                     }
                 }
                 $this->lstTopicsAsEmail->AddItem($objListItem);
             }
         }
     }
     if ($this->lblTopicsAsEmail) {
         $objAssociatedArray = $this->objPerson->GetTopicAsEmailArray();
         $strItems = array();
         foreach ($objAssociatedArray as $objAssociated) {
             $strItems[] = $objAssociated->__toString();
         }
         $this->lblTopicsAsEmail->Text = implode($strGlue, $strItems);
     }
     if ($this->lstTopicsAsReadOnce) {
         $this->lstTopicsAsReadOnce->RemoveAllItems();
         $objAssociatedArray = $this->objPerson->GetTopicAsReadOnceArray();
         $objTopicArray = Topic::LoadAll();
         if ($objTopicArray) {
             foreach ($objTopicArray as $objTopic) {
                 $objListItem = new QListItem($objTopic->__toString(), $objTopic->Id);
                 foreach ($objAssociatedArray as $objAssociated) {
                     if ($objAssociated->Id == $objTopic->Id) {
                         $objListItem->Selected = true;
                     }
                 }
                 $this->lstTopicsAsReadOnce->AddItem($objListItem);
             }
         }
     }
     if ($this->lblTopicsAsReadOnce) {
         $objAssociatedArray = $this->objPerson->GetTopicAsReadOnceArray();
         $strItems = array();
         foreach ($objAssociatedArray as $objAssociated) {
             $strItems[] = $objAssociated->__toString();
         }
         $this->lblTopicsAsReadOnce->Text = implode($strGlue, $strItems);
     }
     if ($this->lstTopicsAsRead) {
         $this->lstTopicsAsRead->RemoveAllItems();
         $objAssociatedArray = $this->objPerson->GetTopicAsReadArray();
         $objTopicArray = Topic::LoadAll();
         if ($objTopicArray) {
             foreach ($objTopicArray as $objTopic) {
                 $objListItem = new QListItem($objTopic->__toString(), $objTopic->Id);
                 foreach ($objAssociatedArray as $objAssociated) {
                     if ($objAssociated->Id == $objTopic->Id) {
                         $objListItem->Selected = true;
                     }
                 }
                 $this->lstTopicsAsRead->AddItem($objListItem);
             }
         }
     }
     if ($this->lblTopicsAsRead) {
         $objAssociatedArray = $this->objPerson->GetTopicAsReadArray();
         $strItems = array();
         foreach ($objAssociatedArray as $objAssociated) {
             $strItems[] = $objAssociated->__toString();
         }
         $this->lblTopicsAsRead->Text = implode($strGlue, $strItems);
     }
 }
 /**
  * Default / simple DataBinder for this Meta DataGrid.  This can easily be overridden
  * by calling SetDataBinder() on this DataGrid with another DataBinder of your choice.
  *
  * 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).
  */
 public function MetaDataBinder()
 {
     // Remember!  We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = Timezone::CountAll();
     }
     // Setup the $objClauses Array
     $objClauses = array();
     // 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 Timezone, given the clauses above
     $this->DataSource = Timezone::LoadAll($objClauses);
 }