EchoTex_Payroll/HRM.BO/Attendance/HolidayCalendar.cs
2024-10-14 10:01:49 +06:00

326 lines
10 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.Core;
namespace HRM.BO
{
#region HolidayCalendar
[Serializable]
public class HolidayCalendar : AuditTrailBase
{
#region Constructor
public HolidayCalendar()
{
_type = 0;
_description = string.Empty;
_holidayDate = DateTime.MinValue;
_locationID = 0;
}
#endregion
#region Properties
#region type : EnumHolidayType
private EnumHolidayType _type;
public EnumHolidayType Type
{
get { return _type; }
set
{
//base.OnPropertyChange<short>("type", (short)_type, (short)value);
_type = value;
}
}
#endregion
#region description : string
private string _description;
public string Description
{
get { return _description; }
set
{
//base.OnPropertyChange<string>("description", _description, value);
_description = value;
}
}
#endregion
#region holidayDate : DateTime
private DateTime _holidayDate;
public DateTime HolidayDate
{
get { return _holidayDate; }
set
{
//base.OnPropertyChange<DateTime>("holidayDate", _holidayDate, value);
_holidayDate = value;
}
}
#endregion
#region LocationID : ID
private int? _locationID;
public int? LocationID
{
get { return _locationID; }
set
{
//base.OnPropertyChange<ID>("locationID", _locationID, value);
_locationID = value;
}
}
#endregion
#region WeeklyHolidayType : int
private int weeklyHolidayType;
public int WeeklyHolidayType
{
get { return weeklyHolidayType; }
set { weeklyHolidayType = value; }
}
#endregion
//#region Service Factory IHolidayCalendarService : IHolidayCalendarService
//internal static IHolidayCalendarService Service
//{
// get { return Services.Factory.CreateService<IHolidayCalendarService>(typeof(IHolidayCalendarService)); }
//}
//#endregion
#endregion
//#region Functions
//public static HolidayCalendar Get(ID nID)
//{
// HolidayCalendar oHolidayCalendar = null;
// #region Cache Header
// oHolidayCalendar = (HolidayCalendar)_cache["Get", nID];
// if (oHolidayCalendar != null)
// return oHolidayCalendar;
// #endregion
// oHolidayCalendar = HolidayCalendar.Service.Get(nID);
// #region Cache Footer
// _cache.Add(oHolidayCalendar, "Get", nID);
// #endregion
// return oHolidayCalendar;
//}
//public static int GetTotalMonthlyHolidays(int loactionNumber, DateTime firstDateOfMonth, DateTime lastDateOfMonth)
//{
// int totalMonthlyHoliDays = 0;
// try
// {
// totalMonthlyHoliDays = Service.GetTotalMonthlyHolidays(loactionNumber, firstDateOfMonth, lastDateOfMonth);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// return totalMonthlyHoliDays;
//}
//public static ObjectsTemplate<HolidayCalendar> Get()
//{
// #region Cache Header
// ObjectsTemplate<HolidayCalendar> holidayCalendars = _cache["Get"] as ObjectsTemplate<HolidayCalendar>;
// if (holidayCalendars != null)
// return holidayCalendars;
// #endregion
// try
// {
// holidayCalendars = Service.Get();
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(holidayCalendars, "Get");
// #endregion
// return holidayCalendars;
//}
//public static ObjectsTemplate<HolidayCalendar> GetHoliDays(int nLocID = 0)
//{
// #region Cache Header
// ObjectsTemplate<HolidayCalendar> holidayCalendars = _cache["GetHoliDayByLocation", nLocID] as ObjectsTemplate<HolidayCalendar>;
// if (holidayCalendars != null)
// return holidayCalendars;
// #endregion
// try
// {
// holidayCalendars = Service.GetHoliDays(nLocID);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(holidayCalendars, "GetHoliDayByLocation", nLocID);
// #endregion
// return holidayCalendars;
//}
//public static ObjectsTemplate<HolidayCalendar> GetWeeklyHoliDay()
//{
// #region Cache Header
// ObjectsTemplate<HolidayCalendar> holidayCalendars = _cache["GetWeeklyHoliDay"] as ObjectsTemplate<HolidayCalendar>;
// if (holidayCalendars != null)
// return holidayCalendars;
// #endregion
// try
// {
// holidayCalendars = Service.GetWeeklyHoliDay();
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(holidayCalendars, "GetWeeklyHoliDay");
// #endregion
// return holidayCalendars;
//}
//public static ObjectsTemplate<HolidayCalendar> GetHoliDayByLocation(ID nLocID)
//{
// #region Cache Header
// ObjectsTemplate<HolidayCalendar> holidayCalendars = _cache["GetHoliDayByLocation", nLocID] as ObjectsTemplate<HolidayCalendar>;
// if (holidayCalendars != null)
// return holidayCalendars;
// #endregion
// try
// {
// holidayCalendars = Service.GetHoliDayByLocation(nLocID);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(holidayCalendars, "GetHoliDayByLocation", nLocID);
// #endregion
// return holidayCalendars;
//}
//public static ObjectsTemplate<HolidayCalendar> GetWeeklyAndLocHoliday(ID nLocID)
//{
// #region Cache Header
// ObjectsTemplate<HolidayCalendar> holidayCalendars = _cache["GetWeeklyAndLocHoliday", nLocID] as ObjectsTemplate<HolidayCalendar>;
// if (holidayCalendars != null)
// return holidayCalendars;
// #endregion
// try
// {
// holidayCalendars = Service.GetWeeklyAndLocHoliday(nLocID);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(holidayCalendars, "GetWeeklyAndLocHoliday", nLocID);
// #endregion
// return holidayCalendars;
//}
//public static ObjectsTemplate<HolidayCalendar> GetbyMonthRange(int nLocationID, DateTime dStartDate, DateTime dEndDate)
//{
// return HolidayCalendar.Service.GetbyMonthRange(nLocationID, dStartDate, dEndDate);
//}
//public static ObjectsTemplate<HolidayCalendar> GetbyDateRange(DateTime dStartDate, DateTime dEndDate)
//{
// return HolidayCalendar.Service.GetbyDateRange(dStartDate, dEndDate);
//}
//public static ObjectsTemplate<HolidayCalendar> GetNationalHolidays()
//{
// ObjectsTemplate<HolidayCalendar> holidayCalendars = new ObjectsTemplate<HolidayCalendar>();
// try
// {
// holidayCalendars = Service.GetNationalHolidays();
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// return holidayCalendars;
//}
//public static double GetNoofHoliday()
//{
// return HolidayCalendar.Service.GetNoofHoliday();
//}
//public ID Save()
//{
// this.SetAuditTrailProperties();
// return HolidayCalendar.Service.Save(this);
//}
//public void Delete()
//{
// HolidayCalendar.Service.Delete(ID);
//}
//public void DeleteAll()
//{
// HolidayCalendar.Service.DeleteAll();
//}
//public void DeleteAll(int nYear)
//{
// HolidayCalendar.Service.DeleteAll(nYear);
//}
//#endregion
}
#endregion
#region IHolidayCalendar Service
public interface IHolidayCalendarService
{
List<HolidayCalendar> GetHoliDays(int nLocID);
List<HolidayCalendar> GetNationalHolidays();
HolidayCalendar Get(int id);
int GetTotalMonthlyHolidays(int loactionNumber, DateTime firstDateOfMonth, DateTime lastDateOfMonth);
List<HolidayCalendar> Get();
List<HolidayCalendar> GetWeeklyHoliDay();
List<HolidayCalendar> GetHoliDayByLocation(int nLocID);
List<HolidayCalendar> GetWeeklyAndLocHoliday(int nLocID);
double GetNoofHoliday();
int Save(HolidayCalendar item);
void Delete(int id);
void DeleteAll();
void DeleteAll(int nYear);
List<HolidayCalendar> GetbyMonthRange(int nLocationID, DateTime dStartDate, DateTime dEndDate);
List<HolidayCalendar> GetbyDateRange(DateTime dStartDate, DateTime dEndDate);
void Process(int payrollTypeID);
}
#endregion
}