B2022-049: Copy/paste of enhanced procedure and bad links between source and enhanced
This commit is contained in:
@@ -1718,9 +1718,11 @@ namespace VEPROMS.CSLA.Library
|
||||
[Serializable()]
|
||||
private class EnhancedUnlinkCriteria
|
||||
{
|
||||
public EnhancedUnlinkCriteria(int? enhancedID)
|
||||
public EnhancedUnlinkCriteria(int? enhancedID, int? enhType, bool onlyCur)
|
||||
{
|
||||
_EnhancedID = enhancedID;
|
||||
_EnhType = enhType;
|
||||
_OnlyCur = onlyCur;
|
||||
}
|
||||
private int? _EnhancedID;
|
||||
public int? EnhancedID
|
||||
@@ -1728,10 +1730,58 @@ namespace VEPROMS.CSLA.Library
|
||||
get { return _EnhancedID; }
|
||||
set { _EnhancedID = value; }
|
||||
}
|
||||
private int? _EnhType;
|
||||
public int? EnhType
|
||||
{
|
||||
get { return _EnhType; }
|
||||
set { _EnhType = value; }
|
||||
}
|
||||
private bool _OnlyCur;
|
||||
public bool OnlyCur
|
||||
{
|
||||
get { return _OnlyCur; }
|
||||
set { _OnlyCur = value; }
|
||||
}
|
||||
}
|
||||
|
||||
private void DataPortal_Fetch(EnhancedUnlinkCriteria criteria)
|
||||
{
|
||||
// B2022-049: Copy/paste of enhanced procedure and bad links between source and enhanced. To fix this problem,
|
||||
// a sql script was added 'vesp_PurgeProcLinkedItemsAndChildren' that only removes link information within the
|
||||
// input procedure, i.e. does not remove them from linked procedure.
|
||||
if (criteria.OnlyCur)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "vesp_PurgeProcLinkedItemsAndChildren";
|
||||
cm.Parameters.AddWithValue("@EnhanceID", criteria.EnhancedID); // note query had 'EnhanceID', not 'EnhancedID'
|
||||
cm.Parameters.AddWithValue("@EnhType", criteria.EnhType);
|
||||
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("EnhancedUnlinkCriteria.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("EnhancedUnlinkCriteria.DataPortal_Fetch", ex);
|
||||
}
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@@ -1762,11 +1812,11 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
|
||||
public static ContentInfoList DoEnhancedUnlink(int enhancedID)
|
||||
public static ContentInfoList DoEnhancedUnlink(int enhancedID, int enhType, bool onlyCur)
|
||||
{
|
||||
try
|
||||
{
|
||||
ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new EnhancedUnlinkCriteria(enhancedID));
|
||||
ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new EnhancedUnlinkCriteria(enhancedID, enhType, onlyCur));
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
Reference in New Issue
Block a user