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 ProcessItem [Serializable] public class ProcessItem:AuditTrailBase { #region Cache Store private static Cache _cache = new Cache(typeof(ProcessItem)); #endregion #region Constructor public ProcessItem() { _itemCode = 0; _defaultDescription = string.Empty; _userDescription = string.Empty; _position = 0; _itemGroup = 0; } #endregion #region Properties #region itemCode : int private int _itemCode; public int ItemCode { get { return _itemCode; } set { base.OnPropertyChange("itemCode", _itemCode, value); _itemCode = value; } } #endregion #region defaultDescription : string private string _defaultDescription; public string DefaultDescription { get { return _defaultDescription; } set { base.OnPropertyChange("defaultDescription", _defaultDescription, value); _defaultDescription = value; } } #endregion #region userDescription : string private string _userDescription; public string UserDescription { get { return _userDescription; } set { base.OnPropertyChange("userDescription", _userDescription, value); _userDescription = value; } } #endregion #region position : int private int _position; public int Position { get { return _position; } set { base.OnPropertyChange("position", _position, value); _position = value; } } #endregion #region itemGroup : int private int _itemGroup; public int ItemGroup { get { return _itemGroup; } set { base.OnPropertyChange("itemGroup", _itemGroup, value); _itemGroup = value; } } #endregion #region Service Factory IProcessItemService : IProcessItemService internal static IProcessItemService Service { get { return Services.Factory.CreateService(typeof(IProcessItemService)); } } #endregion #endregion #region Functions public static ProcessItem Get(ID nID) { ProcessItem oProcessItem = null; #region Cache Header oProcessItem = (ProcessItem)_cache["Get", nID]; if (oProcessItem != null) return oProcessItem; #endregion oProcessItem = ProcessItem.Service.Get(nID); #region Cache Footer _cache.Add(oProcessItem, "Get", nID); #endregion return oProcessItem; } public static ProcessItem Get(int itemCode, ObjectsTemplate porcessItems) { return porcessItems.Find(delegate(ProcessItem item) { return item.ItemCode == itemCode; }); } public static ObjectsTemplate Get() { #region Cache Header ObjectsTemplate processItems = _cache["Get"] as ObjectsTemplate; if (processItems != null) return processItems; #endregion try { processItems = Service.Get(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(processItems, "Get"); #endregion return processItems; } public static ObjectsTemplate GetForTHeadGroup() { #region Cache Header ObjectsTemplate processItems = _cache["GetForTHeadGroup"] as ObjectsTemplate; if (processItems != null) return processItems; #endregion try { processItems = Service.GetForTHeadGroup(); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(processItems, "GetForTHeadGroup"); #endregion return processItems; } public ID Save() { return ProcessItem.Service.Save(this); } public void Delete() { ProcessItem.Service.Delete(ID); } #endregion } #endregion #region IProcessItem Service public interface IProcessItemService { ProcessItem Get(ID id); ObjectsTemplate Get(); ObjectsTemplate GetForTHeadGroup(); ID Save(ProcessItem item); void Delete(ID id); } #endregion }