B2018-025: Proms crashes opening Working Draft if associated enhanced Working Draft had been deleted
This commit is contained in:
@@ -19,12 +19,24 @@ namespace VEPROMS.CSLA.Library
|
||||
DVEnhancedDocuments eds = new DVEnhancedDocuments();
|
||||
foreach (XmlNode xn in _Xp.XmlContents.SelectNodes("//Enhanced"))
|
||||
{
|
||||
eds.Add( xn.Attributes["Name"].Value,
|
||||
int.Parse(xn.Attributes["Type"].Value),
|
||||
int.Parse(xn.Attributes["VersionID"].Value),
|
||||
int.Parse(xn.Attributes["PdfX"].Value),
|
||||
xn.Attributes["PdfToken"].Value
|
||||
);
|
||||
int dvid = int.Parse(xn.Attributes["VersionID"].Value);
|
||||
DocVersionInfo dvi = DocVersionInfo.Get(dvid);
|
||||
if (dvi != null)
|
||||
{
|
||||
eds.Add(xn.Attributes["Name"].Value,
|
||||
int.Parse(xn.Attributes["Type"].Value),
|
||||
int.Parse(xn.Attributes["VersionID"].Value),
|
||||
int.Parse(xn.Attributes["PdfX"].Value),
|
||||
xn.Attributes["PdfToken"].Value
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// B2018-025: If there is config data in the source pointing to a non-existent enhanced, remove
|
||||
// this from the internal data structure so no errors will occur:
|
||||
XmlNode xnx = _Xp.XmlContents.SelectSingleNode(string.Format("//Enhanced[@VersionID='{0}']", dvid));
|
||||
xnx.ParentNode.RemoveChild(xnx);
|
||||
}
|
||||
}
|
||||
return eds;
|
||||
}
|
||||
@@ -103,6 +115,17 @@ namespace VEPROMS.CSLA.Library
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class DocVersionConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
|
||||
{
|
||||
// B2018-025: Allow refresh of enhanced document data structure, RefreshMyEnhancedDocuments, and remove link data, RemoveEnhancedLink.
|
||||
public void RefreshMyEnhancedDocuments()
|
||||
{
|
||||
_MyEnhancedDocuments = null;
|
||||
}
|
||||
public void RemoveEnhancedLink(int dvid)
|
||||
{
|
||||
// from this config, remove the link to the input dvid:
|
||||
XmlNode xnx = _Xp.XmlContents.SelectSingleNode(string.Format("//Enhanced[@VersionID='{0}']", dvid));
|
||||
xnx.ParentNode.RemoveChild(xnx);
|
||||
}
|
||||
private DVEnhancedDocuments _MyEnhancedDocuments = null;
|
||||
public DVEnhancedDocuments MyEnhancedDocuments
|
||||
{
|
||||
|
Reference in New Issue
Block a user