EchoTex_Payroll/HRM.BO/Attendance/Shift.cs

502 lines
13 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.Core;
using System.Data;
namespace HRM.BO
{
public delegate void ListChanged();
#region Shift
[Serializable]
public class Shift : BasicBaseObject
{
#region Constructor
public Shift()
{
_code = string.Empty;
_name = string.Empty;
_inTime = DateTime.MinValue;
_outTime = DateTime.MinValue;
_absentTime = DateTime.MinValue;
_lateCalcualtion = 0;
_delayCalcualtion = 0;
_earlyExitBefore = 0;
_minimumOTHour = 0;
_hasAbsentTime = false;
_isOverlapingDay = false;
_shortName = string.Empty;
_shiftType = EnumWorkPlanGroup.Fixed;
HasBenefits = false;
HasExtraHourAllowance = false;
_extraHourAllowanceFromTime = DateTime.MinValue;
HasNightAllowance = false;
HasHolidayAllowance = false;
HasOtherAllowance = false;
HasRegularOverTime = false;
HasHolidayOverTime = false;
}
#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 WorkHour : double
public double WorkHour { get; set; }
#endregion
#region FlexibleHour : double
public double FlexibleHour { get; set; }
#endregion
#region MinimumInGraceTime : double
public double MinimumInGraceTime { get; set; }
#endregion
#region MinimumOutGraceTime : double
public double MinimumOutGraceTime { get; set; }
#endregion
#region InTime : DateTime
private DateTime _inTime;
public DateTime InTime
{
get { return _inTime; }
set
{
//base.OnPropertyChange<DateTime>("InTime", _inTime, value);
_inTime = value;
}
}
public int HalfdayBarrierHour
{
get { return 4; }
}
#endregion
public int payrollTypeID { get; set; }
#region outTime : DateTime
private DateTime _outTime;
public DateTime OutTime
{
get { return _outTime; }
set
{
//base.OnPropertyChange<DateTime>("outTime", _outTime, value);
_outTime = value;
}
}
#endregion
#region hasAbsentTime : bool
private bool _hasAbsentTime;
public bool hasAbsentTime
{
get { return _hasAbsentTime; }
set
{
//base.OnPropertyChange<bool>("hasAbsentTime", _hasAbsentTime, value);
_hasAbsentTime = value;
}
}
#endregion
#region isCounterClock : bool
private bool _isCounterClock;
public bool IsCounterClock
{
get { return _isCounterClock; }
set { _isCounterClock = value; }
}
#endregion
#region Location : EnumLocation
private EnumLocation _location;
public EnumLocation Location
{
get { return _location; }
set { _location = value; }
}
#endregion
public double LunchHour { get; set; }
public double MinimumInOTHour { get; set; }
public double MinimumOutOTHour { get; set; }
#region AbsentTime : DateTime
private DateTime _absentTime;
public DateTime AbsentTime
{
get { return _absentTime; }
set
{
//base.OnPropertyChange<DateTime>("absentTime", _absentTime, value);
_absentTime = value;
}
}
#endregion
#region lateCalcualtion : double
private double _lateCalcualtion;
public double LateCalcualtion
{
get { return _lateCalcualtion; }
set
{
//base.OnPropertyChange<double>("lateCalcualtion", _lateCalcualtion, value);
_lateCalcualtion = value;
}
}
#endregion
#region DelayCalcualtion : double
private double _delayCalcualtion;
public double DelayCalcualtion
{
get { return _delayCalcualtion; }
set
{
//base.OnPropertyChange<double>("delayCalcualtion", _delayCalcualtion, value);
_delayCalcualtion = value;
}
}
#endregion
#region earlyExitBefore : double
private double _earlyExitBefore;
public double EarlyExitBefore
{
get { return _earlyExitBefore; }
set
{
//base.OnPropertyChange<double>("EarlyExitBefore", _earlyExitBefore, value);
_earlyExitBefore = value;
}
}
#endregion
#region Minimum OTHour : double
private double _minimumOTHour;
public double MinimumOTHour
{
get { return _minimumOTHour; }
set
{
//base.OnPropertyChange<double>("MinimumOTHour", _minimumOTHour, value);
_minimumOTHour = value;
}
}
#endregion
#region isOverlapingDay : bool
private bool _isOverlapingDay;
public bool IsOverlapingDay
{
get { return _isOverlapingDay; }
set
{
//base.OnPropertyChange<bool>("isOverlapingDay", _isOverlapingDay, value);
_isOverlapingDay = value;
}
}
#endregion
#region ShiftType : EnumWorkPlanGroup
private EnumWorkPlanGroup _shiftType;
public EnumWorkPlanGroup ShiftType
{
get { return _shiftType; }
set
{
//base.OnPropertyChange<EnumWorkPlanDayType>("ShiftType", _shiftType, value);
_shiftType = value;
}
}
#endregion
#region ShortName : string
private string _shortName;
public string ShortName
{
get { return _shortName; }
set
{
//base.OnPropertyChange<string>("ShortName", _shortName, value);
_shortName = value;
}
}
#endregion
public bool HasBenefits { get; set; }
public bool HasExtraHourAllowance { get; set; }
#region ExtraHourAllowanceFromTime : DateTime
private DateTime _extraHourAllowanceFromTime;
public DateTime ExtraHourAllowanceFromTime
{
get { return _extraHourAllowanceFromTime; }
set { _extraHourAllowanceFromTime = value; }
}
#endregion
public bool HasNightAllowance { get; set; }
public bool HasHolidayAllowance { get; set; }
public bool HasOtherAllowance { get; set; }
public bool HasRegularOverTime { get; set; }
public bool HasHolidayOverTime { get; set; }
public int? ExtraHourAllowanceID { get; set; }
public int? NightAllowanceID { get; set; }
public int? HolidayAllowanceID { get; set; }
public int? OtherAllowanceID { get; set; }
public int? RegularOverTimeAllowanceID { get; set; }
public int? HolidayOverTimeAllowanceID { get; set; }
public bool HasTiffinAllowance { get; set; }
public bool HasSpecialAllowance { get; set; }
public int? TiffinAllowanceID { get; set; }
public int? SpecialAllowanceID { get; set; }
//#region Service Factory IShiftService : IShiftService
//internal static IShiftService Service
//{
// get { return Services.Factory.CreateService<IShiftService>(typeof(IShiftService)); }
//}
//#endregion
#endregion
//#region Functions
//public static Shift Get(ID nID)
//{
// Shift oShift = null;
// #region Cache Header
// oShift = (Shift)_cache["Get", nID];
// if (oShift != null)
// return oShift;
// #endregion
// oShift = Shift.Service.Get(nID);
// #region Cache Footer
// _cache.Add(oShift, "Get", nID);
// #endregion
// return oShift;
//}
//public static Shift Get(string shiftName)
//{
// Shift oShift = null;
// #region Cache Header
// oShift = (Shift)_cache["Get", shiftName];
// if (oShift != null)
// return oShift;
// #endregion
// oShift = Shift.Service.Get(shiftName);
// #region Cache Footer
// _cache.Add(oShift, "Get", shiftName);
// #endregion
// return oShift;
//}
//public static ObjectsTemplate<Shift> Get()
//{
// #region Cache Header
// ObjectsTemplate<Shift> shifts = _cache["Get"] as ObjectsTemplate<Shift>;
// if (shifts != null)
// return shifts;
// #endregion
// try
// {
// shifts = Service.Get();
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(shifts, "Get");
// #endregion
// return shifts;
//}
//public static ObjectsTemplate<Shift> Get(bool isCounterClock)
//{
// #region Cache Header
// ObjectsTemplate<Shift> shifts = _cache["Get", isCounterClock] as ObjectsTemplate<Shift>;
// if (shifts != null)
// return shifts;
// #endregion
// try
// {
// shifts = Service.Get(isCounterClock);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(shifts, "Get", isCounterClock);
// #endregion
// return shifts;
//}
//public static ObjectsTemplate<Shift> LoaData(DataTable dtShifts)
//{
// ObjectsTemplate<Shift> _oShifts = new ObjectsTemplate<Shift>();
// Shift oShift = null;
// if (dtShifts != null && dtShifts.Rows.Count > 0)
// {
// foreach (DataRow drItem in dtShifts.Rows)
// {
// oShift = new Shift();
// oShift.SetID(Ease.CoreV35.Model.ID.FromInteger(Convert.ToInt32(drItem["ShiftID"])));
// oShift.Code = drItem["Code"].ToString();
// oShift.Name = drItem["Name"].ToString();
// oShift.InTime = Convert.ToDateTime(drItem["INTIME"]);
// oShift.OutTime = Convert.ToDateTime(drItem["OutTime"]);
// oShift.IsOverlapingDay = Convert.ToBoolean(drItem["IsOverlapingDay"]); ;
// _oShifts.Add(oShift);
// }
// }
// return _oShifts;
//}
//public ID Save()
//{
// this.SetAuditTrailProperties();
// return Shift.Service.Save(this);
//}
//public bool IsExist(string shiftCode, string shortName, int shiftID)
//{
// return Shift.Service.IsExist(shiftCode, shortName, shiftID);
//}
//public void Delete()
//{
// Shift.Service.Delete(ID);
//}
//#endregion
}
#endregion
#region IShift Service
public interface IShiftService
{
Shift Get(int id);
Shift Get(string shiftName);
List<Shift> Get(string code, string name, EnumStatus status, int payrolltypeid);
List<Shift> Get(bool isCounterClock);
int Save(Shift item);
void Delete(int id);
bool IsExist(string shiftCode, string shortName, int shiftID);
List<Shift> GetAllShiftByPayrollType(int payrollTypeid);
}
#endregion
}