B2016-122: from Document Version Properties form: click OK crashes if remove enhanced links done first.

B2016-122: Added a DocVersion.GetFromDB to get data directly from db (not from cache)
Support subsections when setting context menu items for enhanced links
This commit is contained in:
2016-05-17 11:29:30 +00:00
parent cd523e12a6
commit f4b05839fa
4 changed files with 107 additions and 80 deletions

View File

@@ -22,6 +22,25 @@ namespace VEPROMS.CSLA.Library
{
public partial class DocVersion : IVEDrillDown
{
public static DocVersion GetFromDB(int versionID) // get data from database (don't look in cache first)
{
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a DocVersion");
try
{
DocVersion tmp = DataPortal.Fetch<DocVersion>(new PKCriteria(versionID));
if (tmp.ErrorMessage == "No Record Found")
{
tmp.Dispose(); // Clean-up DocVersion
tmp = null;
}
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on DocVersion.Get", ex);
}
}
public bool NewerRoFst
{
get
@@ -267,16 +286,17 @@ namespace VEPROMS.CSLA.Library
}
}
}
// Refresh for this docversion
Refresh(DocVersion.Get(this.VersionID));
DocVersionConfigRefresh();
// Refresh the source document's cache
// Refresh this docversioninfo. Note that this and below refresh use a docversion retrieved from the
// database, i.e. 'GetFromDB'. This was necessary since this dialog is working with docversion writable
// objects.
DocVersionInfo.Refresh(DocVersion.GetFromDB(this.VersionID));
// Refresh the source document's docversioninfo
if (sdvid > -1)
{
using (DocVersion dv = DocVersion.Get(sdvid))
using (DocVersion dv = DocVersion.GetFromDB(sdvid))
{
Refresh(dv);
dv.MyDocVersionInfo.DocVersionConfigRefresh();
DocVersionInfo.Refresh(dv);
}
}
}