438 lines
12 KiB
C#
438 lines
12 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using Ease.CoreV35;
|
|||
|
using Ease.CoreV35.Model;
|
|||
|
using System.Data.Linq.Mapping;
|
|||
|
|
|||
|
namespace Payroll.BO
|
|||
|
{
|
|||
|
[Serializable]
|
|||
|
public abstract class AuditTrailBase : ObjectTemplate
|
|||
|
{
|
|||
|
protected ID _createdBy=null ;
|
|||
|
protected ID _modifiedBy = null;
|
|||
|
protected DateTime _createdDate;
|
|||
|
protected DateTime? _modifiedDate;
|
|||
|
|
|||
|
[Column(Storage = "_CreatedBy", DbType = "Int NOT NULL")]
|
|||
|
public ID CreatedBy
|
|||
|
{
|
|||
|
get { return this._createdBy; }
|
|||
|
set
|
|||
|
{
|
|||
|
|
|||
|
if (this._createdBy != value)
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("CreatedBy", _createdBy, value);
|
|||
|
this._createdBy = value;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
[Column(Storage = "_CreatedDate", DbType = "DateTime NOT NULL")]
|
|||
|
public DateTime CreatedDate
|
|||
|
{
|
|||
|
get { return this._createdDate; }
|
|||
|
set
|
|||
|
{
|
|||
|
if ((this._createdDate != value))
|
|||
|
base.OnPropertyChange<DateTime>("CreatedDate", _createdDate, value);
|
|||
|
|
|||
|
this._createdDate = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
[Column(Storage = "_ModifiedBy", DbType = "Int")]
|
|||
|
public ID ModifiedBy
|
|||
|
{
|
|||
|
get { return this._modifiedBy; }
|
|||
|
set
|
|||
|
{
|
|||
|
if (this._modifiedBy != value)
|
|||
|
base.OnPropertyChange<ID>("ModifiedBy", _modifiedBy, value);
|
|||
|
|
|||
|
this._modifiedBy = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
[Column(Storage = "_ModifiedDate", DbType = "DateTime")]
|
|||
|
public DateTime? ModifiedDate
|
|||
|
{
|
|||
|
get { return this._modifiedDate; }
|
|||
|
set
|
|||
|
{
|
|||
|
if (this._modifiedDate != value)
|
|||
|
base.OnPropertyChange<DateTime>("ModifiedDate", _modifiedDate, value);
|
|||
|
|
|||
|
this._modifiedDate = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected virtual void SetAuditTrailProperties(DateTime auTime, ID userID)
|
|||
|
{
|
|||
|
if (this.IsNew)
|
|||
|
{
|
|||
|
_createdBy = userID;
|
|||
|
_createdDate = auTime;
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
_modifiedBy = userID;
|
|||
|
_modifiedDate = auTime;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected virtual void SetAuditTrailProperties()
|
|||
|
{
|
|||
|
this.SetAuditTrailProperties(DateTime.Today, User.CurrentUser.ID);
|
|||
|
}
|
|||
|
}
|
|||
|
[Serializable]
|
|||
|
public abstract class BasicBaseObject :AuditTrailBase
|
|||
|
{
|
|||
|
protected int _sequence;
|
|||
|
protected EnumStatus _status;
|
|||
|
protected int _IDInteger;
|
|||
|
|
|||
|
[Column(Storage = "_Sequence", DbType = "Int NOT NULL")]
|
|||
|
public int Sequence
|
|||
|
{
|
|||
|
get { return this._sequence ; }
|
|||
|
set
|
|||
|
{
|
|||
|
|
|||
|
if (this._sequence != value)
|
|||
|
{
|
|||
|
base.OnPropertyChange<int>("Sequence", _sequence, value);
|
|||
|
this._sequence = value;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public int IDInteger
|
|||
|
{
|
|||
|
get {
|
|||
|
if (this.ID == null) return 0;
|
|||
|
else return this.ID.Integer; }
|
|||
|
}
|
|||
|
|
|||
|
[Column(Storage = "_Status", DbType = "int NOT NULL")]
|
|||
|
public EnumStatus Status
|
|||
|
{
|
|||
|
get { return this._status; }
|
|||
|
set
|
|||
|
{
|
|||
|
if ((this._status != value))
|
|||
|
base.OnPropertyChange<short>("Status", (short)_status, (short)value);
|
|||
|
|
|||
|
this._status = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected virtual void SetBasicBaseObject(DateTime auTime, ID userID)
|
|||
|
{
|
|||
|
base.SetAuditTrailProperties(auTime, userID);
|
|||
|
if (this._sequence <=0 )
|
|||
|
{
|
|||
|
throw new ServiceException("Sequence can not be zero.");
|
|||
|
}
|
|||
|
}
|
|||
|
public int GetNextSequence(string tableName)
|
|||
|
{
|
|||
|
int sequence=0;
|
|||
|
return sequence;
|
|||
|
}
|
|||
|
|
|||
|
public void UpdateStatus(string tableName, EnumStatus status )
|
|||
|
{
|
|||
|
}
|
|||
|
public void SetObjectID(int IdValue)
|
|||
|
{
|
|||
|
this.SetID(ID.FromInteger(IdValue));
|
|||
|
}
|
|||
|
protected override void SetAuditTrailProperties()
|
|||
|
{
|
|||
|
|
|||
|
//if (base.IsNew == true && _status != EnumStatus.Active)
|
|||
|
base.SetAuditTrailProperties(DateTime.Today, User.CurrentUser.ID);
|
|||
|
}
|
|||
|
|
|||
|
protected virtual void SetBasicBaseObjectProperties()
|
|||
|
{
|
|||
|
// this.SetAuditTrailProperties(GlobalFunctions.GetOperationDate(), User.CurrentUser.ID);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
[Serializable]
|
|||
|
public abstract class UpdateAuditTrail : ObjectTemplate
|
|||
|
{
|
|||
|
protected ID _modifiedBy;
|
|||
|
protected DateTime? _modifiedDate;
|
|||
|
|
|||
|
[Column(Storage = "_ModifiedBy", DbType = "Int")]
|
|||
|
public ID ModifiedBy
|
|||
|
{
|
|||
|
get { return this._modifiedBy; }
|
|||
|
set
|
|||
|
{
|
|||
|
if (this._modifiedBy != value)
|
|||
|
base.OnPropertyChange<ID>("ModifiedBy", _modifiedBy, value);
|
|||
|
|
|||
|
this._modifiedBy = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
[Column(Storage = "_ModifiedDate", DbType = "DateTime")]
|
|||
|
public DateTime? ModifiedDate
|
|||
|
{
|
|||
|
get { return this._modifiedDate; }
|
|||
|
set
|
|||
|
{
|
|||
|
if (this._modifiedDate != value)
|
|||
|
base.OnPropertyChange<DateTime>("ModifiedDate", _modifiedDate, value);
|
|||
|
|
|||
|
this._modifiedDate = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected virtual void SetAuditTrailProperties(DateTime auTime, ID userID)
|
|||
|
{
|
|||
|
if (!this.IsNew)
|
|||
|
{
|
|||
|
_modifiedBy = userID;
|
|||
|
_modifiedDate = auTime;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected virtual void SetAuditTrailProperties()
|
|||
|
{
|
|||
|
//this.SetAuditTrailProperties(GlobalFunctions.GetOperationDate(), User.CurrentUser.ID);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
[Serializable]
|
|||
|
public abstract class ImportFileBase : AuditTrailBase
|
|||
|
{
|
|||
|
protected ImportFileBase()
|
|||
|
: base()
|
|||
|
{
|
|||
|
this._hasDateFormat = false;
|
|||
|
this._dateFormat = string.Empty;
|
|||
|
this._decimalSep = string.Empty;
|
|||
|
this._isPreFormated = true;
|
|||
|
this._hasFileHeader = false;
|
|||
|
this._headeronTop = false;
|
|||
|
this._nameValueHeader = false;
|
|||
|
this._nameValuSep = string.Empty;
|
|||
|
this._hasColumnHeader = false;
|
|||
|
this._isFixedLength = false;
|
|||
|
this._isSkipLine = false;
|
|||
|
this._skipTop = 0;
|
|||
|
this._skipBottom = 0;
|
|||
|
}
|
|||
|
|
|||
|
#region Property HasDateFormat : bool
|
|||
|
|
|||
|
protected bool _hasDateFormat;
|
|||
|
public bool HasDateFormat
|
|||
|
{
|
|||
|
get { return _hasDateFormat; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<bool>("HasDateFormat", _hasDateFormat, value);
|
|||
|
_hasDateFormat = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Property DateFormat : string
|
|||
|
|
|||
|
protected string _dateFormat;
|
|||
|
public string DateFormat
|
|||
|
{
|
|||
|
get { return _dateFormat; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<string>("DateFormat", _dateFormat, value);
|
|||
|
_dateFormat = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Property DecimalSeparator : string
|
|||
|
|
|||
|
protected string _decimalSep;
|
|||
|
public string DecimalSeparator
|
|||
|
{
|
|||
|
get { return _decimalSep; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<string>("DecimalSeparator", _decimalSep, value);
|
|||
|
_decimalSep = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Property IsPreFormated : bool
|
|||
|
|
|||
|
protected bool _isPreFormated;
|
|||
|
public bool IsPreFormated
|
|||
|
{
|
|||
|
get { return _isPreFormated; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<bool>("IsPreFormated", _isPreFormated, value);
|
|||
|
_isPreFormated = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Property HasFileHeader : bool
|
|||
|
|
|||
|
protected bool _hasFileHeader;
|
|||
|
public bool HasFileHeader
|
|||
|
{
|
|||
|
get { return _hasFileHeader; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<bool>("HasFileHeader", _hasFileHeader, value);
|
|||
|
_hasFileHeader = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Property IsFileHeaderonTop : bool
|
|||
|
|
|||
|
protected bool _headeronTop;
|
|||
|
public bool IsFileHeaderonTop
|
|||
|
{
|
|||
|
get { return _headeronTop; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<bool>("IsFileHeaderonTop", _headeronTop, value);
|
|||
|
_headeronTop = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Property IsNameValueHeader : bool
|
|||
|
|
|||
|
protected bool _nameValueHeader;
|
|||
|
public bool IsNameValueHeader
|
|||
|
{
|
|||
|
get { return _nameValueHeader; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<bool>("IsNameValueHeader", _nameValueHeader, value);
|
|||
|
_nameValueHeader = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Property NameValueSeparator : string
|
|||
|
|
|||
|
protected string _nameValuSep;
|
|||
|
public string NameValueSeparator
|
|||
|
{
|
|||
|
get { return _nameValuSep; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<string>("NameValueSeparator", _nameValuSep, value);
|
|||
|
_nameValuSep = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Property HasColumnHeader : bool
|
|||
|
|
|||
|
protected bool _hasColumnHeader;
|
|||
|
public bool HasColumnHeader
|
|||
|
{
|
|||
|
get { return _hasColumnHeader; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<bool>("HasColumnHeader", _hasColumnHeader, value);
|
|||
|
_hasColumnHeader = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#region Property IsFixedLength : bool
|
|||
|
|
|||
|
protected bool _isFixedLength;
|
|||
|
public bool IsFixedLength
|
|||
|
{
|
|||
|
get { return _isFixedLength; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<bool>("IsFixedLength", _isFixedLength, value);
|
|||
|
_isFixedLength = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region Property IsSkipLine : bool
|
|||
|
|
|||
|
protected bool _isSkipLine;
|
|||
|
public bool IsSkipLine
|
|||
|
{
|
|||
|
get { return _isSkipLine; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<bool>("IsSkipLine", _isSkipLine, value);
|
|||
|
_isSkipLine = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Property SkipTop : int
|
|||
|
|
|||
|
protected int _skipTop;
|
|||
|
public int SkipTop
|
|||
|
{
|
|||
|
get { return _skipTop; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<int>("SkipTop", _skipTop, value);
|
|||
|
_skipTop = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Property SkipBottom : int
|
|||
|
|
|||
|
protected int _skipBottom;
|
|||
|
public int SkipBottom
|
|||
|
{
|
|||
|
get { return _skipBottom; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<int>("SkipBottom", _skipBottom, value);
|
|||
|
_skipBottom = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|