CEL_Payroll/Payroll.BO/UnAuthLeave/UnAuthorizeLeave.cs

164 lines
4.0 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;
using System.Data;
namespace Payroll.BO
{
#region UnAuthorizeLeave
[Serializable]
public class UnAuthorizeLeave : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(UnAuthorizeLeave));
#endregion
#region Constructor
public UnAuthorizeLeave()
{
_name = string.Empty;
_code = string.Empty;
}
#endregion
#region Properties
#region name : string
private string _name;
public string Name
{
get { return _name; }
set
{
base.OnPropertyChange<string>("name", _name, value);
_name = value;
}
}
#endregion
#region code : string
private string _code;
public string Code
{
get { return _code; }
set
{
base.OnPropertyChange<string>("code", _code, value);
_code = value;
}
}
#endregion
#region Service Factory IUnAuthorizeLeaveService : IUnAuthorizeLeaveService
internal static IUnAuthorizeLeaveService Service
{
get { return Services.Factory.CreateService<IUnAuthorizeLeaveService>(typeof(IUnAuthorizeLeaveService)); }
}
#endregion
#endregion
#region Functions
public static UnAuthorizeLeave Get(ID nID)
{
UnAuthorizeLeave oUnAuthorizeLeave = null;
#region Cache Header
oUnAuthorizeLeave = (UnAuthorizeLeave)_cache["Get", nID];
if (oUnAuthorizeLeave != null)
return oUnAuthorizeLeave;
#endregion
oUnAuthorizeLeave = UnAuthorizeLeave.Service.Get(nID);
#region Cache Footer
_cache.Add(oUnAuthorizeLeave, "Get", nID);
#endregion
return oUnAuthorizeLeave;
}
public static UnAuthorizeLeave Get(string sCode)
{
UnAuthorizeLeave oUnAuthorizeLeave = null;
#region Cache Header
oUnAuthorizeLeave = (UnAuthorizeLeave)_cache["Get", sCode];
if (oUnAuthorizeLeave != null)
return oUnAuthorizeLeave;
#endregion
oUnAuthorizeLeave = UnAuthorizeLeave.Service.Get(sCode);
#region Cache Footer
_cache.Add(oUnAuthorizeLeave, "Get", sCode);
#endregion
return oUnAuthorizeLeave;
}
public static ObjectsTemplate<UnAuthorizeLeave> Get()
{
#region Cache Header
ObjectsTemplate<UnAuthorizeLeave> unAuthorizeLeaves = _cache["Get"] as ObjectsTemplate<UnAuthorizeLeave>;
if (unAuthorizeLeaves != null)
return unAuthorizeLeaves;
#endregion
try
{
unAuthorizeLeaves = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(unAuthorizeLeaves, "Get");
#endregion
return unAuthorizeLeaves;
}
public ID Save()
{
base.SetAuditTrailProperties();
return UnAuthorizeLeave.Service.Save(this);
}
public void Delete()
{
UnAuthorizeLeave.Service.Delete(ID);
}
#endregion
}
#endregion
#region IUnAuthorizeLeave Service
public interface IUnAuthorizeLeaveService
{
UnAuthorizeLeave Get(ID id);
ObjectsTemplate<UnAuthorizeLeave> Get();
ID Save(UnAuthorizeLeave item);
void Delete(ID id);
UnAuthorizeLeave Get(string sCode);
}
#endregion
}