B2018-025: Proms crashes opening Working Draft if associated enhanced Working Draft had been deleted
This commit is contained in:
parent
181008c9f9
commit
60b83e9926
@ -60,6 +60,7 @@ namespace VEPROMS
|
||||
public frmVersionsProperties(DocVersionConfig docVersionConfig)
|
||||
{
|
||||
_DocVersionConfig = docVersionConfig;
|
||||
docVersionConfig.RefreshMyEnhancedDocuments();
|
||||
_Initializing = true;
|
||||
InitializeComponent();
|
||||
btnGeneral.PerformClick(); // always start with General tab or button
|
||||
@ -195,6 +196,7 @@ namespace VEPROMS
|
||||
dvc.SaveDVEnhancedDocuments();
|
||||
dv.Config = dvc.ToString();
|
||||
dv.Save();
|
||||
DocVersionInfo.Refresh(dv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,10 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
DVEnhancedDocuments eds = new DVEnhancedDocuments();
|
||||
foreach (XmlNode xn in _Xp.XmlContents.SelectNodes("//Enhanced"))
|
||||
{
|
||||
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),
|
||||
@ -26,6 +30,14 @@ namespace VEPROMS.CSLA.Library
|
||||
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;
|
||||
}
|
||||
public DVEnhancedDocument GetByType(int type)
|
||||
@ -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
|
||||
{
|
||||
|
@ -2950,7 +2950,23 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
foreach (DVEnhancedDocument dve in dvc.MyEnhancedDocuments)
|
||||
{
|
||||
if (dve.Type != 0) DocVersion.Delete(dve.VersionID);
|
||||
if (dve.Type != 0)
|
||||
DocVersion.Delete(dve.VersionID);
|
||||
else
|
||||
{
|
||||
// B2018-025: for the input source docversion (id), clear out its enhanced document link information
|
||||
// dvi is the source, remove this (_LastDocVersionInfo) background link from the source's config
|
||||
DocVersionInfo dvi = DocVersionInfo.Get(dve.VersionID);
|
||||
DocVersionConfig dvci = dvi.MyConfig as DocVersionConfig;
|
||||
dvci.RemoveEnhancedLink(_LastDocVersionInfo.VersionID);
|
||||
string dvccfg = dvci.ToString();
|
||||
using (DocVersion dv = dvi.Get())
|
||||
{
|
||||
dv.Config = dvccfg;
|
||||
dv.Save();
|
||||
DocVersionInfo.Refresh(dv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DocVersion.Delete(_LastDocVersionInfo.VersionID);
|
||||
|
Loading…
x
Reference in New Issue
Block a user