C2018-039: Upgrade – User Control of Format
This commit is contained in:
@@ -1357,9 +1357,322 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Enhanced
|
||||
#region Enhanced_UnlinkItems
|
||||
[Serializable()]
|
||||
#region UCF Fix FormatId After Import
|
||||
private class FixFormatIDAfterImportCriteria
|
||||
{
|
||||
private string _DocVersionList;
|
||||
public string DocVersionList
|
||||
{
|
||||
get { return _DocVersionList; }
|
||||
set { _DocVersionList = value; }
|
||||
}
|
||||
private int _OldFormatID;
|
||||
public int OldFormatID
|
||||
{
|
||||
get { return _OldFormatID; }
|
||||
set { _OldFormatID = value; }
|
||||
}
|
||||
private int _NewFormatID;
|
||||
public int NewFormatID
|
||||
{
|
||||
get { return _NewFormatID; }
|
||||
set { _NewFormatID = value; }
|
||||
}
|
||||
public FixFormatIDAfterImportCriteria(string dvlst, int oldfid, int newfid)
|
||||
{
|
||||
_DocVersionList = dvlst;
|
||||
_OldFormatID = oldfid;
|
||||
_NewFormatID = newfid;
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(FixFormatIDAfterImportCriteria criteria)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "vesp_UpdateVersionFormatForUCF";
|
||||
cm.Parameters.AddWithValue("@VersionList", criteria.DocVersionList);
|
||||
cm.Parameters.AddWithValue("@OldFormatID", criteria.OldFormatID);
|
||||
cm.Parameters.AddWithValue("@NewFormatID", criteria.NewFormatID);
|
||||
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("FixFormatIDAfterImport.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("FixFormatIDAfterImport.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
public static ContentInfoList FixFormatIDAfterImport(string dvlst, int oldfid, int newfid)
|
||||
{
|
||||
try
|
||||
{
|
||||
ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new FixFormatIDAfterImportCriteria(dvlst, oldfid, newfid));
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on ContentInfoList.FixFormatIDAfterImport", ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region UCF Clear Overwridden Formats
|
||||
private class ClearOverrideFormatsByFolderCriteria
|
||||
{
|
||||
public ClearOverrideFormatsByFolderCriteria(int folderID, int? formatID, int? newformatID)
|
||||
{
|
||||
_FormatID = formatID;
|
||||
_FolderID = folderID;
|
||||
_NewFormatID = newformatID;
|
||||
}
|
||||
private int? _FormatID;
|
||||
public int? FormatID
|
||||
{
|
||||
get { return _FormatID; }
|
||||
set { _FormatID = value; }
|
||||
}
|
||||
private int? _NewFormatID;
|
||||
public int? NewFormatID
|
||||
{
|
||||
get { return _NewFormatID; }
|
||||
set { _NewFormatID = value; }
|
||||
}
|
||||
private int _FolderID;
|
||||
public int FolderID
|
||||
{
|
||||
get { return _FolderID; }
|
||||
set { _FolderID = value; }
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(ClearOverrideFormatsByFolderCriteria criteria)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "vesp_ClearOverrideFormatsByFolder";
|
||||
cm.Parameters.AddWithValue("@FolderID", criteria.FolderID);
|
||||
if (criteria.FormatID == null)
|
||||
cm.Parameters.AddWithValue("@FormatID", DBNull.Value);
|
||||
else
|
||||
cm.Parameters.AddWithValue("@FormatID", criteria.FormatID);
|
||||
if (criteria.NewFormatID == null)
|
||||
cm.Parameters.AddWithValue("@NewFormatID", DBNull.Value);
|
||||
else
|
||||
cm.Parameters.AddWithValue("@NewFormatID", criteria.NewFormatID);
|
||||
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("ClearOverrideFormatsByFolderCriteria.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("ClearOverrideFormatsByFolderCriteria.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
public static ContentInfoList ClearOverrideFormatsByFolder(int folderID, int? formatID, int? newformatID)
|
||||
{
|
||||
try
|
||||
{
|
||||
ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new ClearOverrideFormatsByFolderCriteria(folderID, formatID, newformatID));
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on ContentInfoList.ClearOverrideFormatsByFolder", ex);
|
||||
}
|
||||
}
|
||||
private class ClearOverrideFormatsByDocVersionCriteria
|
||||
{
|
||||
public ClearOverrideFormatsByDocVersionCriteria(string dvlist, int? formatID, int?newformatID)
|
||||
{
|
||||
_FormatID = formatID;
|
||||
_DVList = dvlist;
|
||||
_NewFormatID = newformatID;
|
||||
}
|
||||
private int? _FormatID;
|
||||
public int? FormatID
|
||||
{
|
||||
get { return _FormatID; }
|
||||
set { _FormatID = value; }
|
||||
}
|
||||
private int? _NewFormatID;
|
||||
public int? NewFormatID
|
||||
{
|
||||
get { return _NewFormatID; }
|
||||
set { _NewFormatID = value; }
|
||||
}
|
||||
private string _DVList;
|
||||
public string DVList
|
||||
{
|
||||
get { return _DVList; }
|
||||
set { _DVList = value; }
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(ClearOverrideFormatsByDocVersionCriteria criteria)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "vesp_ClearOverrideFormatsByDocVersion";
|
||||
cm.Parameters.AddWithValue("@DocVersionList", criteria.DVList);
|
||||
if (criteria.FormatID == null)
|
||||
cm.Parameters.AddWithValue("@FormatID", DBNull.Value);
|
||||
else
|
||||
cm.Parameters.AddWithValue("@FormatID", criteria.FormatID);
|
||||
if (criteria.NewFormatID == null)
|
||||
cm.Parameters.AddWithValue("@NewFormatID", DBNull.Value);
|
||||
else
|
||||
cm.Parameters.AddWithValue("@NewFormatID", criteria.NewFormatID);
|
||||
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("ClearOverrideFormatsByDocVersion.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("ClearOverrideFormatsByDocVersion.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
public static ContentInfoList ClearOverrideFormatsByDocVersion(string dvlist, int? formatID, int? newformatID)
|
||||
{
|
||||
try
|
||||
{
|
||||
ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new ClearOverrideFormatsByDocVersionCriteria(dvlist, formatID, newformatID));
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on ContentInfoList.ClearOverrideFormatsByDocVersion", ex);
|
||||
}
|
||||
}
|
||||
private class ClearOverrideFormatsByItemCriteria
|
||||
{
|
||||
public ClearOverrideFormatsByItemCriteria(int itemID, int? formatID, int? newformatID)
|
||||
{
|
||||
_FormatID = formatID;
|
||||
_NewFormatID = newformatID;
|
||||
_ItemID = itemID;
|
||||
}
|
||||
private int? _FormatID;
|
||||
public int? FormatID
|
||||
{
|
||||
get { return _FormatID; }
|
||||
set { _FormatID = value; }
|
||||
}
|
||||
private int? _NewFormatID;
|
||||
public int? NewFormatID
|
||||
{
|
||||
get { return _NewFormatID; }
|
||||
set { _NewFormatID = value; }
|
||||
}
|
||||
private int _ItemID;
|
||||
public int ItemID
|
||||
{
|
||||
get { return _ItemID; }
|
||||
set { _ItemID = value; }
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(ClearOverrideFormatsByItemCriteria criteria)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "vesp_ClearOverrideFormatsByItem";
|
||||
cm.Parameters.AddWithValue("@ItemID", criteria.ItemID);
|
||||
if (criteria.FormatID == null)
|
||||
cm.Parameters.AddWithValue("@FormatID", DBNull.Value);
|
||||
else
|
||||
cm.Parameters.AddWithValue("@FormatID", criteria.FormatID);
|
||||
if (criteria.NewFormatID == null)
|
||||
cm.Parameters.AddWithValue("@NewFormatID", DBNull.Value);
|
||||
else
|
||||
cm.Parameters.AddWithValue("@NewFormatID", criteria.NewFormatID);
|
||||
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("ClearOverrideFormatsByItem.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("ClearOverrideFormatsByItem.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
public static ContentInfoList ClearOverrideFormatsByItem(int itemID, int? formatID, int? newformatID)
|
||||
{
|
||||
try
|
||||
{
|
||||
ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new ClearOverrideFormatsByItemCriteria(itemID, formatID, newformatID));
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on ContentInfoList.ClearOverrideFormatsByItem", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
#region Enhanced
|
||||
#region Enhanced_UnlinkItems
|
||||
[Serializable()]
|
||||
private class EnhancedUnlinkCriteria
|
||||
{
|
||||
public EnhancedUnlinkCriteria(int? enhancedID)
|
||||
|
Reference in New Issue
Block a user