CEL_Payroll/Payroll.BO/Basic/FestivalBonusProjection.cs

179 lines
4.8 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 FestivalBonusProjection
[Serializable]
public class FestivalBonusProjection : BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(FestivalBonusProjection));
#endregion
#region Constructor
#region Input validator
public string[] InputValidator()
{
string[] sErrorString = new string[1];
if (this.NoofBasic == 0)
{
sErrorString[0] = "No of basic can not be zero";
sErrorString[1] = "Noo basic";
return sErrorString;
}
sErrorString = null;
return sErrorString;
}
#endregion
public FestivalBonusProjection()
{
_basicmonth = EnumMonths.January;
_noofbasic = 0.0;
}
#endregion
#region Properties
#region basicmonth : date
private EnumMonths _basicmonth;
public EnumMonths BasicMonth
{
get { return _basicmonth; }
set
{
_basicmonth = value;
}
}
#endregion
#region noofbasic : double
private double _noofbasic;
public double NoofBasic
{
get { return _noofbasic; }
set
{
base.OnPropertyChange<double>("noofbasic", _noofbasic, value);
_noofbasic = value;
}
}
#endregion
#region Service Factory IFestivalBonusProjectionService : IFestivalBonusProjectionService
internal static IFestivalBonusProjectionService Service
{
get { return Services.Factory.CreateService<IFestivalBonusProjectionService>(typeof(IFestivalBonusProjectionService)); }
}
#endregion
#endregion
#region Functions
public static FestivalBonusProjection Get(ID nID)
{
FestivalBonusProjection oFestivalBonusProjection = null;
#region Cache Header
oFestivalBonusProjection = (FestivalBonusProjection)_cache["Get", nID];
if (oFestivalBonusProjection != null)
return oFestivalBonusProjection;
#endregion
oFestivalBonusProjection = FestivalBonusProjection.Service.Get(nID);
#region Cache Footer
_cache.Add(oFestivalBonusProjection, "Get", nID);
#endregion
return oFestivalBonusProjection;
}
public static FestivalBonusProjection Get(EnumMonths dBasicMonth)
{
FestivalBonusProjection oFestivalBonusProjection = null;
#region Cache Header
oFestivalBonusProjection = (FestivalBonusProjection)_cache["Get", dBasicMonth];
if (oFestivalBonusProjection != null)
return oFestivalBonusProjection;
#endregion
oFestivalBonusProjection = FestivalBonusProjection.Service.Get(dBasicMonth);
#region Cache Footer
_cache.Add(oFestivalBonusProjection, "Get", dBasicMonth);
#endregion
return oFestivalBonusProjection;
}
public static ObjectsTemplate<FestivalBonusProjection> Get(EnumStatus status)
{
#region Cache Header
ObjectsTemplate<FestivalBonusProjection> FestivalBonusProjections = _cache["Get", status] as ObjectsTemplate<FestivalBonusProjection>;
if (FestivalBonusProjections != null)
return FestivalBonusProjections;
#endregion
try
{
FestivalBonusProjections = Service.Get(status);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(FestivalBonusProjections, "Get", status);
#endregion
return FestivalBonusProjections;
}
public ID Save()
{
this.SetAuditTrailProperties();
return FestivalBonusProjection.Service.Save(this);
}
public void Delete(ID id)
{
FestivalBonusProjection.Service.Delete(id);
}
#endregion
}
#endregion
#region IFestivalBonusProjection Service
public interface IFestivalBonusProjectionService
{
FestivalBonusProjection Get(ID id);
ObjectsTemplate<FestivalBonusProjection> Get(EnumStatus status);
ID Save(FestivalBonusProjection item);
void Delete(ID id);
FestivalBonusProjection Get(EnumMonths dBasicMonth);
}
#endregion
}