/**
  * 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;
     }
 }
 /**
  * This Form_Validate event handler allows you to specify any custom Form Validation rules.
  * It will also Blink() on all invalid controls, as well as Focus() on the top-most invalid control.
  */
 protected function Form_Validate()
 {
     // By default, we report the result of validation from the parent
     $blnToReturn = parent::Form_Validate();
     // Custom Validation Rules
     // TODO: Be sure to set $blnToReturn to false if any custom validation fails!
     // Check for records that may violate Unique Clauses
     if (($objNarroProjectCategory = NarroProjectCategory::LoadByCategoryName($this->txtCategoryName->Text)) && $objNarroProjectCategory->ProjectCategoryId != $this->mctNarroProjectCategory->NarroProjectCategory->ProjectCategoryId) {
         $blnToReturn = false;
         $this->txtCategoryName->Warning = QApplication::Translate("Already in Use");
     }
     $blnFocused = false;
     foreach ($this->GetErrorControls() as $objControl) {
         // Set Focus to the top-most invalid control
         if (!$blnFocused) {
             $objControl->Focus();
             $blnFocused = true;
         }
         // Blink on ALL invalid controls
         $objControl->Blink();
     }
     return $blnToReturn;
 }
 /**
  * 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 NarroProjectCategoryMetaControl
  * @param integer $intProjectCategoryId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing NarroProjectCategory object creation - defaults to CreateOrEdit
  * @return NarroProjectCategoryMetaControl
  */
 public static function Create($objParentObject, $intProjectCategoryId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intProjectCategoryId)) {
         $objNarroProjectCategory = NarroProjectCategory::Load($intProjectCategoryId);
         // NarroProjectCategory was found -- return it!
         if ($objNarroProjectCategory) {
             return new NarroProjectCategoryMetaControl($objParentObject, $objNarroProjectCategory);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a NarroProjectCategory object with PK arguments: ' . $intProjectCategoryId);
             }
         }
         // 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 NarroProjectCategoryMetaControl($objParentObject, new NarroProjectCategory());
 }
 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);
         }
     }
 }
 /**
  * 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()
 {
     $objConditions = $this->Conditions;
     if (null !== $this->conAdditionalConditions) {
         $objConditions = QQ::AndCondition($this->conAdditionalConditions, $objConditions);
     }
     // Setup the $objClauses Array
     $objClauses = array();
     if (null !== $this->clsAdditionalClauses) {
         $objClauses = $this->clsAdditionalClauses;
     }
     // Remember!  We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = NarroProjectCategory::QueryCount($objConditions);
     }
     // 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 NarroProjectCategory, given the clauses above
     $this->DataSource = NarroProjectCategory::QueryArray($objConditions, $objClauses);
 }
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, NarroProjectCategory::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
Beispiel #7
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objProjectCategory) {
         $objObject->objProjectCategory = NarroProjectCategory::GetSoapObjectFromObject($objObject->objProjectCategory, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intProjectCategoryId = null;
         }
     }
     return $objObject;
 }