CEL_Payroll/Payroll.BO/Basic/AutoObject.cs

124 lines
2.5 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 AutoObject
[Serializable]
public class AutoObject : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(AutoObject));
#endregion
#region Constructor
public AutoObject()
{
_menuKey = string.Empty;
_name = 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 MenuKey : string
private string _menuKey;
public string MenuKey
{
get { return _menuKey; }
set
{
base.OnPropertyChange<string>("MenuKey", _menuKey, value);
_menuKey = value;
}
}
#endregion
#region Service Factory IDesignationService : IDesignationService
internal static IAutoObjectService Service
{
get { return Services.Factory.CreateService<IAutoObjectService>(typeof(IAutoObjectService)); }
}
#endregion
#endregion
#region Functions
public static AutoObject Get(string sFormName)
{
AutoObject oItem = null;
#region Cache Header
oItem = (AutoObject)_cache["Get", sFormName];
if (oItem != null)
return oItem;
#endregion
oItem = AutoObject.Service.Get(sFormName);
#region Cache Footer
_cache.Add(oItem, "Get", sFormName);
#endregion
return oItem;
}
public ID Save()
{
this.SetAuditTrailProperties();
return AutoObject.Service.Save(this);
}
public void Delete(ID id)
{
AutoObject.Service.Delete(id);
}
#endregion
}
#endregion
#region IAutoObjectService Service
public interface IAutoObjectService
{
AutoObject Get(string sFormName);
ID Save(AutoObject item);
void Delete(ID id);
}
#endregion
}