public static void Save(UUTDescription uut) { string uuid; if (uut != null) { string model = uut.Item.Identification.ModelName; string documentName = BuildAtmlFileName(model); uuid = uut.uuid; Document document = DocumentManager.GetDocument(uuid); if (document != null) { document.DocumentContent = Encoding.UTF8.GetBytes(uut.Serialize()); document.DataState = BASEBean.eDataState.DS_EDIT; document.name = documentName; DocumentManager.SaveDocument(document); } else { AssetIdentificationBean bean = new AssetIdentificationBean(); document = new Document(); document.name = documentName; document.DocumentContent = Encoding.UTF8.GetBytes(uut.Serialize()); document.DocumentType = dbDocument.DocumentType.UUT_DESCRIPTION; document.ContentType = "text/xml"; DocumentManager.SaveDocument(document); bean.assetNumber = model; bean.assetType = "Part"; bean.uuid = Guid.Parse(uuid); bean.DataState = BASEBean.eDataState.DS_ADD; bean.save(); } } }
private void btnValidate_Click(object sender, EventArgs e) { StringBuilder error = new StringBuilder(1024 * 1024 * 6); UUTDescription uut = UUTDescription; if (!SchemaManager.ValidateXml(uut.Serialize(), ATMLCommon.UUTNameSpace, error)) { ATMLErrorForm.ShowValidationMessage( string.Format("The \"{0}\" UUT has failed validation against the {1} ATML schema.", uut.name, ATMLCommon.UUTNameSpace), error.ToString(), "Note: This error will not prevent you from continuing."); } else { MessageBox.Show(@"This UUT generated valid ATML"); } }
public void Edit(Document uutDocument, object obj, bool saveOnCompletion) { UUTDescription uut = obj as UUTDescription; if (uut != null) { UUTDescriptionForm form = new UUTDescriptionForm(); form.UUTDescription = uut; if (DialogResult.OK == form.ShowDialog()) { uut = form.UUTDescription; uutDocument.DocumentContent = Encoding.UTF8.GetBytes(uut.Serialize()); if (saveOnCompletion) { Save(uut); } } } }