C2024-005-Annotations-Cleanup-2
This commit is contained in:
@@ -225,6 +225,86 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("Error on Annotation.Delete", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeleteAnnotationProcByType(int typID, string procList)
|
||||
{
|
||||
if (!CanDeleteObject())
|
||||
throw new System.Security.SecurityException("User not authorized to remove a Annotation");
|
||||
try
|
||||
{
|
||||
DataPortal.Delete(new DeleteAnnotationProcByTypeCriteria(typID, procList));
|
||||
AnnotationInfo.StaticOnInfoChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Data.SqlClient.SqlException exSQL = SqlException(ex);
|
||||
if (exSQL != null && exSQL.Message.Contains("###Cannot Delete Item###"))
|
||||
throw exSQL;
|
||||
Console.WriteLine("AnnotationExt: Stacktrace = {0}", ex.StackTrace);
|
||||
throw new DbCslaException("Error on Annotation.Delete", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeleteAnnotationDocvByType(int typID, string versionID)
|
||||
{
|
||||
if (!CanDeleteObject())
|
||||
throw new System.Security.SecurityException("User not authorized to remove a Annotation");
|
||||
try
|
||||
{
|
||||
DataPortal.Delete(new DeleteAnnotationDocvByTypeCriteria(typID, versionID));
|
||||
AnnotationInfo.StaticOnInfoChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Data.SqlClient.SqlException exSQL = SqlException(ex);
|
||||
if (exSQL != null && exSQL.Message.Contains("###Cannot Delete Item###"))
|
||||
throw exSQL;
|
||||
Console.WriteLine("AnnotationExt: Stacktrace = {0}", ex.StackTrace);
|
||||
throw new DbCslaException("Error on Annotation.Delete", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getAnnotationProcCnt(int typID, string procList)
|
||||
{
|
||||
if (!CanGetObject())
|
||||
throw new System.Security.SecurityException("User not authorized to remove a Annotation");
|
||||
try
|
||||
{
|
||||
Annotation ProcCnt = DataPortal.Fetch<Annotation>(new getAnnotationCountProcCriteria(typID, procList));
|
||||
AnnotationInfo.StaticOnInfoChanged();
|
||||
return Annotation.ProcCnt;
|
||||
//return Int32.Parse(ProcCnt);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Data.SqlClient.SqlException exSQL = SqlException(ex);
|
||||
if (exSQL != null && exSQL.Message.Contains("###Cannot retrieve Item###"))
|
||||
throw exSQL;
|
||||
Console.WriteLine("AnnotationExt: Stacktrace = {0}", ex.StackTrace);
|
||||
throw new DbCslaException("Error on getAnnotationCountProcCriteria", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getAnnotationCountDocv(int typID, string procList)
|
||||
{
|
||||
if (!CanGetObject())
|
||||
throw new System.Security.SecurityException("User not authorized to remove a Annotation");
|
||||
try
|
||||
{
|
||||
Annotation DocvCnt = DataPortal.Fetch<Annotation>(new getAnnotationCountDocvCriteria(typID, procList));
|
||||
AnnotationInfo.StaticOnInfoChanged();
|
||||
return Annotation.DocvCnt;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Data.SqlClient.SqlException exSQL = SqlException(ex);
|
||||
if (exSQL != null && exSQL.Message.Contains("###Cannot retrieve Item###"))
|
||||
throw exSQL;
|
||||
Console.WriteLine("AnnotationExt: Stacktrace = {0}", ex.StackTrace);
|
||||
throw new DbCslaException("Error on getAnnotationCountDocvCriteria", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static System.Data.SqlClient.SqlException SqlException(Exception ex)
|
||||
{
|
||||
Type sqlExType = typeof(System.Data.SqlClient.SqlException);
|
||||
@@ -280,12 +360,209 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("Item.DataPortal_Delete", ex);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable()]
|
||||
protected class DeleteAnnotationProcByTypeCriteria
|
||||
{
|
||||
private int _typeID;
|
||||
public int TypeID
|
||||
{ get { return _typeID; } }
|
||||
|
||||
private string _procList;
|
||||
public string ProcList
|
||||
{ get { return _procList; } }
|
||||
public DeleteAnnotationProcByTypeCriteria(int typeID, string procList)
|
||||
{
|
||||
_typeID = typeID;
|
||||
_procList = procList;
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(DeleteAnnotationProcByTypeCriteria criteria)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Item.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandTimeout = Database.SQLTimeout;
|
||||
cm.CommandText = "deleteAnnotationsProcByType";
|
||||
cm.Parameters.AddWithValue("@typeid", criteria.TypeID);
|
||||
cm.Parameters.AddWithValue("@procList", criteria.ProcList);
|
||||
cm.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Item.DataPortal_Delete Annotations by group", ex);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable()]
|
||||
protected class DeleteAnnotationDocvByTypeCriteria
|
||||
{
|
||||
private int _typeID;
|
||||
public int TypeID
|
||||
{ get { return _typeID; } }
|
||||
|
||||
private string _versionID;
|
||||
public string VersionID
|
||||
{ get { return _versionID; } }
|
||||
public DeleteAnnotationDocvByTypeCriteria(int typeID, string versionID)
|
||||
{
|
||||
_typeID = typeID;
|
||||
_versionID = versionID;
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(DeleteAnnotationDocvByTypeCriteria criteria)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Delete Annotations by Type Docv", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandTimeout = Database.SQLTimeout;
|
||||
cm.CommandText = "deleteAnnotationsDocvByType";
|
||||
cm.Parameters.AddWithValue("@typeid", criteria.TypeID);
|
||||
cm.Parameters.AddWithValue("@docvList", criteria.VersionID);
|
||||
cm.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Item.DataPortal_Delete Annotations by type Docv", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static int _procCnt;
|
||||
public static int ProcCnt
|
||||
{
|
||||
get { return _procCnt; }
|
||||
set { _procCnt = value; }
|
||||
}
|
||||
|
||||
[Serializable()]
|
||||
protected class getAnnotationCountProcCriteria
|
||||
{
|
||||
private int _procCnt;
|
||||
public int ProcCnt
|
||||
{ get { return _procCnt; }
|
||||
set { _procCnt = value; }
|
||||
}
|
||||
private int _typeID;
|
||||
public int TypeID
|
||||
{ get { return _typeID; } }
|
||||
private string _procList;
|
||||
public string ProcList
|
||||
{ get { return _procList; } }
|
||||
public getAnnotationCountProcCriteria(int typeID, string procList, int procCnt = 0)
|
||||
{
|
||||
_typeID = typeID;
|
||||
_procList = procList;
|
||||
_procCnt = procCnt;
|
||||
}
|
||||
}
|
||||
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private getAnnotationCountProcCriteria DataPortal_Fetch(getAnnotationCountProcCriteria criteria)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Item.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
//int ProcCnt;
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandTimeout = Database.SQLTimeout;
|
||||
cm.CommandText = "getAnnotationProcCount";
|
||||
cm.Parameters.AddWithValue("@procList", criteria.ProcList);
|
||||
cm.Parameters.AddWithValue("@typeid", criteria.TypeID);
|
||||
Annotation.ProcCnt = (int)cm.ExecuteScalar();
|
||||
|
||||
}
|
||||
}
|
||||
return criteria; //_procCnt.ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Annotation.GetAnnotationProcCnt", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Annotation.GetAnnotationProcCnt by group", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static int _docvCnt;
|
||||
public static int DocvCnt
|
||||
{ get { return _docvCnt; }
|
||||
set { _docvCnt = value; }
|
||||
}
|
||||
|
||||
[Serializable()]
|
||||
protected class getAnnotationCountDocvCriteria
|
||||
{
|
||||
private int _docvCnt;
|
||||
public int DocvCnt
|
||||
{ get { return _docvCnt; }
|
||||
set { _docvCnt = value; }
|
||||
}
|
||||
private int _TypeID;
|
||||
public int TypeID
|
||||
{ get { return _TypeID; } }
|
||||
private string _docvList;
|
||||
public string DocvList
|
||||
{ get { return _docvList; } }
|
||||
public getAnnotationCountDocvCriteria(int typeID, string docvList, int docvCnt = 0)
|
||||
{
|
||||
_TypeID = typeID;
|
||||
_docvList = docvList;
|
||||
_docvCnt = docvCnt;
|
||||
}
|
||||
}
|
||||
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private getAnnotationCountDocvCriteria DataPortal_Fetch(getAnnotationCountDocvCriteria criteria)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Annotation.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
//int ProcCnt;
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandTimeout = Database.SQLTimeout;
|
||||
cm.CommandText = "getAnnotationDocvCount";
|
||||
cm.Parameters.AddWithValue("@typeid", criteria.TypeID);
|
||||
cm.Parameters.AddWithValue("@DocvList", criteria.DocvList);
|
||||
Annotation.DocvCnt = (int)cm.ExecuteScalar();
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Item.DataPortal_Delete Annotations by group", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
//public partial class AnnotationTypeAnnotations
|
||||
//{
|
||||
// public static int GetAnnotationID()
|
||||
// {
|
||||
// return AnnotationTypeAnnotat
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user