C2025-024 Electronic Procedures Phase 2 - XML Export

Export code cleanup and initial set RO Location code
This commit is contained in:
Matthew Schill 2025-07-15 13:31:12 -04:00
parent ec8e4c36a4
commit 00283b4f28
2 changed files with 76 additions and 1411 deletions

File diff suppressed because it is too large Load Diff

View File

@ -246,26 +246,21 @@ namespace VEPROMS
}
//For Exporting an RO that is an image
//returns an xmlElement
// - that is a child to xindivid
// - that has a name of Name
// - that has a value of the binary representation of the image
// - that has an attribute designating the location of the image file
private XmlElement AddGraphic(XmlElement xindivid, string Name, ROFSTLookup.rochild roc, RODbInfo rodb, bool isMulti)
//returns the Location and FileName of the RO Image
private string GetROImageFileLocation(ROFSTLookup.rochild roc, RODbInfo rodb, bool isMulti)
{
XmlElement xroid = xindivid.OwnerDocument.CreateElement(Name);
string rodbpath = rodb.FolderPath;
string rocval = roc.value;
if (rocval == null) rocval = Array.Find(roc.children, x => x.value.Contains('.')).value;
if (rocval == null) return xroid;
if (rocval == null) return "";
string imgname;
if (isMulti)
{
{
imgname = rocval.Substring(rocval.IndexOf(' ') + 1, rocval.IndexOf("\r\n") - rocval.IndexOf(' ') - 1);
}
else
else
{
imgname = rocval.Substring(0, rocval.IndexOf('\n'));
}
@ -278,6 +273,21 @@ namespace VEPROMS
}
string imgfile = Path.Combine(rodbpath, fname);
return imgfile;
}
//For Exporting an RO that is an image
//returns an xmlElement
// - that is a child to xindivid
// - that has a name of Name
// - that has a value of the binary representation of the image
// - that has an attribute designating the location of the image file
private XmlElement AddGraphic(XmlElement xindivid, string Name, ROFSTLookup.rochild roc, RODbInfo rodb, bool isMulti)
{
XmlElement xroid = xindivid.OwnerDocument.CreateElement(Name);
string imgfile = GetROImageFileLocation(roc, rodb, isMulti);
if (string.IsNullOrEmpty(imgfile)) return xroid;
xroid.Attributes.SetNamedItem(AddAttribute(xroid.OwnerDocument, "Location", imgfile));
if (File.Exists(imgfile))
@ -293,6 +303,12 @@ namespace VEPROMS
return xroid;
}
protected override void SetROLocation(ref XmlElement xindivid, ROFSTLookup.rochild roc, RODbInfo rodb, bool isMulti)
{
string imgfile = GetROImageFileLocation(roc, rodb, isMulti);
if (!string.IsNullOrEmpty(imgfile)) xindivid.Attributes.SetNamedItem(AddAttribute(xindivid.OwnerDocument, "Location", imgfile));
}
//clear objects to release memory
private void OnClose(object sender, EventArgs e)
{