/**
  * Refresh this MetaControl with Data from the local NarroProject object.
  * @param boolean $blnReload reload NarroProject from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objNarroProject->Reload();
     }
     if ($this->lblProjectId) {
         if ($this->blnEditMode) {
             $this->lblProjectId->Text = $this->objNarroProject->ProjectId;
         }
     }
     if ($this->lstProjectCategory) {
         $this->lstProjectCategory->RemoveAllItems();
         $this->lstProjectCategory->AddItem(QApplication::Translate('- Select One -'), null);
         $objProjectCategoryArray = NarroProjectCategory::LoadAll();
         if ($objProjectCategoryArray) {
             foreach ($objProjectCategoryArray as $objProjectCategory) {
                 $objListItem = new QListItem($objProjectCategory->__toString(), $objProjectCategory->ProjectCategoryId);
                 if ($this->objNarroProject->ProjectCategory && $this->objNarroProject->ProjectCategory->ProjectCategoryId == $objProjectCategory->ProjectCategoryId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstProjectCategory->AddItem($objListItem);
             }
         }
     }
     if ($this->lblProjectCategoryId) {
         $this->lblProjectCategoryId->Text = $this->objNarroProject->ProjectCategory ? $this->objNarroProject->ProjectCategory->__toString() : null;
     }
     if ($this->txtProjectName) {
         $this->txtProjectName->Text = $this->objNarroProject->ProjectName;
     }
     if ($this->lblProjectName) {
         $this->lblProjectName->Text = $this->objNarroProject->ProjectName;
     }
     if ($this->lstProjectTypeObject) {
         $this->lstProjectTypeObject->SelectedValue = $this->objNarroProject->ProjectType;
     }
     if ($this->lblProjectType) {
         $this->lblProjectType->Text = $this->objNarroProject->ProjectType ? NarroProjectType::$NameArray[$this->objNarroProject->ProjectType] : null;
     }
     if ($this->txtProjectDescription) {
         $this->txtProjectDescription->Text = $this->objNarroProject->ProjectDescription;
     }
     if ($this->lblProjectDescription) {
         $this->lblProjectDescription->Text = $this->objNarroProject->ProjectDescription;
     }
     if ($this->txtData) {
         $this->txtData->Text = $this->objNarroProject->Data;
     }
     if ($this->lblData) {
         $this->lblData->Text = $this->objNarroProject->Data;
     }
     if ($this->txtActive) {
         $this->txtActive->Text = $this->objNarroProject->Active;
     }
     if ($this->lblActive) {
         $this->lblActive->Text = $this->objNarroProject->Active;
     }
 }
예제 #2
0
 protected function lstProjectCategory_Create()
 {
     $this->lstProjectCategory = new QListBox($this);
     $objProjectCategoryArray = NarroProjectCategory::LoadAll();
     if ($objProjectCategoryArray) {
         foreach ($objProjectCategoryArray as $objProjectCategory) {
             $objListItem = new QListItem($objProjectCategory->CategoryName, $objProjectCategory->ProjectCategoryId);
             if ($this->objProject->ProjectCategory && $this->objProject->ProjectCategory->ProjectCategoryId == $objProjectCategory->ProjectCategoryId) {
                 $objListItem->Selected = true;
             }
             $this->lstProjectCategory->AddItem($objListItem);
         }
     }
 }