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("type", (short)_type, (short)value); _type = value; } } #endregion #region description : string private string _description; public string Description { get { return _description; } set { //base.OnPropertyChange("description", _description, value); _description = value; } } #endregion #region holidayDate : DateTime private DateTime _holidayDate; public DateTime HolidayDate { get { return _holidayDate; } set { //base.OnPropertyChange("holidayDate", _holidayDate, value); _holidayDate = value; } } #endregion #region LocationID : ID private int? _locationID; public int? LocationID { get { return _locationID; } set { //base.OnPropertyChange("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(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 Get() //{ // #region Cache Header // ObjectsTemplate holidayCalendars = _cache["Get"] as ObjectsTemplate; // 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 GetHoliDays(int nLocID = 0) //{ // #region Cache Header // ObjectsTemplate holidayCalendars = _cache["GetHoliDayByLocation", nLocID] as ObjectsTemplate; // 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 GetWeeklyHoliDay() //{ // #region Cache Header // ObjectsTemplate holidayCalendars = _cache["GetWeeklyHoliDay"] as ObjectsTemplate; // 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 GetHoliDayByLocation(ID nLocID) //{ // #region Cache Header // ObjectsTemplate holidayCalendars = _cache["GetHoliDayByLocation", nLocID] as ObjectsTemplate; // 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 GetWeeklyAndLocHoliday(ID nLocID) //{ // #region Cache Header // ObjectsTemplate holidayCalendars = _cache["GetWeeklyAndLocHoliday", nLocID] as ObjectsTemplate; // 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 GetbyMonthRange(int nLocationID, DateTime dStartDate, DateTime dEndDate) //{ // return HolidayCalendar.Service.GetbyMonthRange(nLocationID, dStartDate, dEndDate); //} //public static ObjectsTemplate GetbyDateRange(DateTime dStartDate, DateTime dEndDate) //{ // return HolidayCalendar.Service.GetbyDateRange(dStartDate, dEndDate); //} //public static ObjectsTemplate GetNationalHolidays() //{ // ObjectsTemplate holidayCalendars = new ObjectsTemplate(); // 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 GetHoliDays(int nLocID); List GetNationalHolidays(); HolidayCalendar Get(int id); int GetTotalMonthlyHolidays(int loactionNumber, DateTime firstDateOfMonth, DateTime lastDateOfMonth); List Get(); List GetWeeklyHoliDay(); List GetHoliDayByLocation(int nLocID); List GetWeeklyAndLocHoliday(int nLocID); double GetNoofHoliday(); int Save(HolidayCalendar item); void Delete(int id); void DeleteAll(); void DeleteAll(int nYear); List GetbyMonthRange(int nLocationID, DateTime dStartDate, DateTime dEndDate); List GetbyDateRange(DateTime dStartDate, DateTime dEndDate); void Process(int payrollTypeID); } #endregion }