CEL_Payroll/Payroll.BO/SearchReport/ReportItem.cs

534 lines
13 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.CoreV35;
using Ease.CoreV35.Model;
using Ease.CoreV35.Caching;
using System.Data.Linq.Mapping;
namespace Payroll.BO
{
#region ReportItem
[Serializable]
public class ReportItem : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(ReportItem));
#endregion
#region Constructor
public ReportItem()
{
_reportID = null;
_name = string.Empty;
_reportType = string.Empty;
_defaultHeader = string.Empty;
_userHeader1 = string.Empty;
_userHeader2 = string.Empty;
_chronology = 0;
_searchFrom = 0;
_itemType = 0;
_isCompanyInfo = false;
_isDateMonth = false;
_isSearchCriteria = false;
_isGroupEachPage = false;
_isPageNo = false;
_isDateTime = false;
_isGroupbyCriteria = false;
_bankNeeded = false;
_isSignatoriesEachPageFooter = false;
_progressBar = 0;
_iNSQL = string.Empty;
_searchItems = string.Empty;
}
#endregion
#region Properties
#region ReportAuthorization
private ObjectsTemplate<ReportAuthorization> _reportAuthorization;
public ObjectsTemplate<ReportAuthorization> ReportAuthors
{
get
{
if (_reportAuthorization == null)
{
_reportAuthorization = new ObjectsTemplate<ReportAuthorization>();
}
return _reportAuthorization;
}
set { _reportAuthorization = value; }
}
#endregion
#region reportID : ID
private ID _reportID;
public ID ReportID
{
get { return _reportID; }
set
{
base.OnPropertyChange<ID>("reportID", _reportID, value);
_reportID = value;
}
}
#endregion
#region name : string
private string _name;
public string Name
{
get { return _name; }
set
{
base.OnPropertyChange<string>("name", _name, value);
_name = value;
}
}
#endregion
#region defaultHeader : string
private string _defaultHeader;
public string DefaultHeader
{
get { return _defaultHeader; }
set
{
base.OnPropertyChange<string>("defaultHeader", _defaultHeader, value);
_defaultHeader = value;
}
}
#endregion
#region userHeader1 : string
private string _userHeader1;
public string UserHeader1
{
get { return _userHeader1; }
set
{
base.OnPropertyChange<string>("userHeader1", _userHeader1, value);
_userHeader1 = value;
}
}
#endregion
#region userHeader2 : string
private string _userHeader2;
public string UserHeader2
{
get { return _userHeader2; }
set
{
base.OnPropertyChange<string>("userHeader2", _userHeader2, value);
_userHeader2 = value;
}
}
#endregion
#region chronology : EnumChronology
private EnumChronology _chronology;
public EnumChronology Chronology
{
get { return _chronology; }
set
{
base.OnPropertyChange<short>("chronology",(short) _chronology, (short)value);
_chronology = value;
}
}
#endregion
#region searchFrom : EnumSearchFromTable
private EnumSearchFrom _searchFrom;
public EnumSearchFrom SearchFrom
{
get { return _searchFrom; }
set
{
base.OnPropertyChange<short>("searchFrom",(short) _searchFrom, (short)value);
_searchFrom = value;
}
}
#endregion
#region itemType : EnumReportItemType
private EnumReportItemType _itemType;
public EnumReportItemType ItemType
{
get { return _itemType; }
set
{
base.OnPropertyChange<short>("itemType",(short) _itemType, (short)value);
_itemType = value;
}
}
#endregion
#region bankNeeded : bool
private bool _bankNeeded;
public bool BankNeeded
{
get { return _bankNeeded; }
set
{
base.OnPropertyChange<bool>("bankNeeded", _bankNeeded, value);
_bankNeeded = value;
}
}
#endregion
#region isCompanyInfo : bool
private bool _isCompanyInfo;
public bool IsCompanyInfo
{
get { return _isCompanyInfo; }
set
{
base.OnPropertyChange<bool>("isCompanyInfo", _isCompanyInfo, value);
_isCompanyInfo = value;
}
}
#endregion
#region isPageNo : bool
private bool _isPageNo;
public bool IsPageNo
{
get { return _isPageNo; }
set
{
base.OnPropertyChange<bool>("isPageNo", _isPageNo, value);
_isPageNo = value;
}
}
#endregion
#region isDateMonth : bool
private bool _isDateMonth;
public bool IsDateMonth
{
get { return _isDateMonth; }
set
{
base.OnPropertyChange<bool>("isDateMonth", _isDateMonth, value);
_isDateMonth = value;
}
}
#endregion
#region isSearchCriteria : bool
private bool _isSearchCriteria;
public bool IsSearchCriteria
{
get { return _isSearchCriteria; }
set
{
base.OnPropertyChange<bool>("isSearchCriteria", _isSearchCriteria, value);
_isSearchCriteria = value;
}
}
#endregion
#region isGroupbyCriteria : bool
private bool _isGroupbyCriteria;
public bool IsGroupbyCriteria
{
get { return _isGroupbyCriteria; }
set
{
base.OnPropertyChange<bool>("isGroupbyCriteria", _isGroupbyCriteria, value);
_isGroupbyCriteria = value;
}
}
#endregion
#region isSignatoriesEachPageFooter : bool
private bool _isSignatoriesEachPageFooter;
public bool IsSignatoriesEachPageFooter
{
get { return _isSignatoriesEachPageFooter; }
set
{
base.OnPropertyChange<bool>("isSignatoriesEachPageFooter", _isSignatoriesEachPageFooter, value);
_isSignatoriesEachPageFooter = value;
}
}
#endregion
#region isDateTime : bool
private bool _isDateTime;
public bool IsDateTime
{
get { return _isDateTime; }
set
{
base.OnPropertyChange<bool>("isDateTime", _isDateTime, value);
_isDateTime = value;
}
}
#endregion
#region isGroupEachPage : bool
private bool _isGroupEachPage;
public bool IsGroupEachPage
{
get { return _isGroupEachPage; }
set
{
base.OnPropertyChange<bool>("isGroupEachPage", _isGroupEachPage, value);
_isGroupEachPage = value;
}
}
#endregion
#region iNSQL : string
private string _iNSQL;
public string INSQL
{
get { return _iNSQL; }
set
{
base.OnPropertyChange<string>("iNSQL", _iNSQL, value);
_iNSQL = value;
}
}
#endregion
#region searchItems : string
private string _searchItems;
public string SearchItems
{
get { return _searchItems; }
set
{
base.OnPropertyChange<string>("searchItems", _searchItems, value);
_searchItems = value;
}
}
#endregion
#region groupby : string
private string _groupby;
public string Groupby
{
get { return _groupby; }
set
{
base.OnPropertyChange<string>("groupby", _groupby, value);
_groupby = value;
}
}
#endregion
#region progressBar : int
private int _progressBar;
public int ProgressBar
{
get { return _progressBar; }
set
{
base.OnPropertyChange<int>("progressBar", _progressBar, value);
_progressBar = value;
}
}
#endregion
#region reportType : string
private string _reportType;
public string ReportType
{
get { return _reportType; }
set
{
base.OnPropertyChange<string>("reportType", _reportType, value);
_reportType = value;
}
}
#endregion
#region Object name : string
private string _objectName;
public string ObjectName
{
get { return _objectName; }
set
{
base.OnPropertyChange<string>("ObjectName", _objectName, value);
_objectName = value;
}
}
#endregion
#region Function name : string
private string _functionName;
public string FunctionName
{
get { return _functionName; }
set
{
base.OnPropertyChange<string>("ObjectName", _functionName, value);
_functionName = value;
}
}
#endregion
#region Service Factory IReportItemService : IReportItemService
internal static IReportItemService Service
{
get { return Services.Factory.CreateService<IReportItemService>(typeof(IReportItemService)); }
}
#endregion
#endregion
#region Functions
public static ReportItem Get(ID nID)
{
ReportItem oReportItem = null;
#region Cache Header
oReportItem = (ReportItem)_cache["Get", nID];
if (oReportItem != null)
return oReportItem;
#endregion
oReportItem = ReportItem.Service.Get(nID);
#region Cache Footer
_cache.Add(oReportItem, "Get", nID);
#endregion
return oReportItem;
}
public static ReportItem GetByReportType(int reportID)
{
ReportItem oReportItem = null;
#region Cache Header
oReportItem = (ReportItem)_cache["GetByReportType", reportID];
if(oReportItem != null)
return oReportItem;
#endregion
oReportItem = ReportItem.Service.GetByReportType(reportID);
#region Cache Footer
_cache.Add(oReportItem, "GetByReportType", reportID);
#endregion
return oReportItem;
}
public static ObjectsTemplate<ReportItem> Get(EnumStatus eStatus)
{
#region Cache Header
ObjectsTemplate<ReportItem> reportItems = _cache["Get"] as ObjectsTemplate<ReportItem>;
if (reportItems != null)
return reportItems;
#endregion
try
{
reportItems = Service.Get(eStatus);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(reportItems, "Get");
#endregion
return reportItems;
}
public ID Save()
{
base.SetAuditTrailProperties();
return ReportItem.Service.Save(this);
}
public void Delete()
{
ReportItem.Service.Delete(ID);
}
#endregion
public static bool IsExist(ID ReportID)
{
return ReportItem.Service.IsExist(ReportID);
}
}
#endregion
#region IReportItem Service
public interface IReportItemService
{
ReportItem Get(ID id);
ObjectsTemplate<ReportItem> Get(EnumStatus eStatus);
ID Save(ReportItem item);
void Delete(ID id);
bool IsExist(ID ReportID);
ReportItem GetByReportType(int reportID);
}
#endregion
}