Fix bug in vesp_ListUnlinkedItems (getting item when only 1 proc in working draft) & added vesp_PurgeEnhancedDocVersionsAndChildren
Allow insert of HLS before/after Enhanced: User interface for removing links of an enhanced document Enhanced: CSLA interface to unlinking docversion & contents (returns contentlist of affected items) Enhanced: Unlink DocVersion
This commit is contained in:
@@ -1192,6 +1192,66 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("Error on ContentInfoList.DoEnhancedUnlink", ex);
|
||||
}
|
||||
}
|
||||
//////
|
||||
[Serializable()]
|
||||
private class EnhancedDocVersionUnlinkCriteria
|
||||
{
|
||||
public EnhancedDocVersionUnlinkCriteria(int? enhancedDocVersionID)
|
||||
{
|
||||
_EnhancedDocVersionID = enhancedDocVersionID;
|
||||
}
|
||||
private int? _EnhancedDocVersionID;
|
||||
public int? EnhancedDocVersionID
|
||||
{
|
||||
get { return _EnhancedDocVersionID; }
|
||||
set { _EnhancedDocVersionID = value; }
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(EnhancedDocVersionUnlinkCriteria criteria)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "vesp_PurgeEnhancedDocVersionsAndChildren";
|
||||
cm.Parameters.AddWithValue("@EnhanceID", criteria.EnhancedDocVersionID); // note query has 'EnhanceID'
|
||||
cm.CommandTimeout = Database.DefaultTimeout;
|
||||
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
{
|
||||
IsReadOnly = false;
|
||||
while (dr.Read())
|
||||
{
|
||||
ContentInfo contentInfo = new ContentInfo(dr);
|
||||
this.Add(contentInfo);
|
||||
}
|
||||
IsReadOnly = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Database.LogException("EnhancedDocVersionUnlinkCriteria.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("EnhancedDocVersionUnlinkCriteria.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
public static ContentInfoList DoEnhancedDocVersionUnlink(int enhancedDocVersionID)
|
||||
{
|
||||
try
|
||||
{
|
||||
ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new EnhancedDocVersionUnlinkCriteria(enhancedDocVersionID));
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on ContentInfoList.DoEnhancedDocVersionUnlink", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion Enhanced_Unlink
|
||||
}
|
||||
}
|
||||
|
@@ -246,7 +246,46 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public string SearchPath { get { return ""; } }
|
||||
#endregion
|
||||
|
||||
#region UnlinkEnhancedDocVersion
|
||||
// Unlink (clear) enhanced from source for this docversion. Refresh all related cache items.
|
||||
public void DoUnlinkEnhancedDocVersion()
|
||||
{
|
||||
try
|
||||
{
|
||||
// get source docversion id for refresh - used later (check for null, just in case):
|
||||
int sdvid = DocVersionConfig != null && DocVersionConfig.MyEnhancedDocuments.Count > 0 ? DocVersionConfig.MyEnhancedDocuments[0].VersionID : -1;
|
||||
using (ContentInfoList cil = ContentInfoList.DoEnhancedDocVersionUnlink(this.VersionID))
|
||||
{
|
||||
foreach (ContentInfo ci in cil)
|
||||
{
|
||||
using (Content c = ci.Get())
|
||||
{
|
||||
// first refresh configs because the ContentInfo.Refresh causes events to occur that refresh screen
|
||||
// and if configs aren't done first, the screen refresh, if based on config data, will not be correct.
|
||||
foreach (ItemInfo ii in ci.ContentItems) ii.RefreshConfig();
|
||||
ContentInfo.Refresh(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Refresh for this docversion
|
||||
Refresh(DocVersion.Get(this.VersionID));
|
||||
DocVersionConfigRefresh();
|
||||
// Refresh the source document's cache
|
||||
if (sdvid > -1)
|
||||
{
|
||||
using (DocVersion dv = DocVersion.Get(sdvid))
|
||||
{
|
||||
Refresh(dv);
|
||||
dv.MyDocVersionInfo.DocVersionConfigRefresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on DocVersionInfo:DoUnlinkEnhancedDocVersion", ex);
|
||||
}
|
||||
}
|
||||
#endregion UnlinkEnhanced
|
||||
#region DocVersion Config
|
||||
[NonSerialized]
|
||||
private DocVersionConfig _DocVersionConfig;
|
||||
|
Reference in New Issue
Block a user