function AddRow($rsold = NULL)
 {
     global $conn, $Language, $Security;
     // Check referential integrity for master table 'tramites'
     $bValidMasterRecord = TRUE;
     $sMasterFilter = $this->SqlMasterFilter_tramites();
     if (strval($this->id_tramite->CurrentValue) != "") {
         $sMasterFilter = str_replace("@codigo@", ew_AdjustSql($this->id_tramite->CurrentValue), $sMasterFilter);
     } else {
         $bValidMasterRecord = FALSE;
     }
     if ($bValidMasterRecord) {
         $rsmaster = $GLOBALS["tramites"]->LoadRs($sMasterFilter);
         $bValidMasterRecord = $rsmaster && !$rsmaster->EOF;
         $rsmaster->Close();
     }
     if (!$bValidMasterRecord) {
         $sRelatedRecordMsg = str_replace("%t", "tramites", $Language->Phrase("RelatedRecordRequired"));
         $this->setFailureMessage($sRelatedRecordMsg);
         return FALSE;
     }
     // Load db values from rsold
     if ($rsold) {
         $this->LoadDbValues($rsold);
     }
     $rsnew = array();
     // id_tramite
     $this->id_tramite->SetDbValueDef($rsnew, $this->id_tramite->CurrentValue, 0, FALSE);
     // fecha
     $this->fecha->SetDbValueDef($rsnew, ew_CurrentDate(), ew_CurrentDate());
     $rsnew['fecha'] =& $this->fecha->DbValue;
     // hora
     $this->hora->SetDbValueDef($rsnew, ew_CurrentTime(), ew_CurrentTime());
     $rsnew['hora'] =& $this->hora->DbValue;
     // titulo
     $this->titulo->SetDbValueDef($rsnew, $this->titulo->CurrentValue, NULL, FALSE);
     // archivo
     if (!$this->archivo->Upload->KeepFile) {
         $this->archivo->Upload->DbValue = "";
         // No need to delete old file
         if ($this->archivo->Upload->FileName == "") {
             $rsnew['archivo'] = NULL;
         } else {
             $rsnew['archivo'] = $this->archivo->Upload->FileName;
         }
     }
     if (!$this->archivo->Upload->KeepFile) {
         $OldFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->DbValue);
         if (!ew_Empty($this->archivo->Upload->FileName)) {
             $NewFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->FileName);
             $FileCount = count($NewFiles);
             for ($i = 0; $i < $FileCount; $i++) {
                 $fldvar = $this->archivo->Upload->Index < 0 ? $this->archivo->FldVar : substr($this->archivo->FldVar, 0, 1) . $this->archivo->Upload->Index . substr($this->archivo->FldVar, 1);
                 if ($NewFiles[$i] != "") {
                     $file = $NewFiles[$i];
                     if (file_exists(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file)) {
                         if (!in_array($file, $OldFiles)) {
                             $file1 = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, $this->archivo->UploadPath), $file);
                             // Get new file name
                             if ($file1 != $file) {
                                 // Rename temp file
                                 while (file_exists(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file1)) {
                                     // Make sure did not clash with existing upload file
                                     $file1 = ew_UniqueFilename(ew_UploadPathEx(TRUE, $this->archivo->UploadPath), $file1, TRUE);
                                 }
                                 // Use indexed name
                                 rename(ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file, ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $file1);
                                 $NewFiles[$i] = $file1;
                             }
                         }
                     }
                 }
             }
             $this->archivo->Upload->FileName = implode(EW_MULTIPLE_UPLOAD_SEPARATOR, $NewFiles);
             $rsnew['archivo'] = $this->archivo->Upload->FileName;
         } else {
             $NewFiles = array();
         }
     }
     // Call Row Inserting event
     $rs = $rsold == NULL ? NULL : $rsold->fields;
     $bInsertRow = $this->Row_Inserting($rs, $rsnew);
     // Check if key value entered
     if ($bInsertRow && $this->ValidateKey && strval($rsnew['id_tramite']) == "") {
         $this->setFailureMessage($Language->Phrase("InvalidKeyValue"));
         $bInsertRow = FALSE;
     }
     // Check if key value entered
     if ($bInsertRow && $this->ValidateKey && strval($rsnew['fecha']) == "") {
         $this->setFailureMessage($Language->Phrase("InvalidKeyValue"));
         $bInsertRow = FALSE;
     }
     // Check if key value entered
     if ($bInsertRow && $this->ValidateKey && strval($rsnew['hora']) == "") {
         $this->setFailureMessage($Language->Phrase("InvalidKeyValue"));
         $bInsertRow = FALSE;
     }
     // Check for duplicate key
     if ($bInsertRow && $this->ValidateKey) {
         $sFilter = $this->KeyFilter();
         $rsChk = $this->LoadRs($sFilter);
         if ($rsChk && !$rsChk->EOF) {
             $sKeyErrMsg = str_replace("%f", $sFilter, $Language->Phrase("DupKey"));
             $this->setFailureMessage($sKeyErrMsg);
             $rsChk->Close();
             $bInsertRow = FALSE;
         }
     }
     if ($bInsertRow) {
         $conn->raiseErrorFn = 'ew_ErrorFn';
         $AddRow = $this->Insert($rsnew);
         $conn->raiseErrorFn = '';
         if ($AddRow) {
             if (!$this->archivo->Upload->KeepFile) {
                 $OldFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->DbValue);
                 if (!ew_Empty($this->archivo->Upload->FileName)) {
                     $NewFiles = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $this->archivo->Upload->FileName);
                     $NewFiles2 = explode(EW_MULTIPLE_UPLOAD_SEPARATOR, $rsnew['archivo']);
                     $FileCount = count($NewFiles);
                     for ($i = 0; $i < $FileCount; $i++) {
                         $fldvar = $this->archivo->Upload->Index < 0 ? $this->archivo->FldVar : substr($this->archivo->FldVar, 0, 1) . $this->archivo->Upload->Index . substr($this->archivo->FldVar, 1);
                         if ($NewFiles[$i] != "") {
                             $file = ew_UploadTempPath($fldvar) . EW_PATH_DELIMITER . $NewFiles[$i];
                             if (file_exists($file)) {
                                 $this->archivo->Upload->SaveToFile($this->archivo->UploadPath, @$NewFiles2[$i] != "" ? $NewFiles2[$i] : $NewFiles[$i], TRUE, $i);
                                 // Just replace
                             }
                         }
                     }
                 } else {
                     $NewFiles = array();
                 }
                 $FileCount = count($OldFiles);
                 for ($i = 0; $i < $FileCount; $i++) {
                     if ($OldFiles[$i] != "" && !in_array($OldFiles[$i], $NewFiles)) {
                         @unlink(ew_UploadPathEx(TRUE, $this->archivo->OldUploadPath) . $OldFiles[$i]);
                     }
                 }
             }
         }
     } else {
         if ($this->getSuccessMessage() != "" || $this->getFailureMessage() != "") {
             // Use the message, do nothing
         } elseif ($this->CancelMessage != "") {
             $this->setFailureMessage($this->CancelMessage);
             $this->CancelMessage = "";
         } else {
             $this->setFailureMessage($Language->Phrase("InsertCancelled"));
         }
         $AddRow = FALSE;
     }
     // Get insert id if necessary
     if ($AddRow) {
     }
     if ($AddRow) {
         // Call Row Inserted event
         $rs = $rsold == NULL ? NULL : $rsold->fields;
         $this->Row_Inserted($rs, $rsnew);
     }
     // archivo
     ew_CleanUploadTempPath($this->archivo, $this->archivo->Upload->Index);
     return $AddRow;
 }
Esempio n. 2
0
 function EditRow()
 {
     global $conn, $Security, $exam_data;
     $sFilter = $exam_data->KeyFilter();
     $exam_data->CurrentFilter = $sFilter;
     $sSql = $exam_data->SQL();
     $conn->raiseErrorFn = 'ew_ErrorFn';
     $rs = $conn->Execute($sSql);
     $conn->raiseErrorFn = '';
     if ($rs === FALSE) {
         return FALSE;
     }
     if ($rs->EOF) {
         $EditRow = FALSE;
         // Update Failed
     } else {
         // Save old values
         $rsold =& $rs->fields;
         $rsnew = array();
         // Field ExamDataNo
         // Field AccessionNumber
         $exam_data->AccessionNumber->SetDbValueDef($exam_data->AccessionNumber->CurrentValue, NULL);
         $rsnew['AccessionNumber'] =& $exam_data->AccessionNumber->DbValue;
         // Field PatientMainNo
         $exam_data->PatientMainNo->SetDbValueDef($exam_data->PatientMainNo->CurrentValue, 0);
         $rsnew['PatientMainNo'] =& $exam_data->PatientMainNo->DbValue;
         // Field PatientID
         $exam_data->PatientID->SetDbValueDef($exam_data->PatientID->CurrentValue, NULL);
         $rsnew['PatientID'] =& $exam_data->PatientID->DbValue;
         // Field InstitutionNo
         $exam_data->InstitutionNo->SetDbValueDef($exam_data->InstitutionNo->CurrentValue, 0);
         $rsnew['InstitutionNo'] =& $exam_data->InstitutionNo->DbValue;
         // Field ImageDetailNo
         $exam_data->ImageDetailNo->SetDbValueDef($exam_data->ImageDetailNo->CurrentValue, NULL);
         $rsnew['ImageDetailNo'] =& $exam_data->ImageDetailNo->DbValue;
         // Field PatientKindNo
         $exam_data->PatientKindNo->SetDbValueDef($exam_data->PatientKindNo->CurrentValue, NULL);
         $rsnew['PatientKindNo'] =& $exam_data->PatientKindNo->DbValue;
         // Field PatientSubKindNo
         $exam_data->PatientSubKindNo->SetDbValueDef($exam_data->PatientSubKindNo->CurrentValue, 0);
         $rsnew['PatientSubKindNo'] =& $exam_data->PatientSubKindNo->DbValue;
         // Field PatientTypeNo
         $exam_data->PatientTypeNo->SetDbValueDef($exam_data->PatientTypeNo->CurrentValue, NULL);
         $rsnew['PatientTypeNo'] =& $exam_data->PatientTypeNo->DbValue;
         // Field PatientRoom
         $exam_data->PatientRoom->SetDbValueDef($exam_data->PatientRoom->CurrentValue, NULL);
         $rsnew['PatientRoom'] =& $exam_data->PatientRoom->DbValue;
         // Field DepartmentNo
         $exam_data->DepartmentNo->SetDbValueDef($exam_data->DepartmentNo->CurrentValue, NULL);
         $rsnew['DepartmentNo'] =& $exam_data->DepartmentNo->DbValue;
         // Field DepartmentName
         $exam_data->DepartmentName->SetDbValueDef($exam_data->DepartmentName->CurrentValue, NULL);
         $rsnew['DepartmentName'] =& $exam_data->DepartmentName->DbValue;
         // Field Soap
         $exam_data->Soap->Upload->SaveToSession();
         // Save file value to Session
         if ($exam_data->Soap->Upload->Action == "2" || $exam_data->Soap->Upload->Action == "3") {
             // Update/Remove
             if (is_null($exam_data->Soap->Upload->Value)) {
                 $rsnew['Soap'] = NULL;
             } else {
                 $rsnew['Soap'] = $exam_data->Soap->Upload->Value;
             }
         }
         // Field RequestDoctorID
         $exam_data->RequestDoctorID->SetDbValueDef($exam_data->RequestDoctorID->CurrentValue, NULL);
         $rsnew['RequestDoctorID'] =& $exam_data->RequestDoctorID->DbValue;
         // Field CodeValue
         $exam_data->CodeValue->SetDbValueDef($exam_data->CodeValue->CurrentValue, NULL);
         $rsnew['CodeValue'] =& $exam_data->CodeValue->DbValue;
         // Field SpecialExamID
         $exam_data->SpecialExamID->SetDbValueDef($exam_data->SpecialExamID->CurrentValue, NULL);
         $rsnew['SpecialExamID'] =& $exam_data->SpecialExamID->DbValue;
         // Field SpecialExamName
         $exam_data->SpecialExamName->SetDbValueDef($exam_data->SpecialExamName->CurrentValue, NULL);
         $rsnew['SpecialExamName'] =& $exam_data->SpecialExamName->DbValue;
         // Field SpecialExamDate
         $exam_data->SpecialExamDate->SetDbValueDef(ew_UnFormatDateTime($exam_data->SpecialExamDate->CurrentValue, 5), NULL);
         $rsnew['SpecialExamDate'] =& $exam_data->SpecialExamDate->DbValue;
         // Field ExamDate
         $exam_data->ExamDate->SetDbValueDef(ew_UnFormatDateTime($exam_data->ExamDate->CurrentValue, 5), ew_CurrentDate());
         $rsnew['ExamDate'] =& $exam_data->ExamDate->DbValue;
         // Field ExamTime
         $exam_data->ExamTime->SetDbValueDef(ew_FormatDateTime($exam_data->ExamTime->CurrentValue, 4), ew_CurrentTime());
         $rsnew['ExamTime'] =& $exam_data->ExamTime->DbValue;
         // Field LogDate
         $exam_data->LogDate->SetDbValueDef(ew_UnFormatDateTime($exam_data->LogDate->CurrentValue, 5), ew_CurrentDate());
         $rsnew['LogDate'] =& $exam_data->LogDate->DbValue;
         // Field ModifyUser
         $exam_data->ModifyUser->SetDbValueDef($exam_data->ModifyUser->CurrentValue, NULL);
         $rsnew['ModifyUser'] =& $exam_data->ModifyUser->DbValue;
         // Field ModifyDate
         $exam_data->ModifyDate->SetDbValueDef(ew_UnFormatDateTime($exam_data->ModifyDate->CurrentValue, 5), NULL);
         $rsnew['ModifyDate'] =& $exam_data->ModifyDate->DbValue;
         // Field CreatePart
         $exam_data->CreatePart->SetDbValueDef($exam_data->CreatePart->CurrentValue, "");
         $rsnew['CreatePart'] =& $exam_data->CreatePart->DbValue;
         // Field ModifyPart
         $exam_data->ModifyPart->SetDbValueDef($exam_data->ModifyPart->CurrentValue, "");
         $rsnew['ModifyPart'] =& $exam_data->ModifyPart->DbValue;
         // Field Status
         $exam_data->Status->SetDbValueDef($exam_data->Status->CurrentValue, "");
         $rsnew['Status'] =& $exam_data->Status->DbValue;
         // Call Row Updating event
         $bUpdateRow = $exam_data->Row_Updating($rsold, $rsnew);
         if ($bUpdateRow) {
             // Field Soap
             $conn->raiseErrorFn = 'ew_ErrorFn';
             $EditRow = $conn->Execute($exam_data->UpdateSQL($rsnew));
             $conn->raiseErrorFn = '';
         } else {
             if ($exam_data->CancelMessage != "") {
                 $this->setMessage($exam_data->CancelMessage);
                 $exam_data->CancelMessage = "";
             } else {
                 $this->setMessage("Update cancelled");
             }
             $EditRow = FALSE;
         }
     }
     // Call Row_Updated event
     if ($EditRow) {
         $exam_data->Row_Updated($rsold, $rsnew);
     }
     $rs->Close();
     // Field Soap
     $exam_data->Soap->Upload->RemoveFromSession();
     // Remove file value from Session
     return $EditRow;
 }
Esempio n. 3
0
 function AddRow()
 {
     global $conn, $Language, $Security, $tbl_ga_stat;
     // Check if key value entered
     if ($tbl_ga_stat->id_profile->CurrentValue == "") {
         $this->setMessage($Language->Phrase("InvalidKeyValue"));
         return FALSE;
     }
     // Check if key value entered
     if ($tbl_ga_stat->stat_date->CurrentValue == "") {
         $this->setMessage($Language->Phrase("InvalidKeyValue"));
         return FALSE;
     }
     // Check if key value entered
     if ($tbl_ga_stat->hour->CurrentValue == "") {
         $this->setMessage($Language->Phrase("InvalidKeyValue"));
         return FALSE;
     }
     // Check for duplicate key
     $bCheckKey = TRUE;
     $sFilter = $tbl_ga_stat->KeyFilter();
     if ($bCheckKey) {
         $rsChk = $tbl_ga_stat->LoadRs($sFilter);
         if ($rsChk && !$rsChk->EOF) {
             $sKeyErrMsg = str_replace("%f", $sFilter, $Language->Phrase("DupKey"));
             $this->setMessage($sKeyErrMsg);
             $rsChk->Close();
             return FALSE;
         }
     }
     $rsnew = array();
     // id_profile
     $tbl_ga_stat->id_profile->SetDbValueDef($rsnew, $tbl_ga_stat->id_profile->CurrentValue, 0, FALSE);
     // stat_date
     $tbl_ga_stat->stat_date->SetDbValueDef($rsnew, ew_UnFormatDateTime($tbl_ga_stat->stat_date->CurrentValue, 5, FALSE), ew_CurrentDate());
     // year
     $tbl_ga_stat->year->SetDbValueDef($rsnew, $tbl_ga_stat->year->CurrentValue, 0, FALSE);
     // month
     $tbl_ga_stat->month->SetDbValueDef($rsnew, $tbl_ga_stat->month->CurrentValue, 0, FALSE);
     // week
     $tbl_ga_stat->week->SetDbValueDef($rsnew, $tbl_ga_stat->week->CurrentValue, 0, FALSE);
     // day
     $tbl_ga_stat->day->SetDbValueDef($rsnew, $tbl_ga_stat->day->CurrentValue, "", TRUE);
     // hour
     $tbl_ga_stat->hour->SetDbValueDef($rsnew, ew_FormatDateTime($tbl_ga_stat->hour->CurrentValue, 4), ew_CurrentTime(), FALSE);
     // pageview
     $tbl_ga_stat->pageview->SetDbValueDef($rsnew, $tbl_ga_stat->pageview->CurrentValue, 0, FALSE);
     // visit
     $tbl_ga_stat->visit->SetDbValueDef($rsnew, $tbl_ga_stat->visit->CurrentValue, 0, FALSE);
     // Call Row Inserting event
     $bInsertRow = $tbl_ga_stat->Row_Inserting($rsnew);
     if ($bInsertRow) {
         $conn->raiseErrorFn = 'ew_ErrorFn';
         $AddRow = $conn->Execute($tbl_ga_stat->InsertSQL($rsnew));
         $conn->raiseErrorFn = '';
     } else {
         if ($tbl_ga_stat->CancelMessage != "") {
             $this->setMessage($tbl_ga_stat->CancelMessage);
             $tbl_ga_stat->CancelMessage = "";
         } else {
             $this->setMessage($Language->Phrase("InsertCancelled"));
         }
         $AddRow = FALSE;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $tbl_ga_stat->Row_Inserted($rsnew);
     }
     return $AddRow;
 }
Esempio n. 4
0
 function AddRow()
 {
     global $conn, $Security, $exam_data;
     // Check if key value entered
     if ($exam_data->ExamDataNo->CurrentValue == "") {
         $this->setMessage("Invalid key value");
         return FALSE;
     }
     // Check for duplicate key
     $bCheckKey = TRUE;
     $sFilter = $exam_data->KeyFilter();
     if ($bCheckKey) {
         $rsChk = $exam_data->LoadRs($sFilter);
         if ($rsChk && !$rsChk->EOF) {
             $sKeyErrMsg = str_replace("%f", $sFilter, "Duplicate primary key: '%f'");
             $this->setMessage($sKeyErrMsg);
             $rsChk->Close();
             return FALSE;
         }
     }
     $rsnew = array();
     // Field ExamDataNo
     $exam_data->ExamDataNo->SetDbValueDef($exam_data->ExamDataNo->CurrentValue, 0);
     $rsnew['ExamDataNo'] =& $exam_data->ExamDataNo->DbValue;
     // Field AccessionNumber
     $exam_data->AccessionNumber->SetDbValueDef($exam_data->AccessionNumber->CurrentValue, NULL);
     $rsnew['AccessionNumber'] =& $exam_data->AccessionNumber->DbValue;
     // Field PatientMainNo
     $exam_data->PatientMainNo->SetDbValueDef($exam_data->PatientMainNo->CurrentValue, 0);
     $rsnew['PatientMainNo'] =& $exam_data->PatientMainNo->DbValue;
     // Field PatientID
     $exam_data->PatientID->SetDbValueDef($exam_data->PatientID->CurrentValue, NULL);
     $rsnew['PatientID'] =& $exam_data->PatientID->DbValue;
     // Field InstitutionNo
     $exam_data->InstitutionNo->SetDbValueDef($exam_data->InstitutionNo->CurrentValue, 0);
     $rsnew['InstitutionNo'] =& $exam_data->InstitutionNo->DbValue;
     // Field ImageDetailNo
     $exam_data->ImageDetailNo->SetDbValueDef($exam_data->ImageDetailNo->CurrentValue, NULL);
     $rsnew['ImageDetailNo'] =& $exam_data->ImageDetailNo->DbValue;
     // Field PatientKindNo
     $exam_data->PatientKindNo->SetDbValueDef($exam_data->PatientKindNo->CurrentValue, NULL);
     $rsnew['PatientKindNo'] =& $exam_data->PatientKindNo->DbValue;
     // Field PatientSubKindNo
     $exam_data->PatientSubKindNo->SetDbValueDef($exam_data->PatientSubKindNo->CurrentValue, 0);
     $rsnew['PatientSubKindNo'] =& $exam_data->PatientSubKindNo->DbValue;
     // Field PatientTypeNo
     $exam_data->PatientTypeNo->SetDbValueDef($exam_data->PatientTypeNo->CurrentValue, NULL);
     $rsnew['PatientTypeNo'] =& $exam_data->PatientTypeNo->DbValue;
     // Field PatientRoom
     $exam_data->PatientRoom->SetDbValueDef($exam_data->PatientRoom->CurrentValue, NULL);
     $rsnew['PatientRoom'] =& $exam_data->PatientRoom->DbValue;
     // Field DepartmentNo
     $exam_data->DepartmentNo->SetDbValueDef($exam_data->DepartmentNo->CurrentValue, NULL);
     $rsnew['DepartmentNo'] =& $exam_data->DepartmentNo->DbValue;
     // Field DepartmentName
     $exam_data->DepartmentName->SetDbValueDef($exam_data->DepartmentName->CurrentValue, NULL);
     $rsnew['DepartmentName'] =& $exam_data->DepartmentName->DbValue;
     // Field Soap
     $exam_data->Soap->Upload->SaveToSession();
     // Save file value to Session
     if (is_null($exam_data->Soap->Upload->Value)) {
         $rsnew['Soap'] = NULL;
     } else {
         $rsnew['Soap'] = $exam_data->Soap->Upload->Value;
     }
     // Field RequestDoctorID
     $exam_data->RequestDoctorID->SetDbValueDef($exam_data->RequestDoctorID->CurrentValue, NULL);
     $rsnew['RequestDoctorID'] =& $exam_data->RequestDoctorID->DbValue;
     // Field CodeValue
     $exam_data->CodeValue->SetDbValueDef($exam_data->CodeValue->CurrentValue, NULL);
     $rsnew['CodeValue'] =& $exam_data->CodeValue->DbValue;
     // Field SpecialExamID
     $exam_data->SpecialExamID->SetDbValueDef($exam_data->SpecialExamID->CurrentValue, NULL);
     $rsnew['SpecialExamID'] =& $exam_data->SpecialExamID->DbValue;
     // Field SpecialExamName
     $exam_data->SpecialExamName->SetDbValueDef($exam_data->SpecialExamName->CurrentValue, NULL);
     $rsnew['SpecialExamName'] =& $exam_data->SpecialExamName->DbValue;
     // Field SpecialExamDate
     $exam_data->SpecialExamDate->SetDbValueDef(ew_UnFormatDateTime($exam_data->SpecialExamDate->CurrentValue, 5), NULL);
     $rsnew['SpecialExamDate'] =& $exam_data->SpecialExamDate->DbValue;
     // Field ExamDate
     $exam_data->ExamDate->SetDbValueDef(ew_UnFormatDateTime($exam_data->ExamDate->CurrentValue, 5), ew_CurrentDate());
     $rsnew['ExamDate'] =& $exam_data->ExamDate->DbValue;
     // Field ExamTime
     $exam_data->ExamTime->SetDbValueDef(ew_FormatDateTime($exam_data->ExamTime->CurrentValue, 4), ew_CurrentTime());
     $rsnew['ExamTime'] =& $exam_data->ExamTime->DbValue;
     // Field LogDate
     $exam_data->LogDate->SetDbValueDef(ew_UnFormatDateTime($exam_data->LogDate->CurrentValue, 5), ew_CurrentDate());
     $rsnew['LogDate'] =& $exam_data->LogDate->DbValue;
     // Field ModifyUser
     $exam_data->ModifyUser->SetDbValueDef($exam_data->ModifyUser->CurrentValue, NULL);
     $rsnew['ModifyUser'] =& $exam_data->ModifyUser->DbValue;
     // Field ModifyDate
     $exam_data->ModifyDate->SetDbValueDef(ew_UnFormatDateTime($exam_data->ModifyDate->CurrentValue, 5), NULL);
     $rsnew['ModifyDate'] =& $exam_data->ModifyDate->DbValue;
     // Field CreatePart
     $exam_data->CreatePart->SetDbValueDef($exam_data->CreatePart->CurrentValue, "");
     $rsnew['CreatePart'] =& $exam_data->CreatePart->DbValue;
     // Field ModifyPart
     $exam_data->ModifyPart->SetDbValueDef($exam_data->ModifyPart->CurrentValue, "");
     $rsnew['ModifyPart'] =& $exam_data->ModifyPart->DbValue;
     // Field Status
     $exam_data->Status->SetDbValueDef($exam_data->Status->CurrentValue, "");
     $rsnew['Status'] =& $exam_data->Status->DbValue;
     // Call Row Inserting event
     $bInsertRow = $exam_data->Row_Inserting($rsnew);
     if ($bInsertRow) {
         // Field Soap
         $conn->raiseErrorFn = 'ew_ErrorFn';
         $AddRow = $conn->Execute($exam_data->InsertSQL($rsnew));
         $conn->raiseErrorFn = '';
     } else {
         if ($exam_data->CancelMessage != "") {
             $this->setMessage($exam_data->CancelMessage);
             $exam_data->CancelMessage = "";
         } else {
             $this->setMessage("Insert cancelled");
         }
         $AddRow = FALSE;
     }
     if ($AddRow) {
         // Call Row Inserted event
         $exam_data->Row_Inserted($rsnew);
     }
     // Field Soap
     $exam_data->Soap->Upload->RemoveFromSession();
     // Remove file value from Session
     return $AddRow;
 }