public string InitializeTestStaion(string stationType,
string station,
string changeNo,
string dateEntry,
string fst)
{
string refNo = "";
bool usesRF = false;
bool usesCNI = false;
bool usesEO = false;
bool usesHPDTS = false;
bool usesSGMA = false;
bool isHybrid = false;
bool isRTCass = false;
bool isECass = false;
stationType = stationType.ToUpper();
station = station.ToUpper();
if (string.IsNullOrWhiteSpace(station))
station = CASS;
if (string.IsNullOrWhiteSpace(stationType))
stationType = station;
usesRF = stationType.Contains(RF);
usesCNI = stationType.Contains(CNI);
usesEO = stationType.Contains(EO);
usesHPDTS = stationType.Contains(HPDTS);
usesSGMA = stationType.Contains(SGMA);
isHybrid = stationType.Contains(HYBRID);
isRTCass = stationType.Contains(RTCASS);
isECass = stationType.Contains(ECASS);
if (!isRTCass && stationType.Contains(CASS))
station = CASS;
else if (isRTCass)
station = RTCASS;
else if (isECass)
station = ECASS;
else if (isHybrid)
station = HYBRID;
if (usesRF)
station = station + "_" + RF;
if (usesCNI)
station = station + "_" + CNI;
if (usesEO)
station = station + "_" + EO;
if (usesHPDTS)
station = station + "_" + HPDTS;
if (usesSGMA)
station = station + "_" + SGMA;
const string assetType = "Model";
const string contentType = "text/xml";
string documentType = Enum.GetName(typeof (dbDocument.DocumentType),
dbDocument.DocumentType.TEST_STATION_DESCRIPTION);
AssetIdentificationBean asset = DocumentManager.FindAsset(assetType, station);
if (asset != null)
{
refNo = asset.uuid.ToString();
}
else
{
refNo = DocumentManager.CreateDocumentPlaceHolder
(
station, //Part Number
assetType, //Asset Type
contentType, //Content Type
documentType, //Document Type
station + " 1671.6 Test Station Description" //Description
);
var ts = new TestStationDescription11();
ts.Identification = new ItemDescriptionIdentification();
ts.name = station;
ts.uuid = refNo;
ts.Identification.ModelName = station;
Document document = DocumentManager.GetDocument(refNo);
document.DocumentContent = Encoding.UTF8.GetBytes(ts.Serialize());
DocumentManager.SaveDocument(document);
}
return refNo;
}