void VirtualMeasurement::UpdateMeasurementInfo(int iCID, LPCSTR pRawString, CString& szDisplayableResult) { CMeaCol::ColumnID iColumnID = (CMeaCol::ColumnID)iCID; CField* pf = CSelectMeasurement::GetColScheme(iColumnID); bool bMsgBox = false; switch (iColumnID) { case CMeaCol::eItem: break; case CMeaCol::eFacility: if (pf->bSatisfiesConstraints(pRawString)) { l_szUtilCopy(_szMPFacilityName, pRawString, MAX_NAME_LENGTH); } else { bMsgBox = true; } szDisplayableResult = _szMPFacilityName; break; case CMeaCol::eID: if (pf->bSatisfiesConstraints(pRawString)) { l_szUtilCopy(_szMPItemID, pRawString, MAX_ID_LENGTH); } else { bMsgBox = true; } szDisplayableResult = _szMPItemID; break; case CMeaCol::eMeasType: _iMPMeasurementType = tImageToMeasurementType(pRawString); szDisplayableResult.Format(pf->format, _iMPMeasurementType); break; case CMeaCol::eEnrichment: if (pf->bSatisfiesConstraints(pRawString)) { sscanf(pRawString, CSelectMeasurement::GetColScheme(iColumnID)->inputFormat, &_fMPEnrichmentPercent); } else { bMsgBox = true; } szDisplayableResult.Format(pf->format, _fMPEnrichmentPercent); break; case CMeaCol::eBurnUp: if (pf->bSatisfiesConstraints(pRawString)) { CString sp = pRawString; sscanf(pRawString, CSelectMeasurement::GetColScheme(iColumnID)->inputFormat, &_fMPBurnUp); if (_fMPBurnUp == 0.0) { _fMPLogBurnup = DEFAULTBADVALUE; } else { _fMPLogBurnup = log10(_fMPBurnUp); } } else { bMsgBox = true; } szDisplayableResult.Format(pf->format, _fMPBurnUp); break; case CMeaCol::eCycle: if (pf->bSatisfiesConstraints(pRawString)) { sscanf(pRawString, CSelectMeasurement::GetColScheme(iColumnID)->inputFormat, &_iMPCycle); } else { bMsgBox = true; } szDisplayableResult.Format(pf->format, _iMPCycle); break; case CMeaCol::eThresholdA: if (pf->bSatisfiesConstraints(pRawString)) { sscanf(pRawString, CSelectMeasurement::GetColScheme(iColumnID)->inputFormat, &_fMPNChanAThresh); } else { bMsgBox = true; } szDisplayableResult.Format(pf->format, _fMPNChanAThresh); break; case CMeaCol::eThresholdB: if (pf->bSatisfiesConstraints(pRawString)) { sscanf(pRawString, CSelectMeasurement::GetColScheme(iColumnID)->inputFormat, &_fMPNChanBThresh); } else { bMsgBox = true; } szDisplayableResult.Format(pf->format, _fMPNChanBThresh); break; case CMeaCol::eDischDate: if (pf->bSatisfiesConstraints(pRawString)) { CFieldDate::XConvert3(pRawString,_iMPDischargeDateYear, _iMPDischargeDateMonth,_iMPDischargeDateDay); } else { bMsgBox = true; } szDisplayableResult.Format(CFieldDate::DateFormat, _iMPDischargeDateYear, _iMPDischargeDateMonth, _iMPDischargeDateDay); // recompute cooling time and log o c t CalcCoolingTime(); ApplyAdjustments(); break; case CMeaCol::eMeasDate: if (pf->bSatisfiesConstraints(pRawString)) { CFieldDate::XConvert3(pRawString,_iMPMeasurementDateYear, _iMPMeasurementDateMonth,_iMPMeasurementDateDay); } else { bMsgBox = true; } szDisplayableResult.Format(CFieldDate::DateFormat, CLAMP(_iMPMeasurementDateYear,1950,2102), CLAMP(_iMPMeasurementDateMonth,1,12), CLAMP(_iMPMeasurementDateDay,1,31)); break; case CMeaCol::eCoolingTime: if (pf->bSatisfiesConstraints(pRawString)) { sscanf(pRawString,CSelectMeasurement::GetColScheme(iColumnID)->inputFormat, &_fMPCoolingTime); if (_fMPCoolingTime < 0.0f) _fMPCoolingTime = 0.0f; if (_fMPCoolingTime == 0.0f) // added { _fMPLogCoolingTime = DEFAULTBADVALUE; } else _fMPLogCoolingTime = (float)log10(_fMPCoolingTime); // 11 UpdateDischargeDate(); } else { bMsgBox = true; } szDisplayableResult.Format(pf->format, _fMPCoolingTime); break; case CMeaCol::eNeutronA: if (pf->bSatisfiesConstraints(pRawString)) { sscanf(pRawString, CSelectMeasurement::GetColScheme(iColumnID)->inputFormat, &_fMPNChanA); } else { bMsgBox = true; } szDisplayableResult.Format(pf->format, _fMPNChanA); break; case CMeaCol::eNeutronB: if (pf->bSatisfiesConstraints(pRawString)) { sscanf(pRawString, CSelectMeasurement::GetColScheme(iColumnID)->inputFormat, &_fMPNChanB); } else { bMsgBox = true; } szDisplayableResult.Format(pf->format, _fMPNChanB); break; case CMeaCol::eNeutronC: if (pf->bSatisfiesConstraints(pRawString)) { sscanf(pRawString, CSelectMeasurement::GetColScheme(iColumnID)->inputFormat, &_fMPNChanC); } else { bMsgBox = true; } szDisplayableResult.Format(pf->format, _fMPNChanC); break; case CMeaCol::eGamma1: if (pf->bSatisfiesConstraints(pRawString)) { sscanf(pRawString, CSelectMeasurement::GetColScheme(iColumnID)->inputFormat, &_fMPGDose1); } else { bMsgBox = true; } szDisplayableResult.Format(pf->format, _fMPGDose1); break; case CMeaCol::eGamma2: if (pf->bSatisfiesConstraints(pRawString)) { sscanf(pRawString, CSelectMeasurement::GetColScheme(iColumnID)->inputFormat, &_fMPGDose2); } else { bMsgBox = true; } szDisplayableResult.Format( pf->format, _fMPGDose2); break; case CMeaCol::eDetector: if (pf->bSatisfiesConstraints(pRawString)) { l_szUtilCopy(_szMPDetectorID, pRawString, MAX_NAME_LENGTH); } else { bMsgBox = true; } szDisplayableResult = _szMPDetectorID; break; default: break; } if (bMsgBox) { CFDMSApp* pApp = (CFDMSApp*)AfxGetApp(); pApp->MyMessageBox( pf->szGetConstraintDescription(pRawString), MB_OK | MB_ICONEXCLAMATION, (UINT)-1, pf->name); } else MarkInfoAsEdited(iCID); }