Moved DocPDF from Documents to PDFs table

Moved DocPDF from Documents to new PDFs table
This commit is contained in:
Rich
2011-04-18 21:30:48 +00:00
parent f4a3a969f4
commit 628cfc67de
5 changed files with 203 additions and 66 deletions

View File

@@ -176,16 +176,6 @@ 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 _DocumentDROUsageCount = 0;
/// <summary>
/// Count of DocumentDROUsages for this Document
@@ -262,6 +252,44 @@ namespace VEPROMS.CSLA.Library
foreach (DocumentInfo tmp in _CacheByPrimaryKey[_DocID.ToString()])
tmp._DocumentEntryCount = -1; // This will cause the data to be requeried
}
private int _DocumentPdfCount = 0;
/// <summary>
/// Count of DocumentPdfs for this Document
/// </summary>
public int DocumentPdfCount
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("DocumentPdfCount", true);
if (_DocumentPdfCount < 0)
_DocumentPdfCount = DocumentPdfs.Count;
return _DocumentPdfCount;
}
}
private PdfInfoList _DocumentPdfs = null;
[TypeConverter(typeof(PdfInfoListConverter))]
public PdfInfoList DocumentPdfs
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("DocumentPdfs", true);
if (_DocumentPdfCount < 0 || (_DocumentPdfCount > 0 && _DocumentPdfs == null))
_DocumentPdfs = PdfInfoList.GetByDocID(_DocID);
if (_DocumentPdfCount < 0)
_DocumentPdfCount = _DocumentPdfs.Count;
return _DocumentPdfs;
}
}
public void RefreshDocumentPdfs()
{
_DocumentPdfCount = -1;
ConvertListToDictionary();
if (_CacheByPrimaryKey.ContainsKey(_DocID.ToString()))
foreach (DocumentInfo tmp in _CacheByPrimaryKey[_DocID.ToString()])
tmp._DocumentPdfCount = -1; // This will cause the data to be requeried
}
// CSLATODO: Replace base DocumentInfo.ToString function as necessary
/// <summary>
/// Overrides Base ToString
@@ -322,7 +350,6 @@ namespace VEPROMS.CSLA.Library
_DTS = tmp.DTS;
_UserID = tmp.UserID;
_FileExtension = tmp.FileExtension;
_DocPdf = tmp.DocPdf;
_DocumentInfoExtension.Refresh(this);
OnChange();// raise an event
}
@@ -389,9 +416,9 @@ namespace VEPROMS.CSLA.Library
_DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID");
_FileExtension = dr.GetString("FileExtension");
_DocPdf = (byte[])dr.GetValue("DocPdf");
_DocumentDROUsageCount = dr.GetInt32("DROUsageCount");
_DocumentEntryCount = dr.GetInt32("EntryCount");
_DocumentPdfCount = dr.GetInt32("PdfCount");
}
catch (Exception ex)
{