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:
2016-05-11 12:25:58 +00:00
parent 6822406b9e
commit 0596efdd04
7 changed files with 615 additions and 410 deletions

View File

@@ -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
}
}