Moved DocPDF from Documents to new PDFs table
This commit is contained in:
parent
628cfc67de
commit
6fe40ea9e3
509
PROMS/VEPROMS.CSLA.Library/Generated/DocumentPdf.cs
Normal file
509
PROMS/VEPROMS.CSLA.Library/Generated/DocumentPdf.cs
Normal file
@ -0,0 +1,509 @@
|
|||||||
|
// ========================================================================
|
||||||
|
// Copyright 2007 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// $Workfile: $ $Revision: $
|
||||||
|
// $Author: $ $Date: $
|
||||||
|
//
|
||||||
|
// $History: $
|
||||||
|
// ========================================================================
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using Csla;
|
||||||
|
using Csla.Data;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.IO;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Csla.Validation;
|
||||||
|
namespace VEPROMS.CSLA.Library
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// DocumentPdf Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
|
/// </summary>
|
||||||
|
[Serializable()]
|
||||||
|
[TypeConverter(typeof(DocumentPdfConverter))]
|
||||||
|
public partial class DocumentPdf : BusinessBase<DocumentPdf>, IVEHasBrokenRules
|
||||||
|
{
|
||||||
|
#region Log4Net
|
||||||
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
#endregion
|
||||||
|
#region Business Methods
|
||||||
|
private string _ErrorMessage = string.Empty;
|
||||||
|
public string ErrorMessage
|
||||||
|
{
|
||||||
|
get { return _ErrorMessage; }
|
||||||
|
}
|
||||||
|
private int _DebugStatus;
|
||||||
|
/// <summary>
|
||||||
|
/// > 0 for Debug
|
||||||
|
/// </summary>
|
||||||
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
|
public int DebugStatus
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("DebugStatus", true);
|
||||||
|
return _DebugStatus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int _TopRow;
|
||||||
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
|
public int TopRow
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("TopRow", true);
|
||||||
|
return _TopRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int _PageLength;
|
||||||
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
|
public int PageLength
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("PageLength", true);
|
||||||
|
return _PageLength;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int _LeftMargin;
|
||||||
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
|
public int LeftMargin
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("LeftMargin", true);
|
||||||
|
return _LeftMargin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int _PageWidth;
|
||||||
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
|
public int PageWidth
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("PageWidth", true);
|
||||||
|
return _PageWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private double _PageCount;
|
||||||
|
/// <summary>
|
||||||
|
/// Count of whole and partial pages
|
||||||
|
/// </summary>
|
||||||
|
public double PageCount
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("PageCount", true);
|
||||||
|
return _PageCount;
|
||||||
|
}
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
set
|
||||||
|
{
|
||||||
|
CanWriteProperty("PageCount", true);
|
||||||
|
if (_PageCount != value)
|
||||||
|
{
|
||||||
|
_PageCount = value;
|
||||||
|
PropertyHasChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 DateTime _DTS = new DateTime();
|
||||||
|
public DateTime DTS
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("DTS", true);
|
||||||
|
return _DTS;
|
||||||
|
}
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
set
|
||||||
|
{
|
||||||
|
CanWriteProperty("DTS", true);
|
||||||
|
if (_DTS != value)
|
||||||
|
{
|
||||||
|
_DTS = value;
|
||||||
|
PropertyHasChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string _UserID = string.Empty;
|
||||||
|
public string UserID
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("UserID", true);
|
||||||
|
return _UserID;
|
||||||
|
}
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
set
|
||||||
|
{
|
||||||
|
CanWriteProperty("UserID", true);
|
||||||
|
if (value == null) value = string.Empty;
|
||||||
|
if (_UserID != value)
|
||||||
|
{
|
||||||
|
_UserID = value;
|
||||||
|
PropertyHasChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private byte[] _LastChanged = new byte[8];//timestamp
|
||||||
|
// CSLATODO: Check DocumentPdf.GetIdValue to assure that the ID returned is unique
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A Unique ID for the current DocumentPdf</returns>
|
||||||
|
protected override object GetIdValue()
|
||||||
|
{
|
||||||
|
return MyDocumentPdfUnique; // Absolutely Unique ID
|
||||||
|
}
|
||||||
|
// CSLATODO: Replace base DocumentPdf.ToString function as necessary
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides Base ToString
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A string representation of current DocumentPdf</returns>
|
||||||
|
//public override string ToString()
|
||||||
|
//{
|
||||||
|
// return base.ToString();
|
||||||
|
//}
|
||||||
|
public override bool IsDirty
|
||||||
|
{
|
||||||
|
get { return base.IsDirty; }
|
||||||
|
}
|
||||||
|
public bool IsDirtyList(List<object> list)
|
||||||
|
{
|
||||||
|
return base.IsDirty;
|
||||||
|
}
|
||||||
|
public override bool IsValid
|
||||||
|
{
|
||||||
|
get { return (IsNew && !IsDirty) ? true : base.IsValid; }
|
||||||
|
}
|
||||||
|
public bool IsValidList(List<object> list)
|
||||||
|
{
|
||||||
|
return (IsNew && !IsDirty) ? true : base.IsValid;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region ValidationRules
|
||||||
|
[NonSerialized]
|
||||||
|
private bool _CheckingBrokenRules = false;
|
||||||
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_CheckingBrokenRules) return null;
|
||||||
|
if (BrokenRulesCollection.Count > 0) return this;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_CheckingBrokenRules = true;
|
||||||
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
|
return hasBrokenRules;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_CheckingBrokenRules = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public BrokenRulesCollection BrokenRules
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
|
||||||
|
if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
|
||||||
|
return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected override void AddBusinessRules()
|
||||||
|
{
|
||||||
|
ValidationRules.AddRule(
|
||||||
|
Csla.Validation.CommonRules.StringRequired, "UserID");
|
||||||
|
ValidationRules.AddRule(
|
||||||
|
Csla.Validation.CommonRules.StringMaxLength,
|
||||||
|
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
|
||||||
|
// CSLATODO: Add other validation rules
|
||||||
|
}
|
||||||
|
// Sample data comparison validation rule
|
||||||
|
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
|
||||||
|
//{
|
||||||
|
// if (_started > _ended)
|
||||||
|
// {
|
||||||
|
// e.Description = "Start date can't be after end date";
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// return true;
|
||||||
|
//}
|
||||||
|
#endregion
|
||||||
|
#region Authorization Rules
|
||||||
|
protected override void AddAuthorizationRules()
|
||||||
|
{
|
||||||
|
//CSLATODO: Who can read/write which fields
|
||||||
|
//AuthorizationRules.AllowRead(DebugStatus, "<Role(s)>");
|
||||||
|
//AuthorizationRules.AllowRead(TopRow, "<Role(s)>");
|
||||||
|
//AuthorizationRules.AllowRead(PageLength, "<Role(s)>");
|
||||||
|
//AuthorizationRules.AllowRead(LeftMargin, "<Role(s)>");
|
||||||
|
//AuthorizationRules.AllowRead(PageWidth, "<Role(s)>");
|
||||||
|
//AuthorizationRules.AllowRead(PageCount, "<Role(s)>");
|
||||||
|
//AuthorizationRules.AllowWrite(PageCount, "<Role(s)>");
|
||||||
|
//AuthorizationRules.AllowRead(DocPdf, "<Role(s)>");
|
||||||
|
//AuthorizationRules.AllowWrite(DocPdf, "<Role(s)>");
|
||||||
|
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
|
||||||
|
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
|
||||||
|
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
|
||||||
|
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
|
||||||
|
}
|
||||||
|
public static bool CanAddObject()
|
||||||
|
{
|
||||||
|
// CSLATODO: Can Add Authorization
|
||||||
|
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public static bool CanGetObject()
|
||||||
|
{
|
||||||
|
// CSLATODO: CanGet Authorization
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public static bool CanDeleteObject()
|
||||||
|
{
|
||||||
|
// CSLATODO: CanDelete Authorization
|
||||||
|
//bool result = false;
|
||||||
|
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
|
||||||
|
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
|
||||||
|
//return result;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public static bool CanEditObject()
|
||||||
|
{
|
||||||
|
// CSLATODO: CanEdit Authorization
|
||||||
|
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Factory Methods
|
||||||
|
public int CurrentEditLevel
|
||||||
|
{ get { return EditLevel; } }
|
||||||
|
private static int _DocumentPdfUnique = 0;
|
||||||
|
private static int DocumentPdfUnique
|
||||||
|
{ get { return ++_DocumentPdfUnique; } }
|
||||||
|
private int _MyDocumentPdfUnique = DocumentPdfUnique;
|
||||||
|
public int MyDocumentPdfUnique // Absolutely Unique ID - Editable FK
|
||||||
|
{ get { return _MyDocumentPdfUnique; } }
|
||||||
|
internal static DocumentPdf New(int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth, double pageCount)
|
||||||
|
{
|
||||||
|
return new DocumentPdf(debugStatus, topRow, pageLength, leftMargin, pageWidth, pageCount);
|
||||||
|
}
|
||||||
|
internal static DocumentPdf Get(SafeDataReader dr)
|
||||||
|
{
|
||||||
|
return new DocumentPdf(dr);
|
||||||
|
}
|
||||||
|
public DocumentPdf()
|
||||||
|
{
|
||||||
|
MarkAsChild();
|
||||||
|
|
||||||
|
_DTS = _DocumentPdfExtension.DefaultDTS;
|
||||||
|
_UserID = _DocumentPdfExtension.DefaultUserID;
|
||||||
|
ValidationRules.CheckRules();
|
||||||
|
}
|
||||||
|
private DocumentPdf(int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth, double pageCount)
|
||||||
|
{
|
||||||
|
MarkAsChild();
|
||||||
|
// CSLATODO: Add any initialization & defaults
|
||||||
|
_DTS = _DocumentPdfExtension.DefaultDTS;
|
||||||
|
_UserID = _DocumentPdfExtension.DefaultUserID;
|
||||||
|
_DebugStatus = debugStatus;
|
||||||
|
_TopRow = topRow;
|
||||||
|
_PageLength = pageLength;
|
||||||
|
_LeftMargin = leftMargin;
|
||||||
|
_PageWidth = pageWidth;
|
||||||
|
_PageCount = pageCount;
|
||||||
|
ValidationRules.CheckRules();
|
||||||
|
}
|
||||||
|
internal DocumentPdf(SafeDataReader dr)
|
||||||
|
{
|
||||||
|
MarkAsChild();
|
||||||
|
Fetch(dr);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Data Access Portal
|
||||||
|
private void Fetch(SafeDataReader dr)
|
||||||
|
{
|
||||||
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentPdf.FetchDR", GetHashCode());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_DebugStatus = dr.GetInt32("DebugStatus");
|
||||||
|
_TopRow = dr.GetInt32("TopRow");
|
||||||
|
_PageLength = dr.GetInt32("PageLength");
|
||||||
|
_LeftMargin = dr.GetInt32("LeftMargin");
|
||||||
|
_PageWidth = dr.GetInt32("PageWidth");
|
||||||
|
_PageCount = dr.GetDouble("PageCount");
|
||||||
|
_DocPdf = (byte[])dr.GetValue("DocPdf");
|
||||||
|
_DTS = dr.GetDateTime("DTS");
|
||||||
|
_UserID = dr.GetString("UserID");
|
||||||
|
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
||||||
|
}
|
||||||
|
catch (Exception ex) // FKItem Fetch
|
||||||
|
{
|
||||||
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentPdf.FetchDR", ex);
|
||||||
|
throw new DbCslaException("DocumentPdf.Fetch", ex);
|
||||||
|
}
|
||||||
|
MarkOld();
|
||||||
|
}
|
||||||
|
internal void Insert(Document myDocument)
|
||||||
|
{
|
||||||
|
// if we're not dirty then don't update the database
|
||||||
|
if (!this.IsDirty) return;
|
||||||
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
|
_LastChanged = Pdf.Add(cn, myDocument, _DebugStatus, _TopRow, _PageLength, _LeftMargin, _PageWidth, _PageCount, _DocPdf, _DTS, _UserID);
|
||||||
|
MarkOld();
|
||||||
|
}
|
||||||
|
internal void Update(Document myDocument)
|
||||||
|
{
|
||||||
|
// if we're not dirty then don't update the database
|
||||||
|
if (!this.IsDirty) return;
|
||||||
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
|
_LastChanged = Pdf.Update(cn, myDocument.DocID, _DebugStatus, _TopRow, _PageLength, _LeftMargin, _PageWidth, _PageCount, _DocPdf, _DTS, _UserID, ref _LastChanged);
|
||||||
|
MarkOld();
|
||||||
|
}
|
||||||
|
internal void DeleteSelf(Document myDocument)
|
||||||
|
{
|
||||||
|
// if we're not dirty then don't update the database
|
||||||
|
if (!this.IsDirty) return;
|
||||||
|
// if we're new then don't update the database
|
||||||
|
if (this.IsNew) return;
|
||||||
|
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||||
|
Pdf.Remove(cn, myDocument.DocID, _DebugStatus, _TopRow, _PageLength, _LeftMargin, _PageWidth);
|
||||||
|
MarkNew();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
// Standard Default Code
|
||||||
|
#region extension
|
||||||
|
DocumentPdfExtension _DocumentPdfExtension = new DocumentPdfExtension();
|
||||||
|
[Serializable()]
|
||||||
|
partial class DocumentPdfExtension : extensionBase
|
||||||
|
{
|
||||||
|
}
|
||||||
|
[Serializable()]
|
||||||
|
class extensionBase
|
||||||
|
{
|
||||||
|
// Default Values
|
||||||
|
public virtual DateTime DefaultDTS
|
||||||
|
{
|
||||||
|
get { return DateTime.Now; }
|
||||||
|
}
|
||||||
|
public virtual string DefaultUserID
|
||||||
|
{
|
||||||
|
get { return Environment.UserName.ToUpper(); }
|
||||||
|
}
|
||||||
|
// Authorization Rules
|
||||||
|
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
|
{
|
||||||
|
// Needs to be overriden to add new authorization rules
|
||||||
|
}
|
||||||
|
// Instance Authorization Rules
|
||||||
|
public virtual void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
|
{
|
||||||
|
// Needs to be overriden to add new authorization rules
|
||||||
|
}
|
||||||
|
// Validation Rules
|
||||||
|
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
|
{
|
||||||
|
// Needs to be overriden to add new validation rules
|
||||||
|
}
|
||||||
|
// InstanceValidation Rules
|
||||||
|
public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
|
{
|
||||||
|
// Needs to be overriden to add new validation rules
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
} // Class
|
||||||
|
#region Converter
|
||||||
|
internal class DocumentPdfConverter : ExpandableObjectConverter
|
||||||
|
{
|
||||||
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
|
{
|
||||||
|
if (destType == typeof(string) && value is DocumentPdf)
|
||||||
|
{
|
||||||
|
// Return the ToString value
|
||||||
|
return ((DocumentPdf)value).ToString();
|
||||||
|
}
|
||||||
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
} // Namespace
|
||||||
|
|
||||||
|
|
||||||
|
//// The following is a sample Extension File. You can use it to create DocumentPdfExt.cs
|
||||||
|
//using System;
|
||||||
|
//using System.Collections.Generic;
|
||||||
|
//using System.Text;
|
||||||
|
//using Csla;
|
||||||
|
|
||||||
|
//namespace VEPROMS.CSLA.Library
|
||||||
|
//{
|
||||||
|
// public partial class DocumentPdf
|
||||||
|
// {
|
||||||
|
// partial class DocumentPdfExtension : extensionBase
|
||||||
|
// {
|
||||||
|
// // CSLATODO: Override automatic defaults
|
||||||
|
// public virtual DateTime DefaultDTS
|
||||||
|
// {
|
||||||
|
// get { return DateTime.Now; }
|
||||||
|
// }
|
||||||
|
// public virtual string DefaultUserID
|
||||||
|
// {
|
||||||
|
// get { return Environment.UserName.ToUpper(); }
|
||||||
|
// }
|
||||||
|
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
|
// {
|
||||||
|
// //rules.AllowRead(Dbid, "<Role(s)>");
|
||||||
|
// }
|
||||||
|
// public new void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
|
||||||
|
// {
|
||||||
|
// //rules.AllowInstanceRead(Dbid, "<Role(s)>");
|
||||||
|
// }
|
||||||
|
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
|
// {
|
||||||
|
// rules.AddRule(
|
||||||
|
// Csla.Validation.CommonRules.StringMaxLength,
|
||||||
|
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
|
||||||
|
// }
|
||||||
|
// public new void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
|
||||||
|
// {
|
||||||
|
// rules.AddInstanceRule(/* Instance Validation Rule */);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
327
PROMS/VEPROMS.CSLA.Library/Generated/DocumentPdfs.cs
Normal file
327
PROMS/VEPROMS.CSLA.Library/Generated/DocumentPdfs.cs
Normal file
@ -0,0 +1,327 @@
|
|||||||
|
// ========================================================================
|
||||||
|
// Copyright 2007 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// $Workfile: $ $Revision: $
|
||||||
|
// $Author: $ $Date: $
|
||||||
|
//
|
||||||
|
// $History: $
|
||||||
|
// ========================================================================
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using Csla;
|
||||||
|
using Csla.Data;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.IO;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Csla.Validation;
|
||||||
|
namespace VEPROMS.CSLA.Library
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// DocumentPdfs Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
|
/// </summary>
|
||||||
|
[Serializable()]
|
||||||
|
[TypeConverter(typeof(DocumentPdfsConverter))]
|
||||||
|
public partial class DocumentPdfs : BusinessListBase<DocumentPdfs, DocumentPdf>, ICustomTypeDescriptor, IVEHasBrokenRules
|
||||||
|
{
|
||||||
|
#region Log4Net
|
||||||
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
#endregion
|
||||||
|
#region Business Methods
|
||||||
|
private string _ErrorMessage = string.Empty;
|
||||||
|
public string ErrorMessage
|
||||||
|
{
|
||||||
|
get { return _ErrorMessage; }
|
||||||
|
}
|
||||||
|
// One To Many
|
||||||
|
public DocumentPdf this[int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
foreach (DocumentPdf pdf in this)
|
||||||
|
if (pdf.DebugStatus == debugStatus && pdf.TopRow == topRow && pdf.PageLength == pageLength && pdf.LeftMargin == leftMargin && pdf.PageWidth == pageWidth)
|
||||||
|
return pdf;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public new System.Collections.Generic.IList<DocumentPdf> Items
|
||||||
|
{
|
||||||
|
get { return base.Items; }
|
||||||
|
}
|
||||||
|
public DocumentPdf GetItem(int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth)
|
||||||
|
{
|
||||||
|
foreach (DocumentPdf pdf in this)
|
||||||
|
if (pdf.DebugStatus == debugStatus && pdf.TopRow == topRow && pdf.PageLength == pageLength && pdf.LeftMargin == leftMargin && pdf.PageWidth == pageWidth)
|
||||||
|
return pdf;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public DocumentPdf Add(int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth, double pageCount) // One to Many with unique fields
|
||||||
|
{
|
||||||
|
if (!Contains(debugStatus, topRow, pageLength, leftMargin, pageWidth))
|
||||||
|
{
|
||||||
|
DocumentPdf pdf = DocumentPdf.New(debugStatus, topRow, pageLength, leftMargin, pageWidth, pageCount);
|
||||||
|
this.Add(pdf);
|
||||||
|
return pdf;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new InvalidOperationException("pdf already exists");
|
||||||
|
}
|
||||||
|
public void Remove(int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth)
|
||||||
|
{
|
||||||
|
foreach (DocumentPdf pdf in this)
|
||||||
|
{
|
||||||
|
if (pdf.DebugStatus == debugStatus && pdf.TopRow == topRow && pdf.PageLength == pageLength && pdf.LeftMargin == leftMargin && pdf.PageWidth == pageWidth)
|
||||||
|
{
|
||||||
|
Remove(pdf);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool Contains(int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth)
|
||||||
|
{
|
||||||
|
foreach (DocumentPdf pdf in this)
|
||||||
|
if (pdf.DebugStatus == debugStatus && pdf.TopRow == topRow && pdf.PageLength == pageLength && pdf.LeftMargin == leftMargin && pdf.PageWidth == pageWidth)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public bool ContainsDeleted(int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth)
|
||||||
|
{
|
||||||
|
foreach (DocumentPdf pdf in DeletedList)
|
||||||
|
if (pdf.DebugStatus == debugStatus && pdf.TopRow == topRow && pdf.PageLength == pageLength && pdf.LeftMargin == leftMargin && pdf.PageWidth == pageWidth)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public bool IsDirtyList(List<object> list)
|
||||||
|
{
|
||||||
|
// any non-new deletions make us dirty
|
||||||
|
foreach (DocumentPdf item in DeletedList)
|
||||||
|
if (!item.IsNew)
|
||||||
|
return true;
|
||||||
|
// run through all the child objects
|
||||||
|
// and if any are dirty then then
|
||||||
|
// collection is dirty
|
||||||
|
foreach (DocumentPdf child in this)
|
||||||
|
if (child.IsDirtyList(list))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public override bool IsValid
|
||||||
|
{
|
||||||
|
get { return IsValidList(new List<object>()); }
|
||||||
|
}
|
||||||
|
public bool IsValidList(List<object> list)
|
||||||
|
{
|
||||||
|
// run through all the child objects
|
||||||
|
// and if any are invalid then the
|
||||||
|
// collection is invalid
|
||||||
|
foreach (DocumentPdf child in this)
|
||||||
|
if (!child.IsValidList(list))
|
||||||
|
{
|
||||||
|
//Console.WriteLine("Valid {0} Child {1} - {2}", child.IsValid, child.GetType().Name,child.ToString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region ValidationRules
|
||||||
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
|
foreach (DocumentPdf documentPdf in this)
|
||||||
|
if ((hasBrokenRules = documentPdf.HasBrokenRules) != null) return hasBrokenRules;
|
||||||
|
return hasBrokenRules;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public BrokenRulesCollection BrokenRules
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
|
||||||
|
return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Factory Methods
|
||||||
|
internal static DocumentPdfs New()
|
||||||
|
{
|
||||||
|
return new DocumentPdfs();
|
||||||
|
}
|
||||||
|
internal static DocumentPdfs Get(SafeDataReader dr)
|
||||||
|
{
|
||||||
|
return new DocumentPdfs(dr);
|
||||||
|
}
|
||||||
|
public static DocumentPdfs GetByDocID(int docID)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return DataPortal.Fetch<DocumentPdfs>(new DocIDCriteria(docID));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new DbCslaException("Error on DocumentPdfs.GetByDocID", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private DocumentPdfs()
|
||||||
|
{
|
||||||
|
MarkAsChild();
|
||||||
|
}
|
||||||
|
internal DocumentPdfs(SafeDataReader dr)
|
||||||
|
{
|
||||||
|
MarkAsChild();
|
||||||
|
Fetch(dr);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Data Access Portal
|
||||||
|
// called to load data from the database
|
||||||
|
private void Fetch(SafeDataReader dr)
|
||||||
|
{
|
||||||
|
this.RaiseListChangedEvents = false;
|
||||||
|
while (dr.Read())
|
||||||
|
this.Add(DocumentPdf.Get(dr));
|
||||||
|
this.RaiseListChangedEvents = true;
|
||||||
|
}
|
||||||
|
[Serializable()]
|
||||||
|
private class DocIDCriteria
|
||||||
|
{
|
||||||
|
public DocIDCriteria(int docID)
|
||||||
|
{
|
||||||
|
_DocID = docID;
|
||||||
|
}
|
||||||
|
private int _DocID;
|
||||||
|
public int DocID
|
||||||
|
{
|
||||||
|
get { return _DocID; }
|
||||||
|
set { _DocID = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DataPortal_Fetch(DocIDCriteria criteria)
|
||||||
|
{
|
||||||
|
this.RaiseListChangedEvents = false;
|
||||||
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentPdfs.DataPortal_FetchDocID", GetHashCode());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
{
|
||||||
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
|
cm.CommandText = "getPdfsByDocID";
|
||||||
|
cm.Parameters.AddWithValue("@DocID", criteria.DocID);
|
||||||
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
|
{
|
||||||
|
while (dr.Read()) this.Add(new DocumentPdf(dr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentPdfs.DataPortal_FetchDocID", ex);
|
||||||
|
throw new DbCslaException("DocumentPdfs.DataPortal_Fetch", ex);
|
||||||
|
}
|
||||||
|
this.RaiseListChangedEvents = true;
|
||||||
|
}
|
||||||
|
internal void Update(Document document)
|
||||||
|
{
|
||||||
|
this.RaiseListChangedEvents = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// update (thus deleting) any deleted child objects
|
||||||
|
foreach (DocumentPdf obj in DeletedList)
|
||||||
|
obj.DeleteSelf(document);// Deletes related record
|
||||||
|
// now that they are deleted, remove them from memory too
|
||||||
|
DeletedList.Clear();
|
||||||
|
// add/update any current child objects
|
||||||
|
foreach (DocumentPdf obj in this)
|
||||||
|
{
|
||||||
|
if (obj.IsNew)
|
||||||
|
obj.Insert(document);
|
||||||
|
else
|
||||||
|
obj.Update(document);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
this.RaiseListChangedEvents = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region ICustomTypeDescriptor impl
|
||||||
|
public String GetClassName()
|
||||||
|
{ return TypeDescriptor.GetClassName(this, true); }
|
||||||
|
public AttributeCollection GetAttributes()
|
||||||
|
{ return TypeDescriptor.GetAttributes(this, true); }
|
||||||
|
public String GetComponentName()
|
||||||
|
{ return TypeDescriptor.GetComponentName(this, true); }
|
||||||
|
public TypeConverter GetConverter()
|
||||||
|
{ return TypeDescriptor.GetConverter(this, true); }
|
||||||
|
public EventDescriptor GetDefaultEvent()
|
||||||
|
{ return TypeDescriptor.GetDefaultEvent(this, true); }
|
||||||
|
public PropertyDescriptor GetDefaultProperty()
|
||||||
|
{ return TypeDescriptor.GetDefaultProperty(this, true); }
|
||||||
|
public object GetEditor(Type editorBaseType)
|
||||||
|
{ return TypeDescriptor.GetEditor(this, editorBaseType, true); }
|
||||||
|
public EventDescriptorCollection GetEvents(Attribute[] attributes)
|
||||||
|
{ return TypeDescriptor.GetEvents(this, attributes, true); }
|
||||||
|
public EventDescriptorCollection GetEvents()
|
||||||
|
{ return TypeDescriptor.GetEvents(this, true); }
|
||||||
|
public object GetPropertyOwner(PropertyDescriptor pd)
|
||||||
|
{ return this; }
|
||||||
|
/// <summary>
|
||||||
|
/// Called to get the properties of this type. Returns properties with certain
|
||||||
|
/// attributes. this restriction is not implemented here.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="attributes"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
|
||||||
|
{ return GetProperties(); }
|
||||||
|
/// <summary>
|
||||||
|
/// Called to get the properties of this type.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public PropertyDescriptorCollection GetProperties()
|
||||||
|
{
|
||||||
|
// Create a collection object to hold property descriptors
|
||||||
|
PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
|
||||||
|
// Iterate the list
|
||||||
|
for (int i = 0; i < this.Items.Count; i++)
|
||||||
|
{
|
||||||
|
// Create a property descriptor for the item and add to the property descriptor collection
|
||||||
|
DocumentPdfsPropertyDescriptor pd = new DocumentPdfsPropertyDescriptor(this, i);
|
||||||
|
pds.Add(pd);
|
||||||
|
}
|
||||||
|
// return the property descriptor collection
|
||||||
|
return pds;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
} // Class
|
||||||
|
#region Property Descriptor
|
||||||
|
/// <summary>
|
||||||
|
/// Summary description for CollectionPropertyDescriptor.
|
||||||
|
/// </summary>
|
||||||
|
public partial class DocumentPdfsPropertyDescriptor : vlnListPropertyDescriptor
|
||||||
|
{
|
||||||
|
private DocumentPdf Item { get { return (DocumentPdf)_Item; } }
|
||||||
|
public DocumentPdfsPropertyDescriptor(DocumentPdfs collection, int index) : base(collection, index) { ;}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Converter
|
||||||
|
internal class DocumentPdfsConverter : ExpandableObjectConverter
|
||||||
|
{
|
||||||
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
|
{
|
||||||
|
if (destType == typeof(string) && value is DocumentPdfs)
|
||||||
|
{
|
||||||
|
// Return department and department role separated by comma.
|
||||||
|
return ((DocumentPdfs)value).Items.Count.ToString() + " Pdfs";
|
||||||
|
}
|
||||||
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
} // Namespace
|
1170
PROMS/VEPROMS.CSLA.Library/Generated/Pdf.cs
Normal file
1170
PROMS/VEPROMS.CSLA.Library/Generated/Pdf.cs
Normal file
File diff suppressed because it is too large
Load Diff
471
PROMS/VEPROMS.CSLA.Library/Generated/PdfInfo.cs
Normal file
471
PROMS/VEPROMS.CSLA.Library/Generated/PdfInfo.cs
Normal file
@ -0,0 +1,471 @@
|
|||||||
|
// ========================================================================
|
||||||
|
// Copyright 2007 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// $Workfile: $ $Revision: $
|
||||||
|
// $Author: $ $Date: $
|
||||||
|
//
|
||||||
|
// $History: $
|
||||||
|
// ========================================================================
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using Csla;
|
||||||
|
using Csla.Data;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.IO;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
namespace VEPROMS.CSLA.Library
|
||||||
|
{
|
||||||
|
public delegate void PdfInfoEvent(object sender);
|
||||||
|
/// <summary>
|
||||||
|
/// PdfInfo Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
|
/// </summary>
|
||||||
|
[Serializable()]
|
||||||
|
[TypeConverter(typeof(PdfInfoConverter))]
|
||||||
|
public partial class PdfInfo : ReadOnlyBase<PdfInfo>, IDisposable
|
||||||
|
{
|
||||||
|
public event PdfInfoEvent Changed;
|
||||||
|
private void OnChange()
|
||||||
|
{
|
||||||
|
if (Changed != null) Changed(this);
|
||||||
|
}
|
||||||
|
#region Log4Net
|
||||||
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
#endregion
|
||||||
|
#region Collection
|
||||||
|
private static List<PdfInfo> _CacheList = new List<PdfInfo>();
|
||||||
|
protected static void AddToCache(PdfInfo pdfInfo)
|
||||||
|
{
|
||||||
|
if (!_CacheList.Contains(pdfInfo)) _CacheList.Add(pdfInfo); // In AddToCache
|
||||||
|
}
|
||||||
|
protected static void RemoveFromCache(PdfInfo pdfInfo)
|
||||||
|
{
|
||||||
|
while (_CacheList.Contains(pdfInfo)) _CacheList.Remove(pdfInfo); // In RemoveFromCache
|
||||||
|
}
|
||||||
|
private static Dictionary<string, List<PdfInfo>> _CacheByPrimaryKey = new Dictionary<string, List<PdfInfo>>();
|
||||||
|
private static void ConvertListToDictionary()
|
||||||
|
{
|
||||||
|
while (_CacheList.Count > 0) // Move PdfInfo(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||||
|
{
|
||||||
|
PdfInfo tmp = _CacheList[0]; // Get the first PdfInfo
|
||||||
|
string pKey = tmp.DocID.ToString() + "_" + tmp.DebugStatus.ToString() + "_" + tmp.TopRow.ToString() + "_" + tmp.PageLength.ToString() + "_" + tmp.LeftMargin.ToString() + "_" + tmp.PageWidth.ToString();
|
||||||
|
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||||
|
{
|
||||||
|
_CacheByPrimaryKey[pKey] = new List<PdfInfo>(); // Add new list for PrimaryKey
|
||||||
|
}
|
||||||
|
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||||
|
_CacheList.RemoveAt(0); // Remove the first PdfInfo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
internal static void AddList(PdfInfoList lst)
|
||||||
|
{
|
||||||
|
foreach (PdfInfo item in lst) AddToCache(item);
|
||||||
|
}
|
||||||
|
protected static PdfInfo GetCachedByPrimaryKey(int docID, int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth)
|
||||||
|
{
|
||||||
|
ConvertListToDictionary();
|
||||||
|
string key = docID.ToString() + "_" + debugStatus.ToString() + "_" + topRow.ToString() + "_" + pageLength.ToString() + "_" + leftMargin.ToString() + "_" + pageWidth.ToString();
|
||||||
|
if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Business Methods
|
||||||
|
private string _ErrorMessage = string.Empty;
|
||||||
|
public string ErrorMessage
|
||||||
|
{
|
||||||
|
get { return _ErrorMessage; }
|
||||||
|
}
|
||||||
|
protected Pdf _Editable;
|
||||||
|
private IVEHasBrokenRules HasBrokenRules
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
IVEHasBrokenRules hasBrokenRules = null;
|
||||||
|
if (_Editable != null)
|
||||||
|
hasBrokenRules = _Editable.HasBrokenRules;
|
||||||
|
return hasBrokenRules;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int _DocID;
|
||||||
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
|
public int DocID
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("DocID", true);
|
||||||
|
if (_MyDocument != null) _DocID = _MyDocument.DocID;
|
||||||
|
return _DocID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private DocumentInfo _MyDocument;
|
||||||
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
|
public DocumentInfo MyDocument
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("MyDocument", true);
|
||||||
|
if (_MyDocument == null && _DocID != 0) _MyDocument = DocumentInfo.Get(_DocID);
|
||||||
|
return _MyDocument;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int _DebugStatus;
|
||||||
|
/// <summary>
|
||||||
|
/// > 0 for Debug
|
||||||
|
/// </summary>
|
||||||
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
|
public int DebugStatus
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("DebugStatus", true);
|
||||||
|
return _DebugStatus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int _TopRow;
|
||||||
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
|
public int TopRow
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("TopRow", true);
|
||||||
|
return _TopRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int _PageLength;
|
||||||
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
|
public int PageLength
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("PageLength", true);
|
||||||
|
return _PageLength;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int _LeftMargin;
|
||||||
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
|
public int LeftMargin
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("LeftMargin", true);
|
||||||
|
return _LeftMargin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int _PageWidth;
|
||||||
|
[System.ComponentModel.DataObjectField(true, true)]
|
||||||
|
public int PageWidth
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("PageWidth", true);
|
||||||
|
return _PageWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private double _PageCount;
|
||||||
|
/// <summary>
|
||||||
|
/// Count of whole and partial pages
|
||||||
|
/// </summary>
|
||||||
|
public double PageCount
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("PageCount", true);
|
||||||
|
return _PageCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private byte[] _DocPdf;
|
||||||
|
public byte[] DocPdf
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("DocPdf", true);
|
||||||
|
return _DocPdf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private DateTime _DTS = new DateTime();
|
||||||
|
public DateTime DTS
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("DTS", true);
|
||||||
|
return _DTS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string _UserID = string.Empty;
|
||||||
|
public string UserID
|
||||||
|
{
|
||||||
|
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||||
|
get
|
||||||
|
{
|
||||||
|
CanReadProperty("UserID", true);
|
||||||
|
return _UserID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// CSLATODO: Replace base PdfInfo.ToString function as necessary
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides Base ToString
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A string representation of current PdfInfo</returns>
|
||||||
|
//public override string ToString()
|
||||||
|
//{
|
||||||
|
// return base.ToString();
|
||||||
|
//}
|
||||||
|
// CSLATODO: Check PdfInfo.GetIdValue to assure that the ID returned is unique
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A Unique ID for the current PdfInfo</returns>
|
||||||
|
protected override object GetIdValue()
|
||||||
|
{
|
||||||
|
return MyPdfInfoUnique; // Absolutely Unique ID
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Factory Methods
|
||||||
|
private static int _PdfInfoUnique = 0;
|
||||||
|
private static int PdfInfoUnique
|
||||||
|
{ get { return ++_PdfInfoUnique; } }
|
||||||
|
private int _MyPdfInfoUnique = PdfInfoUnique;
|
||||||
|
public int MyPdfInfoUnique // Absolutely Unique ID - Info
|
||||||
|
{ get { return _MyPdfInfoUnique; } }
|
||||||
|
protected PdfInfo()
|
||||||
|
{/* require use of factory methods */
|
||||||
|
AddToCache(this);
|
||||||
|
}
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
RemoveFromCache(this);
|
||||||
|
if (!_CacheByPrimaryKey.ContainsKey(DocID.ToString() + "_" + DebugStatus.ToString() + "_" + TopRow.ToString() + "_" + PageLength.ToString() + "_" + LeftMargin.ToString() + "_" + PageWidth.ToString())) return;
|
||||||
|
List<PdfInfo> listPdfInfo = _CacheByPrimaryKey[DocID.ToString() + "_" + DebugStatus.ToString() + "_" + TopRow.ToString() + "_" + PageLength.ToString() + "_" + LeftMargin.ToString() + "_" + PageWidth.ToString()]; // Get the list of items
|
||||||
|
while (listPdfInfo.Contains(this)) listPdfInfo.Remove(this); // Remove the item from the list
|
||||||
|
if (listPdfInfo.Count == 0) // If there are no items left in the list
|
||||||
|
_CacheByPrimaryKey.Remove(DocID.ToString() + "_" + DebugStatus.ToString() + "_" + TopRow.ToString() + "_" + PageLength.ToString() + "_" + LeftMargin.ToString() + "_" + PageWidth.ToString()); // remove the list
|
||||||
|
}
|
||||||
|
public virtual Pdf Get()
|
||||||
|
{
|
||||||
|
return _Editable = Pdf.Get(_DocID, _DebugStatus, _TopRow, _PageLength, _LeftMargin, _PageWidth);
|
||||||
|
}
|
||||||
|
public static void Refresh(Pdf tmp)
|
||||||
|
{
|
||||||
|
string key = tmp.DocID.ToString() + "_" + tmp.DebugStatus.ToString() + "_" + tmp.TopRow.ToString() + "_" + tmp.PageLength.ToString() + "_" + tmp.LeftMargin.ToString() + "_" + tmp.PageWidth.ToString();
|
||||||
|
ConvertListToDictionary();
|
||||||
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (PdfInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
|
tmpInfo.RefreshFields(tmp);
|
||||||
|
}
|
||||||
|
protected virtual void RefreshFields(Pdf tmp)
|
||||||
|
{
|
||||||
|
_PageCount = tmp.PageCount;
|
||||||
|
_DocPdf = tmp.DocPdf;
|
||||||
|
_DTS = tmp.DTS;
|
||||||
|
_UserID = tmp.UserID;
|
||||||
|
_PdfInfoExtension.Refresh(this);
|
||||||
|
//RHM Removed 20090724 - Duplicates function of code above.
|
||||||
|
// - Dispose caused error when a new step was added.
|
||||||
|
// - Resequence of transitions did not work properly.
|
||||||
|
// if(_MyDocument != null)
|
||||||
|
// {
|
||||||
|
// _MyDocument.Dispose();// Dispose related value
|
||||||
|
// _MyDocument = null;// Reset related value
|
||||||
|
// }
|
||||||
|
OnChange();// raise an event
|
||||||
|
}
|
||||||
|
public static void Refresh(Document myDocument, DocumentPdf tmp)
|
||||||
|
{
|
||||||
|
string key = myDocument.DocID.ToString() + "_" + tmp.DebugStatus.ToString() + "_" + tmp.TopRow.ToString() + "_" + tmp.PageLength.ToString() + "_" + tmp.LeftMargin.ToString() + "_" + tmp.PageWidth.ToString();
|
||||||
|
ConvertListToDictionary();
|
||||||
|
if (_CacheByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (PdfInfo tmpInfo in _CacheByPrimaryKey[key])
|
||||||
|
tmpInfo.RefreshFields(tmp);
|
||||||
|
}
|
||||||
|
protected virtual void RefreshFields(DocumentPdf tmp)
|
||||||
|
{
|
||||||
|
_PageCount = tmp.PageCount;
|
||||||
|
_DocPdf = tmp.DocPdf;
|
||||||
|
_DTS = tmp.DTS;
|
||||||
|
_UserID = tmp.UserID;
|
||||||
|
_PdfInfoExtension.Refresh(this);
|
||||||
|
//RHM Removed 20090724 - Duplicates function of code above.
|
||||||
|
// - Dispose caused error when a new step was added.
|
||||||
|
// - Resequence of transitions did not work properly.
|
||||||
|
// if(_MyDocument != null)
|
||||||
|
// {
|
||||||
|
// _MyDocument.Dispose();// Dispose related value
|
||||||
|
// _MyDocument = null;// Reset related value
|
||||||
|
// }
|
||||||
|
OnChange();// raise an event
|
||||||
|
}
|
||||||
|
public static PdfInfo Get(int docID, int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth)
|
||||||
|
{
|
||||||
|
//if (!CanGetObject())
|
||||||
|
// throw new System.Security.SecurityException("User not authorized to view a Pdf");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PdfInfo tmp = GetCachedByPrimaryKey(docID, debugStatus, topRow, pageLength, leftMargin, pageWidth);
|
||||||
|
if (tmp == null)
|
||||||
|
{
|
||||||
|
tmp = DataPortal.Fetch<PdfInfo>(new PKCriteria(docID, debugStatus, topRow, pageLength, leftMargin, pageWidth));
|
||||||
|
AddToCache(tmp);
|
||||||
|
}
|
||||||
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
|
{
|
||||||
|
tmp.Dispose(); // Clean-up PdfInfo
|
||||||
|
tmp = null;
|
||||||
|
}
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new DbCslaException("Error on PdfInfo.Get", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Data Access Portal
|
||||||
|
internal PdfInfo(SafeDataReader dr)
|
||||||
|
{
|
||||||
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PdfInfo.Constructor", GetHashCode());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ReadData(dr);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("PdfInfo.Constructor", ex);
|
||||||
|
throw new DbCslaException("PdfInfo.Constructor", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[Serializable()]
|
||||||
|
protected class PKCriteria
|
||||||
|
{
|
||||||
|
private int _DocID;
|
||||||
|
public int DocID
|
||||||
|
{ get { return _DocID; } }
|
||||||
|
private int _DebugStatus;
|
||||||
|
public int DebugStatus
|
||||||
|
{ get { return _DebugStatus; } }
|
||||||
|
private int _TopRow;
|
||||||
|
public int TopRow
|
||||||
|
{ get { return _TopRow; } }
|
||||||
|
private int _PageLength;
|
||||||
|
public int PageLength
|
||||||
|
{ get { return _PageLength; } }
|
||||||
|
private int _LeftMargin;
|
||||||
|
public int LeftMargin
|
||||||
|
{ get { return _LeftMargin; } }
|
||||||
|
private int _PageWidth;
|
||||||
|
public int PageWidth
|
||||||
|
{ get { return _PageWidth; } }
|
||||||
|
public PKCriteria(int docID, int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth)
|
||||||
|
{
|
||||||
|
_DocID = docID;
|
||||||
|
_DebugStatus = debugStatus;
|
||||||
|
_TopRow = topRow;
|
||||||
|
_PageLength = pageLength;
|
||||||
|
_LeftMargin = leftMargin;
|
||||||
|
_PageWidth = pageWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ReadData(SafeDataReader dr)
|
||||||
|
{
|
||||||
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PdfInfo.ReadData", GetHashCode());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_DocID = dr.GetInt32("DocID");
|
||||||
|
_DebugStatus = dr.GetInt32("DebugStatus");
|
||||||
|
_TopRow = dr.GetInt32("TopRow");
|
||||||
|
_PageLength = dr.GetInt32("PageLength");
|
||||||
|
_LeftMargin = dr.GetInt32("LeftMargin");
|
||||||
|
_PageWidth = dr.GetInt32("PageWidth");
|
||||||
|
_PageCount = dr.GetDouble("PageCount");
|
||||||
|
_DocPdf = (byte[])dr.GetValue("DocPdf");
|
||||||
|
_DTS = dr.GetDateTime("DTS");
|
||||||
|
_UserID = dr.GetString("UserID");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("PdfInfo.ReadData", ex);
|
||||||
|
_ErrorMessage = ex.Message;
|
||||||
|
throw new DbCslaException("PdfInfo.ReadData", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DataPortal_Fetch(PKCriteria criteria)
|
||||||
|
{
|
||||||
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PdfInfo.DataPortal_Fetch", GetHashCode());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
{
|
||||||
|
ApplicationContext.LocalContext["cn"] = cn;
|
||||||
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
|
cm.CommandText = "getPdf";
|
||||||
|
cm.Parameters.AddWithValue("@DocID", criteria.DocID);
|
||||||
|
cm.Parameters.AddWithValue("@DebugStatus", criteria.DebugStatus);
|
||||||
|
cm.Parameters.AddWithValue("@TopRow", criteria.TopRow);
|
||||||
|
cm.Parameters.AddWithValue("@PageLength", criteria.PageLength);
|
||||||
|
cm.Parameters.AddWithValue("@LeftMargin", criteria.LeftMargin);
|
||||||
|
cm.Parameters.AddWithValue("@PageWidth", criteria.PageWidth);
|
||||||
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
|
{
|
||||||
|
if (!dr.Read())
|
||||||
|
{
|
||||||
|
_ErrorMessage = "No Record Found";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ReadData(dr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// removing of item only needed for local data portal
|
||||||
|
if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||||
|
ApplicationContext.LocalContext.Remove("cn");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("PdfInfo.DataPortal_Fetch", ex);
|
||||||
|
_ErrorMessage = ex.Message;
|
||||||
|
throw new DbCslaException("PdfInfo.DataPortal_Fetch", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
// Standard Refresh
|
||||||
|
#region extension
|
||||||
|
PdfInfoExtension _PdfInfoExtension = new PdfInfoExtension();
|
||||||
|
[Serializable()]
|
||||||
|
partial class PdfInfoExtension : extensionBase { }
|
||||||
|
[Serializable()]
|
||||||
|
class extensionBase
|
||||||
|
{
|
||||||
|
// Default Refresh
|
||||||
|
public virtual void Refresh(PdfInfo tmp) { }
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
} // Class
|
||||||
|
#region Converter
|
||||||
|
internal class PdfInfoConverter : ExpandableObjectConverter
|
||||||
|
{
|
||||||
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
|
{
|
||||||
|
if (destType == typeof(string) && value is PdfInfo)
|
||||||
|
{
|
||||||
|
// Return the ToString value
|
||||||
|
return ((PdfInfo)value).ToString();
|
||||||
|
}
|
||||||
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
} // Namespace
|
262
PROMS/VEPROMS.CSLA.Library/Generated/PdfInfoList.cs
Normal file
262
PROMS/VEPROMS.CSLA.Library/Generated/PdfInfoList.cs
Normal file
@ -0,0 +1,262 @@
|
|||||||
|
// ========================================================================
|
||||||
|
// Copyright 2007 - Volian Enterprises, Inc. All rights reserved.
|
||||||
|
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// $Workfile: $ $Revision: $
|
||||||
|
// $Author: $ $Date: $
|
||||||
|
//
|
||||||
|
// $History: $
|
||||||
|
// ========================================================================
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using Csla;
|
||||||
|
using Csla.Data;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.IO;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
namespace VEPROMS.CSLA.Library
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// PdfInfoList Generated by MyGeneration using the CSLA Object Mapping template
|
||||||
|
/// </summary>
|
||||||
|
[Serializable()]
|
||||||
|
[TypeConverter(typeof(PdfInfoListConverter))]
|
||||||
|
public partial class PdfInfoList : ReadOnlyListBase<PdfInfoList, PdfInfo>, ICustomTypeDescriptor, IDisposable
|
||||||
|
{
|
||||||
|
#region Log4Net
|
||||||
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
#endregion
|
||||||
|
#region Business Methods
|
||||||
|
internal new IList<PdfInfo> Items
|
||||||
|
{ get { return base.Items; } }
|
||||||
|
public void AddEvents()
|
||||||
|
{
|
||||||
|
foreach (PdfInfo tmp in this)
|
||||||
|
{
|
||||||
|
tmp.Changed += new PdfInfoEvent(tmp_Changed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void tmp_Changed(object sender)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Count; i++)
|
||||||
|
{
|
||||||
|
if (base[i] == sender)
|
||||||
|
this.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
foreach (PdfInfo tmp in this)
|
||||||
|
{
|
||||||
|
tmp.Changed -= new PdfInfoEvent(tmp_Changed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Factory Methods
|
||||||
|
public static PdfInfoList _PdfInfoList = null;
|
||||||
|
/// <summary>
|
||||||
|
/// Return a list of all PdfInfo.
|
||||||
|
/// </summary>
|
||||||
|
public static PdfInfoList Get()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_PdfInfoList != null)
|
||||||
|
return _PdfInfoList;
|
||||||
|
PdfInfoList tmp = DataPortal.Fetch<PdfInfoList>();
|
||||||
|
PdfInfo.AddList(tmp);
|
||||||
|
tmp.AddEvents();
|
||||||
|
_PdfInfoList = tmp;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new DbCslaException("Error on PdfInfoList.Get", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Reset the list of all PdfInfo.
|
||||||
|
/// </summary>
|
||||||
|
public static void Reset()
|
||||||
|
{
|
||||||
|
_PdfInfoList = null;
|
||||||
|
}
|
||||||
|
// CSLATODO: Add alternative gets -
|
||||||
|
//public static PdfInfoList Get(<criteria>)
|
||||||
|
//{
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// return DataPortal.Fetch<PdfInfoList>(new FilteredCriteria(<criteria>));
|
||||||
|
// }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
// throw new DbCslaException("Error on PdfInfoList.Get", ex);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
public static PdfInfoList GetByDocID(int docID)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PdfInfoList tmp = DataPortal.Fetch<PdfInfoList>(new DocIDCriteria(docID));
|
||||||
|
PdfInfo.AddList(tmp);
|
||||||
|
tmp.AddEvents();
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new DbCslaException("Error on PdfInfoList.GetByDocID", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private PdfInfoList()
|
||||||
|
{ /* require use of factory methods */ }
|
||||||
|
#endregion
|
||||||
|
#region Data Access Portal
|
||||||
|
private void DataPortal_Fetch()
|
||||||
|
{
|
||||||
|
this.RaiseListChangedEvents = false;
|
||||||
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PdfInfoList.DataPortal_Fetch", GetHashCode());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
{
|
||||||
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
|
cm.CommandText = "getPdfs";
|
||||||
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
|
{
|
||||||
|
IsReadOnly = false;
|
||||||
|
while (dr.Read()) this.Add(new PdfInfo(dr));
|
||||||
|
IsReadOnly = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("PdfInfoList.DataPortal_Fetch", ex);
|
||||||
|
throw new DbCslaException("PdfInfoList.DataPortal_Fetch", ex);
|
||||||
|
}
|
||||||
|
this.RaiseListChangedEvents = true;
|
||||||
|
}
|
||||||
|
[Serializable()]
|
||||||
|
private class DocIDCriteria
|
||||||
|
{
|
||||||
|
public DocIDCriteria(int docID)
|
||||||
|
{
|
||||||
|
_DocID = docID;
|
||||||
|
}
|
||||||
|
private int _DocID;
|
||||||
|
public int DocID
|
||||||
|
{
|
||||||
|
get { return _DocID; }
|
||||||
|
set { _DocID = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DataPortal_Fetch(DocIDCriteria criteria)
|
||||||
|
{
|
||||||
|
this.RaiseListChangedEvents = false;
|
||||||
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PdfInfoList.DataPortal_FetchDocID", GetHashCode());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
{
|
||||||
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
|
cm.CommandText = "getPdfsByDocID";
|
||||||
|
cm.Parameters.AddWithValue("@DocID", criteria.DocID);
|
||||||
|
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||||
|
{
|
||||||
|
IsReadOnly = false;
|
||||||
|
while (dr.Read()) this.Add(new PdfInfo(dr));
|
||||||
|
IsReadOnly = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (_MyLog.IsErrorEnabled) _MyLog.Error("PdfInfoList.DataPortal_FetchDocID", ex);
|
||||||
|
throw new DbCslaException("PdfInfoList.DataPortal_Fetch", ex);
|
||||||
|
}
|
||||||
|
this.RaiseListChangedEvents = true;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region ICustomTypeDescriptor impl
|
||||||
|
public String GetClassName()
|
||||||
|
{ return TypeDescriptor.GetClassName(this, true); }
|
||||||
|
public AttributeCollection GetAttributes()
|
||||||
|
{ return TypeDescriptor.GetAttributes(this, true); }
|
||||||
|
public String GetComponentName()
|
||||||
|
{ return TypeDescriptor.GetComponentName(this, true); }
|
||||||
|
public TypeConverter GetConverter()
|
||||||
|
{ return TypeDescriptor.GetConverter(this, true); }
|
||||||
|
public EventDescriptor GetDefaultEvent()
|
||||||
|
{ return TypeDescriptor.GetDefaultEvent(this, true); }
|
||||||
|
public PropertyDescriptor GetDefaultProperty()
|
||||||
|
{ return TypeDescriptor.GetDefaultProperty(this, true); }
|
||||||
|
public object GetEditor(Type editorBaseType)
|
||||||
|
{ return TypeDescriptor.GetEditor(this, editorBaseType, true); }
|
||||||
|
public EventDescriptorCollection GetEvents(Attribute[] attributes)
|
||||||
|
{ return TypeDescriptor.GetEvents(this, attributes, true); }
|
||||||
|
public EventDescriptorCollection GetEvents()
|
||||||
|
{ return TypeDescriptor.GetEvents(this, true); }
|
||||||
|
public object GetPropertyOwner(PropertyDescriptor pd)
|
||||||
|
{ return this; }
|
||||||
|
/// <summary>
|
||||||
|
/// Called to get the properties of this type. Returns properties with certain
|
||||||
|
/// attributes. this restriction is not implemented here.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="attributes"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
|
||||||
|
{ return GetProperties(); }
|
||||||
|
/// <summary>
|
||||||
|
/// Called to get the properties of this type.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public PropertyDescriptorCollection GetProperties()
|
||||||
|
{
|
||||||
|
// Create a collection object to hold property descriptors
|
||||||
|
PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
|
||||||
|
// Iterate the list
|
||||||
|
for (int i = 0; i < this.Items.Count; i++)
|
||||||
|
{
|
||||||
|
// Create a property descriptor for the item and add to the property descriptor collection
|
||||||
|
PdfInfoListPropertyDescriptor pd = new PdfInfoListPropertyDescriptor(this, i);
|
||||||
|
pds.Add(pd);
|
||||||
|
}
|
||||||
|
// return the property descriptor collection
|
||||||
|
return pds;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
} // Class
|
||||||
|
#region Property Descriptor
|
||||||
|
/// <summary>
|
||||||
|
/// Summary description for CollectionPropertyDescriptor.
|
||||||
|
/// </summary>
|
||||||
|
public partial class PdfInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||||
|
{
|
||||||
|
private PdfInfo Item { get { return (PdfInfo)_Item; } }
|
||||||
|
public PdfInfoListPropertyDescriptor(PdfInfoList collection, int index) : base(collection, index) { ;}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region Converter
|
||||||
|
internal class PdfInfoListConverter : ExpandableObjectConverter
|
||||||
|
{
|
||||||
|
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
|
||||||
|
{
|
||||||
|
if (destType == typeof(string) && value is PdfInfoList)
|
||||||
|
{
|
||||||
|
// Return department and department role separated by comma.
|
||||||
|
return ((PdfInfoList)value).Items.Count.ToString() + " Pdfs";
|
||||||
|
}
|
||||||
|
return base.ConvertTo(context, culture, value, destType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
} // Namespace
|
@ -325,7 +325,7 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
|
LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
|
||||||
MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
|
MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
|
||||||
MyDSOFile.SaveFile(doc.Length,doc.Ascii);
|
MyDSOFile.SaveFile(doc.Length,doc.Ascii,MyDisplayTabItem.MyItemInfo);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Before a document closes check to see if it's contents should be saved.
|
/// Before a document closes check to see if it's contents should be saved.
|
||||||
|
@ -227,7 +227,7 @@ namespace Volian.Controls.Library
|
|||||||
int nBytesRead = fs.Read(ByteArray, 0, (int)len);
|
int nBytesRead = fs.Read(ByteArray, 0, (int)len);
|
||||||
fs.Close();
|
fs.Close();
|
||||||
string t1 = (title == null || title == "") ? null : title;
|
string t1 = (title == null || title == "") ? null : title;
|
||||||
Document doc = Document.MakeDocument(t1, ByteArray, null, null, null); //, DateTime.Now, "Migration");
|
Document doc = Document.MakeDocument(t1, ByteArray, null, null); //, DateTime.Now, "Migration");
|
||||||
return doc.DocID;
|
return doc.DocID;
|
||||||
}
|
}
|
||||||
// for an io exception, keep trying
|
// for an io exception, keep trying
|
||||||
|
@ -316,9 +316,9 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
readerWord = myPdfFile != null ? new PdfReader(myPdfFile) : null;
|
readerWord = myPdfFile != null ? new PdfReader(myPdfFile) : null;
|
||||||
OnStatusChanged("Get Section", PromsPrinterStatusType.GetSection);
|
OnStatusChanged("Get Section", PromsPrinterStatusType.GetSection);
|
||||||
if (mySection.MyContent.MyEntry.MyDocument.DocumentConfig.Printing_Length != 0) //.SectionConfig.Section_NumPages != "")
|
int sectPageCount=0;
|
||||||
{
|
using(PdfInfo myPdf = PdfInfo.Get(mySection))
|
||||||
int sectPageCount = (int)(Math.Ceiling(mySection.MyContent.MyEntry.MyDocument.DocumentConfig.Printing_Length)); //decimal.Parse(mySection.MyContent.MyEntry.MyDocument.DocumentConfig.Printing_Length)));
|
sectPageCount = (int)(Math.Ceiling(myPdf.PageCount));
|
||||||
for (int ii = 0; ii < sectPageCount; ii++)
|
for (int ii = 0; ii < sectPageCount; ii++)
|
||||||
{
|
{
|
||||||
int pageNumber = 1 + ii;
|
int pageNumber = 1 + ii;
|
||||||
@ -344,7 +344,6 @@ namespace Volian.Print.Library
|
|||||||
OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage);
|
OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user