202 lines
4.7 KiB
C#
202 lines
4.7 KiB
C#
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 BonusAdjustItem
|
|
|
|
[Serializable]
|
|
public class BonusAdjustItem : BasicBaseObject
|
|
{
|
|
#region Cache Store
|
|
|
|
private static Cache _cache = new Cache(typeof(BonusAdjustItem));
|
|
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
#region Input validator
|
|
public string[] InputValidator()
|
|
{
|
|
string[] sErrorString = new string[2];
|
|
if (this.Code == "")
|
|
{
|
|
sErrorString[0] = "Code can not be empty";
|
|
sErrorString[1] = "Code";
|
|
return sErrorString;
|
|
}
|
|
if (this.Name == "")
|
|
{
|
|
sErrorString[0] = "Description can not be empty";
|
|
sErrorString[1] = "Description";
|
|
return sErrorString;
|
|
}
|
|
|
|
sErrorString = null;
|
|
return sErrorString;
|
|
}
|
|
#endregion
|
|
|
|
public BonusAdjustItem()
|
|
{
|
|
_code = string.Empty;
|
|
_name = string.Empty;
|
|
_side = EnumSide.Deduct;
|
|
_amount = 0;
|
|
_status = EnumStatus.Active;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region code : string
|
|
|
|
private string _code;
|
|
public string Code
|
|
{
|
|
get { return _code; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<string>("code", _code, value);
|
|
_code = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region name : string
|
|
|
|
private string _name;
|
|
public string Name
|
|
{
|
|
get { return _name; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<string>("name", _name, value);
|
|
_name = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Side : EnumSide
|
|
|
|
private EnumSide _side;
|
|
public EnumSide Side
|
|
{
|
|
get { return _side; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<short>("Side", (short)_side, (short)value);
|
|
_side = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Amount : Double
|
|
|
|
private double _amount;
|
|
public double Amount
|
|
{
|
|
get { return _amount; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<double>("Amount", _amount, value);
|
|
_amount = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Service Factory IBonusAdjustItemService : IBonusAdjustItemService
|
|
|
|
internal static IBonusAdjustItemService Service
|
|
{
|
|
get { return Services.Factory.CreateService<IBonusAdjustItemService>(typeof(IBonusAdjustItemService)); }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Functions
|
|
|
|
public static BonusAdjustItem Get(ID nID)
|
|
{
|
|
BonusAdjustItem oBonusAdjustItem = null;
|
|
#region Cache Header
|
|
oBonusAdjustItem = (BonusAdjustItem)_cache["Get", nID];
|
|
if (oBonusAdjustItem != null)
|
|
return oBonusAdjustItem;
|
|
#endregion
|
|
oBonusAdjustItem = BonusAdjustItem.Service.Get(nID);
|
|
#region Cache Footer
|
|
_cache.Add(oBonusAdjustItem, "Get", nID);
|
|
#endregion
|
|
return oBonusAdjustItem;
|
|
}
|
|
|
|
public static ObjectsTemplate<BonusAdjustItem> Get(EnumStatus status)
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<BonusAdjustItem> bonusAdjustItems = _cache["Get",status] as ObjectsTemplate<BonusAdjustItem>;
|
|
if (bonusAdjustItems != null)
|
|
return bonusAdjustItems;
|
|
|
|
#endregion
|
|
|
|
try
|
|
{
|
|
bonusAdjustItems = Service.Get(status);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(bonusAdjustItems, "Get",status);
|
|
|
|
#endregion
|
|
|
|
return bonusAdjustItems;
|
|
}
|
|
|
|
public ID Save()
|
|
{
|
|
this.SetAuditTrailProperties();
|
|
return BonusAdjustItem.Service.Save(this);
|
|
}
|
|
public void Delete(ID ID)
|
|
{
|
|
BonusAdjustItem.Service.Delete(ID);
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region IBonusAdjustItem Service
|
|
|
|
public interface IBonusAdjustItemService
|
|
{
|
|
BonusAdjustItem Get(ID id);
|
|
ObjectsTemplate<BonusAdjustItem> Get(EnumStatus status);
|
|
ID Save(BonusAdjustItem item);
|
|
void Delete(ID id);
|
|
}
|
|
|
|
#endregion
|
|
}
|