CSLA - Extension
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using Csla;
|
||||
using Csla.Data;
|
||||
using Csla.Validation;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
@@ -14,8 +9,6 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
public static void DeleteAll(int docID)
|
||||
{
|
||||
if (!CanDeleteObject())
|
||||
throw new System.Security.SecurityException("User not authorized to remove a Pdf");
|
||||
try
|
||||
{
|
||||
DataPortal.Delete(new DocIDCriteria(docID));
|
||||
@@ -28,14 +21,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[Serializable()]
|
||||
protected class DocIDCriteria
|
||||
{
|
||||
private int _DocID;
|
||||
public int DocID
|
||||
{ get { return _DocID; } }
|
||||
public DocIDCriteria(int docID)
|
||||
{
|
||||
_DocID = docID;
|
||||
}
|
||||
}
|
||||
private readonly int _DocID;
|
||||
public int DocID => _DocID;
|
||||
public DocIDCriteria(int docID) => _DocID = docID;
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(DocIDCriteria criteria)
|
||||
{
|
||||
@@ -66,8 +55,6 @@ namespace VEPROMS.CSLA.Library
|
||||
// used to remove word section PDFs to force ROs to be updated when printed or saved
|
||||
public static void DeleteDocVersionPDFsWithNewROs(int versionID, int origfstid, int newfstid)
|
||||
{
|
||||
if (!CanDeleteObject())
|
||||
throw new System.Security.SecurityException("User not authorized to remove a Pdf");
|
||||
try
|
||||
{
|
||||
DeleteWithNewROs(versionID, origfstid, newfstid);
|
||||
@@ -111,11 +98,10 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (sect.MyContent.MyEntry == null) return; // B2023-030 not a word section so just jump out
|
||||
DocStyle myDocStyle = sect.ActiveSection.MyDocStyle;
|
||||
SectionConfig sc = sect.ActiveSection.MyConfig as SectionConfig;
|
||||
|
||||
int ss = sect.MyDocVersion.DocVersionConfig.SelectedSlave;
|
||||
int ss = sect.MyDocVersion.DocVersionConfig.SelectedSlave;
|
||||
|
||||
if (sc != null && sc.Section_WordMargin == "Y")
|
||||
if (sect.ActiveSection.MyConfig is SectionConfig sc && sc.Section_WordMargin == "Y")
|
||||
{
|
||||
RemoveFromCachedByPrimaryKey(sect.MyContent.MyEntry.DocID, ss * 10 + MSWordToPDF.DebugStatus, 0, 0, 0, 0);
|
||||
}
|
||||
@@ -132,23 +118,21 @@ namespace VEPROMS.CSLA.Library
|
||||
while (count < 2)
|
||||
{
|
||||
DocStyle myDocStyle = sect.ActiveSection.MyDocStyle;
|
||||
SectionConfig sc = sect.ActiveSection.MyConfig as SectionConfig;
|
||||
PdfInfo myPdf = null;
|
||||
int ss = sect.MyDocVersion.DocVersionConfig.SelectedSlave;
|
||||
|
||||
int ss = sect.MyDocVersion.DocVersionConfig.SelectedSlave;
|
||||
PdfInfo myPdf;
|
||||
if (sect.ActiveSection.MyConfig is SectionConfig sc && sc.Section_WordMargin == "Y")
|
||||
{
|
||||
myPdf = Get(sect.MyContent.MyEntry.DocID, ss * 10 + MSWordToPDF.DebugStatus, 0, 0, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
myPdf = Get(sect.MyContent.MyEntry.DocID, ss * 10 + MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength,
|
||||
(int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth);
|
||||
}
|
||||
|
||||
if (sc != null && sc.Section_WordMargin == "Y")
|
||||
{
|
||||
myPdf = Get(sect.MyContent.MyEntry.DocID, ss*10 + MSWordToPDF.DebugStatus, 0, 0, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
myPdf = Get(sect.MyContent.MyEntry.DocID, ss*10 + MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength,
|
||||
(int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth);
|
||||
}
|
||||
|
||||
// override forces the printing of the word section, which creates a word file with resolved ROs, which is saved for an approved export
|
||||
if (!ovrride || (ovrride && count == 1))
|
||||
// override forces the printing of the word section, which creates a word file with resolved ROs, which is saved for an approved export
|
||||
if (!ovrride || (ovrride && count == 1))
|
||||
{
|
||||
if (myPdf != null) return myPdf;
|
||||
if (count > 0) return null; // Could not find or create a pdf
|
||||
|
||||
Reference in New Issue
Block a user