/** * 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 ParentPagerIndividual */ public static function CreateOrUpdateForMsSqlRow($objRow) { $intServerIdentifier = $objRow['lngIndividualID']; $strFirstName = trim($objRow['strFirstName']); $strMiddleName = trim($objRow['strMiddleName']); $strLastName = trim($objRow['strLastName']); $strPrefix = trim($objRow['strPrefix']); $strSuffix = trim($objRow['strSuffix']); $strNickname = trim($objRow['strNickName']); $intGraduationYear = $objRow['sintGraduationYear']; $strDateOfBirth = trim($objRow['dtBirthDate']); $strGender = trim(strtoupper($objRow['chrGender'])); if (!$strGender) { $strGender = null; } $strHouseholdId = trim($objRow['lngHouseholdID']); $objParentPagerIndividual = ParentPagerIndividual::LoadByServerIdentifier($intServerIdentifier); if (!$objParentPagerIndividual) { $objParentPagerIndividual = new ParentPagerIndividual(); $objParentPagerIndividual->ServerIdentifier = $intServerIdentifier; $objParentPagerIndividual->HiddenFlag = false; $objParentPagerIndividual->ParentPagerSyncStatusTypeId = ParentPagerSyncStatusType::NotYetSynced; } $objParentPagerIndividual->FirstName = $strFirstName; $objParentPagerIndividual->MiddleName = $strMiddleName; $objParentPagerIndividual->LastName = $strLastName; $objParentPagerIndividual->Prefix = $strPrefix; $objParentPagerIndividual->Suffix = $strSuffix; $objParentPagerIndividual->Nickname = $strNickname; $objParentPagerIndividual->GraduationYear = $intGraduationYear; $objParentPagerIndividual->DateOfBirth = $strDateOfBirth ? new QDateTime($strDateOfBirth) : null; $objParentPagerIndividual->Gender = $strGender; if ($strHouseholdId) { $objParentPagerIndividual->ParentPagerHousehold = ParentPagerHousehold::LoadByServerIdentifier($strHouseholdId); } $objParentPagerIndividual->Save(); return $objParentPagerIndividual; }
/** * 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; }