Added DocPdf field for caching
This commit is contained in:
@@ -271,6 +271,26 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
private byte[] _DocPdf;
|
||||
public byte[] DocPdf
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DocPdf", true);
|
||||
return _DocPdf;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("DocPdf", true);
|
||||
if (_DocPdf != value)
|
||||
{
|
||||
_DocPdf = value;
|
||||
PropertyHasChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
private int _DocumentEntryCount = 0;
|
||||
/// <summary>
|
||||
/// Count of DocumentEntries for this Document
|
||||
@@ -439,6 +459,7 @@ namespace VEPROMS.CSLA.Library
|
||||
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
|
||||
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
|
||||
//AuthorizationRules.AllowRead(FileExtension, "<Role(s)>");
|
||||
//AuthorizationRules.AllowRead(DocPdf, "<Role(s)>");
|
||||
//AuthorizationRules.AllowWrite(LibTitle, "<Role(s)>");
|
||||
//AuthorizationRules.AllowWrite(DocContent, "<Role(s)>");
|
||||
//AuthorizationRules.AllowWrite(DocAscii, "<Role(s)>");
|
||||
@@ -446,6 +467,7 @@ namespace VEPROMS.CSLA.Library
|
||||
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
|
||||
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
|
||||
//AuthorizationRules.AllowWrite(FileExtension, "<Role(s)>");
|
||||
//AuthorizationRules.AllowWrite(DocPdf, "<Role(s)>");
|
||||
_DocumentExtension.AddAuthorizationRules(AuthorizationRules);
|
||||
}
|
||||
protected override void AddInstanceAuthorizationRules()
|
||||
@@ -534,7 +556,7 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("Error on Document.New", ex);
|
||||
}
|
||||
}
|
||||
public static Document New(string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID, string fileExtension)
|
||||
public static Document New(string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID, string fileExtension, byte[] docPdf)
|
||||
{
|
||||
Document tmp = Document.New();
|
||||
tmp.LibTitle = libTitle;
|
||||
@@ -544,11 +566,12 @@ namespace VEPROMS.CSLA.Library
|
||||
tmp.DTS = dts;
|
||||
tmp.UserID = userID;
|
||||
tmp.FileExtension = fileExtension;
|
||||
tmp.DocPdf = docPdf;
|
||||
return tmp;
|
||||
}
|
||||
public static Document MakeDocument(string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID, string fileExtension)
|
||||
public static Document MakeDocument(string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID, string fileExtension, byte[] docPdf)
|
||||
{
|
||||
Document tmp = Document.New(libTitle, docContent, docAscii, config, dts, userID, fileExtension);
|
||||
Document tmp = Document.New(libTitle, docContent, docAscii, config, dts, userID, fileExtension, docPdf);
|
||||
if (tmp.IsSavable)
|
||||
{
|
||||
Document tmp2 = tmp;
|
||||
@@ -566,18 +589,19 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
public static Document New(string libTitle, byte[] docContent, string docAscii, string config)
|
||||
public static Document New(string libTitle, byte[] docContent, string docAscii, string config, byte[] docPdf)
|
||||
{
|
||||
Document tmp = Document.New();
|
||||
tmp.LibTitle = libTitle;
|
||||
tmp.DocContent = docContent;
|
||||
tmp.DocAscii = docAscii;
|
||||
tmp.Config = config;
|
||||
tmp.DocPdf = docPdf;
|
||||
return tmp;
|
||||
}
|
||||
public static Document MakeDocument(string libTitle, byte[] docContent, string docAscii, string config)
|
||||
public static Document MakeDocument(string libTitle, byte[] docContent, string docAscii, string config, byte[] docPdf)
|
||||
{
|
||||
Document tmp = Document.New(libTitle, docContent, docAscii, config);
|
||||
Document tmp = Document.New(libTitle, docContent, docAscii, config, docPdf);
|
||||
if (tmp.IsSavable)
|
||||
{
|
||||
Document tmp2 = tmp;
|
||||
@@ -702,6 +726,7 @@ namespace VEPROMS.CSLA.Library
|
||||
_UserID = dr.GetString("UserID");
|
||||
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
||||
_FileExtension = dr.GetString("FileExtension");
|
||||
_DocPdf = (byte[])dr.GetValue("DocPdf");
|
||||
_DocumentEntryCount = dr.GetInt32("EntryCount");
|
||||
MarkOld();
|
||||
}
|
||||
@@ -794,6 +819,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (_DTS.Year >= 1753 && _DTS.Year <= 9999) cm.Parameters.AddWithValue("@DTS", _DTS);
|
||||
cm.Parameters.AddWithValue("@UserID", _UserID);
|
||||
cm.Parameters.AddWithValue("@FileExtension", _FileExtension);
|
||||
cm.Parameters.AddWithValue("@DocPdf", _DocPdf);
|
||||
// Output Calculated Columns
|
||||
SqlParameter param_DocID = new SqlParameter("@newDocID", SqlDbType.Int);
|
||||
param_DocID.Direction = ParameterDirection.Output;
|
||||
@@ -820,7 +846,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int docID, string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID, string fileExtension)
|
||||
public static byte[] Add(SqlConnection cn, ref int docID, string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID, string fileExtension, byte[] docPdf)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Document.Add", 0);
|
||||
try
|
||||
@@ -837,6 +863,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
|
||||
cm.Parameters.AddWithValue("@UserID", userID);
|
||||
cm.Parameters.AddWithValue("@FileExtension", fileExtension);
|
||||
cm.Parameters.AddWithValue("@DocPdf", docPdf);
|
||||
// Output Calculated Columns
|
||||
SqlParameter param_DocID = new SqlParameter("@newDocID", SqlDbType.Int);
|
||||
param_DocID.Direction = ParameterDirection.Output;
|
||||
@@ -904,6 +931,7 @@ namespace VEPROMS.CSLA.Library
|
||||
cm.Parameters.AddWithValue("@UserID", _UserID);
|
||||
cm.Parameters.AddWithValue("@LastChanged", _LastChanged);
|
||||
cm.Parameters.AddWithValue("@FileExtension", _FileExtension);
|
||||
cm.Parameters.AddWithValue("@DocPdf", _DocPdf);
|
||||
// Output Calculated Columns
|
||||
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
|
||||
param_LastChanged.Direction = ParameterDirection.Output;
|
||||
@@ -932,15 +960,15 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
if (IsNew)
|
||||
_LastChanged = Document.Add(cn, ref _DocID, _LibTitle, _DocContent, _DocAscii, _Config, _DTS, _UserID, _FileExtension);
|
||||
_LastChanged = Document.Add(cn, ref _DocID, _LibTitle, _DocContent, _DocAscii, _Config, _DTS, _UserID, _FileExtension, _DocPdf);
|
||||
else
|
||||
_LastChanged = Document.Update(cn, ref _DocID, _LibTitle, _DocContent, _DocAscii, _Config, _DTS, _UserID, ref _LastChanged, _FileExtension);
|
||||
_LastChanged = Document.Update(cn, ref _DocID, _LibTitle, _DocContent, _DocAscii, _Config, _DTS, _UserID, ref _LastChanged, _FileExtension, _DocPdf);
|
||||
MarkOld();
|
||||
}
|
||||
if (_DocumentEntries != null) _DocumentEntries.Update(this);
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int docID, string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID, ref byte[] lastChanged, string fileExtension)
|
||||
public static byte[] Update(SqlConnection cn, ref int docID, string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID, ref byte[] lastChanged, string fileExtension, byte[] docPdf)
|
||||
{
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Document.Update", 0);
|
||||
try
|
||||
@@ -959,6 +987,7 @@ namespace VEPROMS.CSLA.Library
|
||||
cm.Parameters.AddWithValue("@UserID", userID);
|
||||
cm.Parameters.AddWithValue("@LastChanged", lastChanged);
|
||||
cm.Parameters.AddWithValue("@FileExtension", fileExtension);
|
||||
cm.Parameters.AddWithValue("@DocPdf", docPdf);
|
||||
// Output Calculated Columns
|
||||
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
|
||||
param_LastChanged.Direction = ParameterDirection.Output;
|
||||
|
@@ -177,6 +177,16 @@ namespace VEPROMS.CSLA.Library
|
||||
return _FileExtension;
|
||||
}
|
||||
}
|
||||
private byte[] _DocPdf;
|
||||
public byte[] DocPdf
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DocPdf", true);
|
||||
return _DocPdf;
|
||||
}
|
||||
}
|
||||
private int _DocumentEntryCount = 0;
|
||||
/// <summary>
|
||||
/// Count of DocumentEntries for this Document
|
||||
@@ -275,6 +285,7 @@ namespace VEPROMS.CSLA.Library
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
_FileExtension = tmp.FileExtension;
|
||||
_DocPdf = tmp.DocPdf;
|
||||
_DocumentInfoExtension.Refresh(this);
|
||||
OnChange();// raise an event
|
||||
}
|
||||
@@ -341,6 +352,7 @@ namespace VEPROMS.CSLA.Library
|
||||
_DTS = dr.GetDateTime("DTS");
|
||||
_UserID = dr.GetString("UserID");
|
||||
_FileExtension = dr.GetString("FileExtension");
|
||||
_DocPdf = (byte[])dr.GetValue("DocPdf");
|
||||
_DocumentEntryCount = dr.GetInt32("EntryCount");
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
Reference in New Issue
Block a user