CEL_Payroll/Payroll.BO/SearchReport/SearchSalaryItem.cs

162 lines
3.7 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 SearchSalaryItem
[Serializable]
public class SearchSalaryItem:AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(SearchSalaryItem));
#endregion
#region Constructor
public SearchSalaryItem()
{
_description = string.Empty;
_selected = false;
_field = 0;
}
#endregion
#region Properties
#region description : string
private string _description;
public string Description
{
get { return _description; }
set
{
base.OnPropertyChange<string>("description", _description, value);
_description = value;
}
}
#endregion
#region selected : bool
private bool _selected;
public bool Selected
{
get { return _selected; }
set
{
base.OnPropertyChange<bool>("selected", _selected, value);
_selected = value;
}
}
#endregion
#region field : int
private int _field;
public int Field
{
get { return _field; }
set
{
base.OnPropertyChange<int>("field", _field, value);
_field = value;
}
}
#endregion
#region Service Factory ISearchSalaryItemService : ISearchSalaryItemService
internal static ISearchSalaryItemService Service
{
get { return Services.Factory.CreateService<ISearchSalaryItemService>(typeof(ISearchSalaryItemService)); }
}
#endregion
#endregion
#region Functions
public static SearchSalaryItem Get(ID nID)
{
SearchSalaryItem oSearchSalaryItem = null;
#region Cache Header
oSearchSalaryItem = (SearchSalaryItem)_cache["Get", nID];
if (oSearchSalaryItem != null)
return oSearchSalaryItem;
#endregion
oSearchSalaryItem = SearchSalaryItem.Service.Get(nID);
#region Cache Footer
_cache.Add(oSearchSalaryItem, "Get", nID);
#endregion
return oSearchSalaryItem;
}
public static ObjectsTemplate<SearchSalaryItem> Get()
{
#region Cache Header
ObjectsTemplate<SearchSalaryItem> searchSalaryItems = _cache["Get"] as ObjectsTemplate<SearchSalaryItem>;
if (searchSalaryItems != null)
return searchSalaryItems;
#endregion
try
{
searchSalaryItems = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(searchSalaryItems, "Get");
#endregion
return searchSalaryItems;
}
public ID Save()
{
return SearchSalaryItem.Service.Save(this);
}
public void Delete()
{
SearchSalaryItem.Service.Delete(ID);
}
#endregion
}
#endregion
#region ISearchSalaryItem Service
public interface ISearchSalaryItemService
{
SearchSalaryItem Get(ID id);
ObjectsTemplate<SearchSalaryItem> Get();
ID Save(SearchSalaryItem item);
void Delete(ID id);
}
#endregion
}