Пример #1
0
 /**
  * This will create a new record or update an existing record given the MS SQL Data Row
  * @param string[] $objRow the mssql_fetch_assoc row result from MS SQL Server
  * @return ParentPagerPeriod
  */
 public static function CreateOrUpdateForMsSqlRow($objRow)
 {
     $intServerIdentifier = $objRow['lngPeriodID'];
     $strName = trim($objRow['strPeriodDesc']);
     $objParentPagerPeriod = ParentPagerPeriod::LoadByServerIdentifier($intServerIdentifier);
     if (!$objParentPagerPeriod) {
         $objParentPagerPeriod = new ParentPagerPeriod();
         $objParentPagerPeriod->ServerIdentifier = $intServerIdentifier;
     }
     $objParentPagerPeriod->Name = $strName;
     $objParentPagerPeriod->Save();
     return $objParentPagerPeriod;
 }
Пример #2
0
 /**
  * This will create a new record or update an existing record given the MS SQL Data Row
  * @param string[] $objRow the mssql_fetch_assoc row result from MS SQL Server
  * @return ParentPagerChildHistory
  */
 public static function CreateOrUpdateForMsSqlRow($objRow)
 {
     $intServerIdentifier = $objRow['lngChildHistoryID'];
     $intIndividualIdentifier = $objRow['lngIndividualID'];
     $intStationIdentifier = $objRow['lngStationID'];
     $intPeriodIdentifier = $objRow['lngPeriodID'];
     $intDropoffIndividualIdentifier = $objRow['lngDropOffByID'];
     $intPickupIndividualIdentifier = $objRow['lngPickupByID'];
     $dttDateIn = new QDateTime($objRow['dtmCheckInDateTime']);
     $dttDateOut = new QDateTime($objRow['dtmCheckOutDateTime']);
     $objParentPagerChildHistory = ParentPagerChildHistory::LoadByServerIdentifier($intServerIdentifier);
     if (!$objParentPagerChildHistory) {
         $objParentPagerChildHistory = new ParentPagerChildHistory();
         $objParentPagerChildHistory->ServerIdentifier = $intServerIdentifier;
     }
     $objParentPagerChildHistory->ParentPagerIndividual = ParentPagerIndividual::LoadByServerIdentifier($intIndividualIdentifier);
     $objParentPagerChildHistory->ParentPagerStation = ParentPagerStation::LoadByServerIdentifier($intStationIdentifier);
     $objParentPagerChildHistory->ParentPagerPeriod = ParentPagerPeriod::LoadByServerIdentifier($intPeriodIdentifier);
     $objParentPagerChildHistory->DropoffByParentPagerIndividual = ParentPagerIndividual::LoadByServerIdentifier($intDropoffIndividualIdentifier);
     $objParentPagerChildHistory->PickupByParentPagerIndividual = ParentPagerIndividual::LoadByServerIdentifier($intPickupIndividualIdentifier);
     $objParentPagerChildHistory->DateIn = $dttDateIn;
     $objParentPagerChildHistory->DateOut = $dttDateOut;
     $objParentPagerChildHistory->Save();
     return $objParentPagerChildHistory;
 }
 /**
  * This will create a new record or update an existing record given the MS SQL Data Row
  * @param string[] $objRow the mssql_fetch_assoc row result from MS SQL Server
  * @return ParentPagerAttendantHistory
  */
 public static function CreateOrUpdateForMsSqlRow($objRow)
 {
     $intServerIdentifier = $objRow['lngAttendantHistoryID'];
     $intIndividualIdentifier = $objRow['lngIndividualID'];
     $intStationIdentifier = $objRow['lngStationID'];
     $intPeriodIdentifier = $objRow['lngPeriodID'];
     $intProgramIdentifier = $objRow['lngProgramID'];
     $dttDateIn = new QDateTime($objRow['dtmStartDateTime']);
     $dttDateOut = new QDateTime($objRow['dtmEndDateTime']);
     $objParentPagerAttendantHistory = ParentPagerAttendantHistory::LoadByServerIdentifier($intServerIdentifier);
     if (!$objParentPagerAttendantHistory) {
         $objParentPagerAttendantHistory = new ParentPagerAttendantHistory();
         $objParentPagerAttendantHistory->ServerIdentifier = $intServerIdentifier;
     }
     $objParentPagerAttendantHistory->ParentPagerIndividual = ParentPagerIndividual::LoadByServerIdentifier($intIndividualIdentifier);
     $objParentPagerAttendantHistory->ParentPagerStation = ParentPagerStation::LoadByServerIdentifier($intStationIdentifier);
     $objParentPagerAttendantHistory->ParentPagerPeriod = ParentPagerPeriod::LoadByServerIdentifier($intPeriodIdentifier);
     $objParentPagerAttendantHistory->ParentPagerProgram = ParentPagerProgram::LoadByServerIdentifier($intProgramIdentifier);
     $objParentPagerAttendantHistory->DateIn = $dttDateIn;
     $objParentPagerAttendantHistory->DateOut = $dttDateOut;
     $objParentPagerAttendantHistory->Save();
     return $objParentPagerAttendantHistory;
 }
 /**
  * Refresh this MetaControl with Data from the local ParentPagerChildHistory object.
  * @param boolean $blnReload reload ParentPagerChildHistory from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objParentPagerChildHistory->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objParentPagerChildHistory->Id;
         }
     }
     if ($this->txtServerIdentifier) {
         $this->txtServerIdentifier->Text = $this->objParentPagerChildHistory->ServerIdentifier;
     }
     if ($this->lblServerIdentifier) {
         $this->lblServerIdentifier->Text = $this->objParentPagerChildHistory->ServerIdentifier;
     }
     if ($this->lstParentPagerIndividual) {
         $this->lstParentPagerIndividual->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstParentPagerIndividual->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objParentPagerIndividualArray = ParentPagerIndividual::LoadAll();
         if ($objParentPagerIndividualArray) {
             foreach ($objParentPagerIndividualArray as $objParentPagerIndividual) {
                 $objListItem = new QListItem($objParentPagerIndividual->__toString(), $objParentPagerIndividual->Id);
                 if ($this->objParentPagerChildHistory->ParentPagerIndividual && $this->objParentPagerChildHistory->ParentPagerIndividual->Id == $objParentPagerIndividual->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstParentPagerIndividual->AddItem($objListItem);
             }
         }
     }
     if ($this->lblParentPagerIndividualId) {
         $this->lblParentPagerIndividualId->Text = $this->objParentPagerChildHistory->ParentPagerIndividual ? $this->objParentPagerChildHistory->ParentPagerIndividual->__toString() : null;
     }
     if ($this->lstParentPagerStation) {
         $this->lstParentPagerStation->RemoveAllItems();
         $this->lstParentPagerStation->AddItem(QApplication::Translate('- Select One -'), null);
         $objParentPagerStationArray = ParentPagerStation::LoadAll();
         if ($objParentPagerStationArray) {
             foreach ($objParentPagerStationArray as $objParentPagerStation) {
                 $objListItem = new QListItem($objParentPagerStation->__toString(), $objParentPagerStation->Id);
                 if ($this->objParentPagerChildHistory->ParentPagerStation && $this->objParentPagerChildHistory->ParentPagerStation->Id == $objParentPagerStation->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstParentPagerStation->AddItem($objListItem);
             }
         }
     }
     if ($this->lblParentPagerStationId) {
         $this->lblParentPagerStationId->Text = $this->objParentPagerChildHistory->ParentPagerStation ? $this->objParentPagerChildHistory->ParentPagerStation->__toString() : null;
     }
     if ($this->lstParentPagerPeriod) {
         $this->lstParentPagerPeriod->RemoveAllItems();
         $this->lstParentPagerPeriod->AddItem(QApplication::Translate('- Select One -'), null);
         $objParentPagerPeriodArray = ParentPagerPeriod::LoadAll();
         if ($objParentPagerPeriodArray) {
             foreach ($objParentPagerPeriodArray as $objParentPagerPeriod) {
                 $objListItem = new QListItem($objParentPagerPeriod->__toString(), $objParentPagerPeriod->Id);
                 if ($this->objParentPagerChildHistory->ParentPagerPeriod && $this->objParentPagerChildHistory->ParentPagerPeriod->Id == $objParentPagerPeriod->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstParentPagerPeriod->AddItem($objListItem);
             }
         }
     }
     if ($this->lblParentPagerPeriodId) {
         $this->lblParentPagerPeriodId->Text = $this->objParentPagerChildHistory->ParentPagerPeriod ? $this->objParentPagerChildHistory->ParentPagerPeriod->__toString() : null;
     }
     if ($this->lstDropoffByParentPagerIndividual) {
         $this->lstDropoffByParentPagerIndividual->RemoveAllItems();
         $this->lstDropoffByParentPagerIndividual->AddItem(QApplication::Translate('- Select One -'), null);
         $objDropoffByParentPagerIndividualArray = ParentPagerIndividual::LoadAll();
         if ($objDropoffByParentPagerIndividualArray) {
             foreach ($objDropoffByParentPagerIndividualArray as $objDropoffByParentPagerIndividual) {
                 $objListItem = new QListItem($objDropoffByParentPagerIndividual->__toString(), $objDropoffByParentPagerIndividual->Id);
                 if ($this->objParentPagerChildHistory->DropoffByParentPagerIndividual && $this->objParentPagerChildHistory->DropoffByParentPagerIndividual->Id == $objDropoffByParentPagerIndividual->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstDropoffByParentPagerIndividual->AddItem($objListItem);
             }
         }
     }
     if ($this->lblDropoffByParentPagerIndividualId) {
         $this->lblDropoffByParentPagerIndividualId->Text = $this->objParentPagerChildHistory->DropoffByParentPagerIndividual ? $this->objParentPagerChildHistory->DropoffByParentPagerIndividual->__toString() : null;
     }
     if ($this->lstPickupByParentPagerIndividual) {
         $this->lstPickupByParentPagerIndividual->RemoveAllItems();
         $this->lstPickupByParentPagerIndividual->AddItem(QApplication::Translate('- Select One -'), null);
         $objPickupByParentPagerIndividualArray = ParentPagerIndividual::LoadAll();
         if ($objPickupByParentPagerIndividualArray) {
             foreach ($objPickupByParentPagerIndividualArray as $objPickupByParentPagerIndividual) {
                 $objListItem = new QListItem($objPickupByParentPagerIndividual->__toString(), $objPickupByParentPagerIndividual->Id);
                 if ($this->objParentPagerChildHistory->PickupByParentPagerIndividual && $this->objParentPagerChildHistory->PickupByParentPagerIndividual->Id == $objPickupByParentPagerIndividual->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPickupByParentPagerIndividual->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPickupByParentPagerIndividualId) {
         $this->lblPickupByParentPagerIndividualId->Text = $this->objParentPagerChildHistory->PickupByParentPagerIndividual ? $this->objParentPagerChildHistory->PickupByParentPagerIndividual->__toString() : null;
     }
     if ($this->calDateIn) {
         $this->calDateIn->DateTime = $this->objParentPagerChildHistory->DateIn;
     }
     if ($this->lblDateIn) {
         $this->lblDateIn->Text = sprintf($this->objParentPagerChildHistory->DateIn) ? $this->objParentPagerChildHistory->__toString($this->strDateInDateTimeFormat) : null;
     }
     if ($this->calDateOut) {
         $this->calDateOut->DateTime = $this->objParentPagerChildHistory->DateOut;
     }
     if ($this->lblDateOut) {
         $this->lblDateOut->Text = sprintf($this->objParentPagerChildHistory->DateOut) ? $this->objParentPagerChildHistory->__toString($this->strDateOutDateTimeFormat) : null;
     }
 }
Пример #5
0
$strPkColumnName = 'lngStationID';
$intRowCount = GetRowCount($strTableName);
$intCurrentRow = 0;
$objResult = GetPkResultForTableColumn($strTableName, $strPkColumnName);
while ($objRow = mssql_fetch_assoc($objResult)) {
    $objRow = GetRowForTableColumnRow($strTableName, $strPkColumnName, $objRow);
    ParentPagerStation::CreateOrUpdateForMsSqlRow($objRow);
}
$strTableName = 'tblPeriod';
$strPkColumnName = 'lngPeriodID';
$intRowCount = GetRowCount($strTableName);
$intCurrentRow = 0;
$objResult = GetPkResultForTableColumn($strTableName, $strPkColumnName);
while ($objRow = mssql_fetch_assoc($objResult)) {
    $objRow = GetRowForTableColumnRow($strTableName, $strPkColumnName, $objRow);
    ParentPagerPeriod::CreateOrUpdateForMsSqlRow($objRow);
}
$strTableName = 'tblProgram';
$strPkColumnName = 'lngProgramID';
$intRowCount = GetRowCount($strTableName);
$intCurrentRow = 0;
$objResult = GetPkResultForTableColumn($strTableName, $strPkColumnName);
while ($objRow = mssql_fetch_assoc($objResult)) {
    $objRow = GetRowForTableColumnRow($strTableName, $strPkColumnName, $objRow);
    ParentPagerProgram::CreateOrUpdateForMsSqlRow($objRow);
}
////////////////////////////
// ParentPager Household
////////////////////////////
$strTableName = 'tblHousehold';
$strPkColumnName = 'lngHouseHoldID';
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objParentPagerIndividual) {
         $objObject->objParentPagerIndividual = ParentPagerIndividual::GetSoapObjectFromObject($objObject->objParentPagerIndividual, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intParentPagerIndividualId = null;
         }
     }
     if ($objObject->objParentPagerStation) {
         $objObject->objParentPagerStation = ParentPagerStation::GetSoapObjectFromObject($objObject->objParentPagerStation, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intParentPagerStationId = null;
         }
     }
     if ($objObject->objParentPagerPeriod) {
         $objObject->objParentPagerPeriod = ParentPagerPeriod::GetSoapObjectFromObject($objObject->objParentPagerPeriod, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intParentPagerPeriodId = null;
         }
     }
     if ($objObject->objDropoffByParentPagerIndividual) {
         $objObject->objDropoffByParentPagerIndividual = ParentPagerIndividual::GetSoapObjectFromObject($objObject->objDropoffByParentPagerIndividual, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intDropoffByParentPagerIndividualId = null;
         }
     }
     if ($objObject->objPickupByParentPagerIndividual) {
         $objObject->objPickupByParentPagerIndividual = ParentPagerIndividual::GetSoapObjectFromObject($objObject->objPickupByParentPagerIndividual, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intPickupByParentPagerIndividualId = null;
         }
     }
     if ($objObject->dttDateIn) {
         $objObject->dttDateIn = $objObject->dttDateIn->__toString(QDateTime::FormatSoap);
     }
     if ($objObject->dttDateOut) {
         $objObject->dttDateOut = $objObject->dttDateOut->__toString(QDateTime::FormatSoap);
     }
     return $objObject;
 }
Пример #7
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, ParentPagerPeriod::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
 /**
  * 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 ParentPagerPeriodMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing ParentPagerPeriod object creation - defaults to CreateOrEdit
  * @return ParentPagerPeriodMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objParentPagerPeriod = ParentPagerPeriod::Load($intId);
         // ParentPagerPeriod was found -- return it!
         if ($objParentPagerPeriod) {
             return new ParentPagerPeriodMetaControl($objParentObject, $objParentPagerPeriod);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a ParentPagerPeriod object with PK arguments: ' . $intId);
             }
         }
         // 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 ParentPagerPeriodMetaControl($objParentObject, new ParentPagerPeriod());
 }
 /**
  * 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 = ParentPagerPeriod::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 ParentPagerPeriod, given the clauses above
     $this->DataSource = ParentPagerPeriod::QueryArray($objCondition, $objClauses);
 }