protected function SavePerson($strFormId, $strControlId, $strParameter)
{
if ($strParameter == '1') {
$objPerson = $this->objPerson1;
$objPerson->FirstName = $this->txtFirstName1->Text;
$objPerson->LastName = $this->txtLastName1->Text;
} else {
$objPerson = $this->objPerson2;
$objPerson->FirstName = $this->txtFirstName2->Text;
$objPerson->LastName = $this->txtLastName2->Text;
}
// Try and do the Save, Catch the Optimistic Lock Exception
try {
$objPerson->Save();
// Reload the Person so that it's fresh
if ($strParameter == '1') {
$this->objPerson1 = PersonWithLock::Load(5);
} else {
$this->objPerson2 = PersonWithLock::Load(5);
}
} catch (QOptimisticLockingException $objExc) {
// Lock Exception Thrown, Report the Error
$this->lblMessage->Text = '<br/>Optimistic Locking Constraint -- the <b>PersonWithLock</b> you ' . 'are saving has "stale" data.<br/>' . 'If you want to save anyway, use "Force Update".';
}
}