CEL_Payroll/Payroll.BO/SearchReport/ReportAuthorization.cs

225 lines
5.6 KiB
C#
Raw Permalink 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 ReportAuthorization
[Serializable]
public class ReportAuthorization:AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(ReportAuthorization));
#endregion
#region Constructor
public ReportAuthorization()
{
_reportID = null;
_authorizePersionId = null;
_position = 0;
}
#endregion
#region Properties
#region ReportID : ID
private ID _reportID;
public ID ReportID
{
get { return _reportID; }
set
{
base.OnPropertyChange<ID>("ReportID", _reportID, value);
_reportID = value;
}
}
#endregion
#region AuthorizePersionId : ID
private ID _authorizePersionId;
public ID AuthorizePersionId
{
get { return _authorizePersionId; }
set
{
base.OnPropertyChange<ID>("AuthorizePersionId", _authorizePersionId, value);
_authorizePersionId = value;
}
}
#endregion
#region position : int
private int _position;
public int Position
{
get { return _position; }
set
{
base.OnPropertyChange<int>("position", _position, value);
_position = value;
}
}
#endregion
#region Service Factory IReportAuthorizationService : IReportAuthorizationService
internal static IReportAuthorizationService Service
{
get { return Services.Factory.CreateService<IReportAuthorizationService>(typeof(IReportAuthorizationService)); }
}
#endregion
#endregion
#region Functions
public static ReportAuthorization Get(ID nID)
{
ReportAuthorization oReportAuthorization = null;
#region Cache Header
oReportAuthorization = (ReportAuthorization)_cache["Get", nID];
if (oReportAuthorization != null)
return oReportAuthorization;
#endregion
oReportAuthorization = ReportAuthorization.Service.Get(nID);
#region Cache Footer
_cache.Add(oReportAuthorization, "Get", nID);
#endregion
return oReportAuthorization;
}
public static ObjectsTemplate<ReportAuthorization> Get()
{
#region Cache Header
ObjectsTemplate<ReportAuthorization> reportAuthorizations = _cache["Get"] as ObjectsTemplate<ReportAuthorization>;
if (reportAuthorizations != null)
return reportAuthorizations;
#endregion
try
{
reportAuthorizations = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(reportAuthorizations, "Get");
#endregion
return reportAuthorizations;
}
public static ObjectsTemplate<ReportAuthorization> GetByReportID(ID reportID)
{
#region Cache Header
ObjectsTemplate<ReportAuthorization> reportAuthorizations = _cache["GetByReportID"] as ObjectsTemplate<ReportAuthorization>;
if (reportAuthorizations != null)
return reportAuthorizations;
#endregion
try
{
reportAuthorizations = Service.GetByReportID(reportID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(reportAuthorizations, "GetByReportID");
#endregion
return reportAuthorizations;
}
public static ReportAuthorization Get(ID reportID,int position)
{
#region Cache Header
ReportAuthorization reportAuthorization = _cache["GetByReportID"] as ReportAuthorization;
if (reportAuthorization != null)
return reportAuthorization;
#endregion
try
{
reportAuthorization = Service.Get(reportID,position);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(reportAuthorization, "GetByReportID");
#endregion
return reportAuthorization;
}
public ID Save()
{
return ReportAuthorization.Service.Save(this);
}
public void Delete()
{
ReportAuthorization.Service.Delete(ID);
}
public void Delete(ID iD)
{
ReportAuthorization.Service.Delete(iD);
}
#endregion
}
#endregion
#region IReportAuthorization Service
public interface IReportAuthorizationService
{
ReportAuthorization Get(ID id);
ObjectsTemplate<ReportAuthorization> Get();
ObjectsTemplate<ReportAuthorization> GetByReportID(ID reportID);
ReportAuthorization Get(ID reportID, int position);
ID Save(ReportAuthorization item);
void Delete(ID id);
}
#endregion
}