CEL_Payroll/Payroll.BO/Basic/MonthlyWorkingHour.cs

215 lines
5.2 KiB
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.Linq;
using Ease.CoreV35.Caching;
using Ease.CoreV35.Model;
using Ease.CoreV35;
using System.Text;
namespace Payroll.BO
{
[Serializable]
public class MonthlyWorkingHour:BasicBaseObject
{
#region Cache Store
private static Cache _cache = new Cache(typeof(MonthlyWorkingHour));
#endregion
#region ctor(s)
#endregion
#region Propertise
#region WorkingMonth:DateTime
private DateTime _workingMonth;
public DateTime WorkingMonth
{
get { return _workingMonth; }
set
{
base.OnPropertyChange<DateTime>("WorkingMonth", _workingMonth, value);
_workingMonth = value;
}
}
#endregion
#region EmployeeID:ID
private ID _employeeID;
public ID EmployeeID
{
get { return _employeeID; }
set
{
base.OnPropertyChange<ID>("EmployeeID", _employeeID, value);
_employeeID = value;
}
}
#endregion
#region Regular Hour: double
private double _regularHour;
public double RegularHour
{
get { return _regularHour; }
set
{
base.OnPropertyChange<double>("RegularHour", _regularHour, value);
_regularHour = value;
}
}
#endregion
#region Special Hour:double
private double _specialHour;
public double SpecialHour
{
get { return _specialHour; }
set
{
base.OnPropertyChange<double>("SpecialHour", _specialHour, value);
_specialHour = value;
}
}
#endregion
#endregion
#region Functions
public ID Save()
{
this.SetAuditTrailProperties();
return MonthlyWorkingHour.Service.Save(this);
}
public void Save(ObjectsTemplate<MonthlyWorkingHour> items)
{
MonthlyWorkingHour.Service.Save(items);
}
void Delete(ID id)
{
MonthlyWorkingHour.Service.Delete(id);
}
public static ObjectsTemplate<MonthlyWorkingHour> Get()
{
#region Cache Header
ObjectsTemplate<MonthlyWorkingHour> monthlyWorkingHours = _cache["Get"] as ObjectsTemplate<MonthlyWorkingHour>;
if (monthlyWorkingHours != null)
return monthlyWorkingHours;
#endregion
try
{
monthlyWorkingHours = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(monthlyWorkingHours, "Get");
#endregion
return monthlyWorkingHours;
}
public static ObjectsTemplate<MonthlyWorkingHour> Get(DateTime date)
{
#region Cache Header
ObjectsTemplate<MonthlyWorkingHour> monthlyWorkingHours=_cache["Get"] as ObjectsTemplate<MonthlyWorkingHour>;
#endregion
try
{
monthlyWorkingHours = Service.Get(date);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(monthlyWorkingHours, "Get");
#endregion
return monthlyWorkingHours;
}
public static MonthlyWorkingHour Get(ID nID)
{
MonthlyWorkingHour oMonthlyWorkingHour = null;
#region Cache Header
oMonthlyWorkingHour = (MonthlyWorkingHour)_cache["Get", nID];
if (oMonthlyWorkingHour != null)
return oMonthlyWorkingHour;
#endregion
oMonthlyWorkingHour = MonthlyWorkingHour.Service.Get(nID);
#region Cache Footer
_cache.Add(oMonthlyWorkingHour, "Get", nID);
#endregion
return oMonthlyWorkingHour;
}
public bool IsExist(MonthlyWorkingHour monthlyWorkingHour)
{
try
{
return Service.IsExist(monthlyWorkingHour);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
}
#region Service Factory IMonthlyWorkingHourService: IMonthlyWorkingHourService
internal static IMonthlyWorkingHourService Service
{
get { return Services.Factory.CreateService<IMonthlyWorkingHourService>(typeof(IMonthlyWorkingHourService)); }
}
#endregion
#endregion
}
#region IMonthlyWorkingHour Service
public interface IMonthlyWorkingHourService
{
ID Save(MonthlyWorkingHour item);
void Delete(ID id);
MonthlyWorkingHour Get(ID id);
ObjectsTemplate<MonthlyWorkingHour> Get();
ObjectsTemplate<MonthlyWorkingHour> Get(DateTime date);
bool IsExist(MonthlyWorkingHour monthlyWorkingHour);
void Save(ObjectsTemplate<MonthlyWorkingHour> items);
}
#endregion
}