963 lines
33 KiB
C#
963 lines
33 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Data;
|
|
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 Leave Entry
|
|
[Serializable]
|
|
public class LeaveEntry : AuditTrailBase, IworkflowInterface
|
|
{
|
|
#region Cache Store
|
|
private static Cache _cache = new Cache(typeof(LeaveEntry));
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public LeaveEntry()
|
|
{
|
|
_empID = 0;//
|
|
_appLeaveDate = DateTime.Now.Date;//
|
|
_appFromDate = DateTime.Now.Date;//
|
|
_appToDate = DateTime.Now.Date;//
|
|
|
|
_aprLeaveDate = DateTime.Now.Date;//
|
|
_aprFromDate = DateTime.Now.Date;//
|
|
_aprToDate = DateTime.Now.Date;//
|
|
|
|
_appTotalDays = 0;//
|
|
_aprTotalDays = 0;//
|
|
|
|
_approvedBy = null;//
|
|
_entryDate = DateTime.Now.Date;//
|
|
_isDrafted = 0;//
|
|
_isAvailed = 0;//
|
|
_leaveName = string.Empty;
|
|
_leaveStatus = EnumLeaveStatus.Drafted;//
|
|
|
|
_remarks = string.Empty;//
|
|
_ernLeaveRemarks = string.Empty;//
|
|
|
|
_leaveID = null; //
|
|
_leaveYear = 0;//
|
|
_appParamId = 0;//
|
|
_aprParamId = 0;//
|
|
|
|
_empGradeId = 0;//
|
|
_sbuID = null; //
|
|
_departmentID = null; //
|
|
_functionID = null;//
|
|
_locationID = null; //
|
|
_DesignationID = null;//
|
|
|
|
_availFromDate = DateTime.MinValue;
|
|
_availToDate = DateTime.MinValue;
|
|
_availRemarks = string.Empty;
|
|
_availTotalDays = 0.0;
|
|
|
|
_oLeave = null;
|
|
_availedBy = null;
|
|
// _oLeaveYear = null;
|
|
_systemType = EnumSystemType.Web;
|
|
_approvedDate = null;
|
|
|
|
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region Properties
|
|
#region Basic Properties
|
|
private EnumSystemType _systemType;
|
|
public EnumSystemType SystemType
|
|
{
|
|
get { return _systemType; }
|
|
set { _systemType = value; }
|
|
}
|
|
|
|
private int _empID;
|
|
public int EmpID
|
|
{
|
|
get { return _empID; }
|
|
set { _empID = value; }
|
|
}
|
|
private Employee _employee;
|
|
public Employee Employee
|
|
{
|
|
get
|
|
{
|
|
if (_employee == null && _empID != null)
|
|
{
|
|
//_employee = new Employee();
|
|
_employee = Employee.Get(ID.FromInteger(_empID));
|
|
}
|
|
return _employee;
|
|
}
|
|
set
|
|
{
|
|
_employee = value;
|
|
}
|
|
}
|
|
|
|
|
|
private int _empGradeId;
|
|
public int EmpGradeId
|
|
{
|
|
get { return _empGradeId; }
|
|
set { _empGradeId = value; }
|
|
}
|
|
|
|
private int _leaveYear;
|
|
public int LeaveYear
|
|
{
|
|
get { return _leaveYear; }
|
|
set { _leaveYear = value; }
|
|
}
|
|
|
|
private int _appParamId;
|
|
public int AppliedParamId
|
|
{
|
|
get { return _appParamId; }
|
|
set { _appParamId = value; }
|
|
}
|
|
|
|
private DateTime _appLeaveDate;
|
|
public DateTime AppliedLeaveDate
|
|
{
|
|
get { return _appLeaveDate; }
|
|
set { _appLeaveDate = value; }
|
|
}
|
|
|
|
private DateTime _appFromDate;
|
|
public DateTime AppliedFromDate
|
|
{
|
|
get { return _appFromDate; }
|
|
set { _appFromDate = value; }
|
|
}
|
|
|
|
private DateTime _appToDate;
|
|
public DateTime AppliedToDate
|
|
{
|
|
get { return _appToDate; }
|
|
set { _appToDate = value; }
|
|
}
|
|
|
|
private double _appTotalDays;
|
|
public double AppliedTotalDays
|
|
{
|
|
get { return _appTotalDays; }
|
|
set { _appTotalDays = value; }
|
|
}
|
|
|
|
private int _aprParamId;
|
|
public int ApprovedParamId
|
|
{
|
|
get { return _aprParamId; }
|
|
set
|
|
{
|
|
_aprParamId = value;
|
|
//lP = lP.Get(_aprParamId);
|
|
//leave = leave.Get(lP.LeaveId);
|
|
//LeaveName = leave.Description;
|
|
}
|
|
}
|
|
|
|
private DateTime _aprLeaveDate;
|
|
public DateTime ApprovedLeaveDate
|
|
{
|
|
get { return _aprLeaveDate; }
|
|
set { _aprLeaveDate = value; }
|
|
}
|
|
private DateTime? _approvedDate;
|
|
public DateTime? ApprovedDate
|
|
{
|
|
get { return _approvedDate; }
|
|
set { _approvedDate = value; }
|
|
}
|
|
|
|
private DateTime _aprFromDate;
|
|
public DateTime ApprovedFromDate
|
|
{
|
|
get
|
|
{
|
|
if (_availFromDate == DateTime.MinValue)
|
|
return _aprFromDate;
|
|
return _availFromDate;
|
|
}
|
|
set { _aprFromDate = value; }
|
|
}
|
|
|
|
private DateTime _aprToDate;
|
|
public DateTime ApprovedToDate
|
|
{
|
|
get
|
|
{
|
|
if (_availToDate == DateTime.MinValue)
|
|
return _aprToDate;
|
|
return _availToDate;
|
|
}
|
|
set { _aprToDate = value; }
|
|
}
|
|
|
|
private double _aprTotalDays;
|
|
public double ApprovedTotalDays
|
|
{
|
|
get
|
|
{
|
|
if (_availTotalDays == 0.0)
|
|
return _aprTotalDays;
|
|
else
|
|
return _availTotalDays;
|
|
|
|
}
|
|
set { _aprTotalDays = value; }
|
|
}
|
|
|
|
private ID _approvedBy;
|
|
public ID ApprovedBy
|
|
{
|
|
get { return _approvedBy; }
|
|
set { _approvedBy = value; }
|
|
}
|
|
|
|
private string _remarks;
|
|
public string Remarks
|
|
{
|
|
get
|
|
{
|
|
if (_availRemarks.Trim() == string.Empty)
|
|
return _remarks;
|
|
return _availRemarks;
|
|
}
|
|
set { _remarks = value; }
|
|
}
|
|
|
|
|
|
private DateTime _entryDate;
|
|
public DateTime EntryDate
|
|
{
|
|
get { return _entryDate; }
|
|
set { _entryDate = value; }
|
|
}
|
|
|
|
private int _isDrafted;
|
|
public int IsDrafted
|
|
{
|
|
get { return _isDrafted; }
|
|
set { _isDrafted = value; }
|
|
}
|
|
|
|
private int _isAvailed;
|
|
public int IsAvailed
|
|
{
|
|
get { return _isAvailed; }
|
|
set { _isAvailed = value; }
|
|
}
|
|
|
|
private int _leaveEntryType;
|
|
public int LeaveEntryType
|
|
{
|
|
get { return _leaveEntryType; }
|
|
set { _leaveEntryType = value; }
|
|
}
|
|
private DateTime? _WorkingDate=null;
|
|
public DateTime? WorkingDate
|
|
{
|
|
get { return _WorkingDate; }
|
|
set { _WorkingDate = value; }
|
|
}
|
|
private string _leaveName;
|
|
public string LeaveName
|
|
{
|
|
get
|
|
{
|
|
if (_leaveName == string.Empty)
|
|
{
|
|
if (Leave != null)
|
|
{
|
|
_leaveName = Leave.Description;
|
|
}
|
|
}
|
|
return _leaveName;
|
|
}
|
|
}
|
|
|
|
private EnumLeaveStatus _leaveStatus;
|
|
public EnumLeaveStatus LeaveStatus
|
|
{
|
|
get { return _leaveStatus; }
|
|
set
|
|
{
|
|
_leaveStatus = value;
|
|
switch (_leaveStatus)
|
|
{
|
|
case EnumLeaveStatus.Drafted:
|
|
_leaveStatusDescription = "Drafted";
|
|
break;
|
|
case EnumLeaveStatus.Approved:
|
|
_leaveStatusDescription = "Approved";
|
|
break;
|
|
case EnumLeaveStatus.Declined:
|
|
_leaveStatusDescription = "Declined";
|
|
break;
|
|
//case EnumLeaveStatus.Availed:
|
|
// _leaveStatusDescription = "Availed";
|
|
// break;
|
|
case EnumLeaveStatus.OnApproval:
|
|
_leaveStatusDescription = "Pending";
|
|
break;
|
|
case EnumLeaveStatus.Cancel_Request:
|
|
_leaveStatusDescription = "Requested for cancel";
|
|
break;
|
|
case EnumLeaveStatus.Cancel:
|
|
_leaveStatusDescription = "Cancelled";
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
private string _LeaveDayPeriod="";
|
|
public string LeaveDayPeriod
|
|
{
|
|
get { return _LeaveDayPeriod; }
|
|
set
|
|
{
|
|
_LeaveDayPeriod = value;
|
|
}
|
|
}
|
|
|
|
public int GetStatusbyWf(enumwfStatus wfstatus)
|
|
{
|
|
EnumLeaveStatus lvstatus;
|
|
switch (wfstatus)
|
|
{
|
|
case enumwfStatus.Exception:
|
|
case enumwfStatus.Received:
|
|
case enumwfStatus.Passed:
|
|
case enumwfStatus.Revert:
|
|
if (!this.SbuID.IsUnassigned)
|
|
{
|
|
lvstatus = EnumLeaveStatus.Cancel_Request;
|
|
}
|
|
else
|
|
{
|
|
lvstatus = EnumLeaveStatus.OnApproval;
|
|
}
|
|
break;
|
|
case enumwfStatus.Decline:
|
|
if (!this.SbuID.IsUnassigned)
|
|
{
|
|
lvstatus = EnumLeaveStatus.Approved;
|
|
}
|
|
else
|
|
{
|
|
lvstatus = EnumLeaveStatus.Declined;
|
|
}
|
|
break;
|
|
case enumwfStatus.Approve:
|
|
lvstatus = EnumLeaveStatus.Approved;
|
|
break;
|
|
case enumwfStatus.End:
|
|
if (!this.SbuID.IsUnassigned)
|
|
{
|
|
lvstatus = EnumLeaveStatus.Cancel;
|
|
}
|
|
else
|
|
{
|
|
lvstatus = EnumLeaveStatus.Approved;
|
|
}
|
|
break;
|
|
default:
|
|
lvstatus = EnumLeaveStatus.OnApproval;
|
|
break;
|
|
}
|
|
return (int)lvstatus;
|
|
}
|
|
|
|
private string _leaveStatusDescription;
|
|
public string LeaveStatusDescription
|
|
{
|
|
get { return _leaveStatusDescription; }
|
|
//set { _leaveStatusDescription = value; }
|
|
}
|
|
|
|
public string WFDesciption()
|
|
{
|
|
string sDescription;
|
|
|
|
sDescription = " " + this.Employee.Name + ", " + this.Employee.Designation.Name
|
|
+ " has applied for " + this.Leave.Description + " From " + this.AppliedFromDate.ToString("dd MMM yyyy")
|
|
+ " To " + this.AppliedToDate.ToString("dd MMM yyyy")
|
|
+ " Total " + this.ApprovedTotalDays.ToString()
|
|
+ " Reason " + this.Remarks;
|
|
return sDescription;
|
|
}
|
|
private string _ernLeaveRemarks;
|
|
public string ErnLeaveRemarks
|
|
{
|
|
get { return _ernLeaveRemarks; }
|
|
set { _ernLeaveRemarks = value; }
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region Transectional Properties
|
|
private ID _leaveID;
|
|
/// <summary>
|
|
/// Need not to be populated from UI. It is populated internally.
|
|
/// </summary>
|
|
public ID LeaveID
|
|
{
|
|
get { return _leaveID; }
|
|
set { _leaveID = value; }
|
|
}
|
|
|
|
private ID _sbuID;
|
|
/// <summary>
|
|
/// Need not to be populated from UI. It is populated internally.
|
|
/// </summary>
|
|
public ID SbuID
|
|
{
|
|
get { return _sbuID; }
|
|
set { _sbuID = value; }
|
|
}
|
|
|
|
private ID _departmentID;
|
|
/// <summary>
|
|
/// Need not to be populated from UI. It is populated internally.
|
|
/// </summary>
|
|
public ID DepartmentID
|
|
{
|
|
get { return _departmentID; }
|
|
set { _departmentID = value; }
|
|
}
|
|
|
|
private ID _functionID;
|
|
/// <summary>
|
|
/// Need not to be populated from UI. It is populated internally.
|
|
/// </summary>
|
|
public ID FunctionID
|
|
{
|
|
get { return _functionID; }
|
|
set { _functionID = value; }
|
|
}
|
|
|
|
private ID _locationID;
|
|
/// <summary>
|
|
/// Need not to be populated from UI. It is populated internally.
|
|
/// </summary>
|
|
public ID LocationID
|
|
{
|
|
get { return _locationID; }
|
|
set { _locationID = value; }
|
|
}
|
|
|
|
private ID _DesignationID;
|
|
/// <summary>
|
|
/// Need not to be populated from UI. It is populated internally.
|
|
/// </summary>
|
|
public ID DesignationID
|
|
{
|
|
get { return _DesignationID; }
|
|
set { _DesignationID = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Leave Properties for Avail
|
|
|
|
private DateTime _availFromDate;
|
|
public DateTime AvailFromDate
|
|
{
|
|
get { return _availFromDate; }
|
|
set { _availFromDate = value; }
|
|
}
|
|
|
|
private DateTime _availToDate;
|
|
public DateTime AvailToDate
|
|
{
|
|
get { return _availToDate; }
|
|
set { _availToDate = value; }
|
|
}
|
|
|
|
private string _availRemarks;
|
|
public string AvailRemarks
|
|
{
|
|
get { return _availRemarks; }
|
|
set { _availRemarks = value; }
|
|
}
|
|
private Leave _oLeave;
|
|
public Leave Leave
|
|
{
|
|
get
|
|
{
|
|
if (_oLeave == null && _leaveID.Integer != 0)
|
|
{
|
|
_oLeave = new Leave().Get(_leaveID);
|
|
}
|
|
return _oLeave;
|
|
}
|
|
}
|
|
//private LeaveYear _oLeaveYear;
|
|
//public LeaveYear leaveYear
|
|
//{
|
|
// get
|
|
// {
|
|
// if (_oLeaveYear == null && _leaveYear != 0)
|
|
// {
|
|
// _oLeaveYear = new LeaveYear().Get(
|
|
// }
|
|
// return _oLeaveYear;
|
|
// }
|
|
//}
|
|
private ID _availedBy;
|
|
public ID AvailedBy
|
|
{
|
|
get { return _availedBy; }
|
|
set { _availedBy = value; }
|
|
}
|
|
|
|
private double _availTotalDays;
|
|
public double AvailTotalDays
|
|
{
|
|
get { return _availTotalDays; }
|
|
set { _availTotalDays = value; }
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
public LeaveEntry Get(int tranID)
|
|
{
|
|
LeaveEntry oLeaveEntry = null;
|
|
#region Cache Header
|
|
oLeaveEntry = (LeaveEntry)_cache["Get", tranID];
|
|
if (oLeaveEntry != null)
|
|
{
|
|
return oLeaveEntry;
|
|
}
|
|
#endregion
|
|
oLeaveEntry = LeaveEntry.Service.Get(ID.FromInteger(tranID));
|
|
#region Cache Footer
|
|
_cache.Add(oLeaveEntry, "Get", tranID);
|
|
#endregion
|
|
return oLeaveEntry;
|
|
}
|
|
|
|
public LeaveEntry Get(ID tranID)
|
|
{
|
|
LeaveEntry oLeaveEntry = null;
|
|
#region Cache Header
|
|
oLeaveEntry = (LeaveEntry)_cache["Get", tranID];
|
|
if (oLeaveEntry != null)
|
|
{
|
|
return oLeaveEntry;
|
|
}
|
|
#endregion
|
|
oLeaveEntry = LeaveEntry.Service.Get(tranID);
|
|
#region Cache Footer
|
|
_cache.Add(oLeaveEntry, "Get", tranID);
|
|
#endregion
|
|
return oLeaveEntry;
|
|
}
|
|
public static DataTable GetYearEndData(int LeaveYear)
|
|
{
|
|
DataTable oDT = null;
|
|
oDT = LeaveEntry.Service.GetYearEndData(LeaveYear);
|
|
return oDT;
|
|
}
|
|
public static DataTable GetAvailedLeave(DateTime stDate, DateTime endDate, string empIds)
|
|
{
|
|
DataTable oDT = null;
|
|
oDT = LeaveEntry.Service.GetAvailedLeave(stDate, endDate, empIds);
|
|
return oDT;
|
|
}
|
|
public static DataTable GetTotalLeaveAmountInYear(int leaveYear, EnumLeaveStatus leaveStatus)
|
|
{
|
|
DataTable oDT = null;
|
|
oDT = LeaveEntry.Service.GetTotalLeaveAmountInYear(leaveYear, leaveStatus);
|
|
return oDT;
|
|
}
|
|
public static double GetLeaveAmtByType(int empId, int leaveId, int leaveYear, EnumLeaveStatus leaveStatus)
|
|
{
|
|
return LeaveEntry.Service.GetLeaveAmtByType(empId, leaveId, leaveYear, leaveStatus);
|
|
}
|
|
public static double GetAvailedLeave(int empId, int leaveId, int leaveYear, EnumLeaveStatus leaveStatus)
|
|
{
|
|
return LeaveEntry.Service.GetAvailedLeave(empId, leaveId, leaveYear, leaveStatus);
|
|
}
|
|
|
|
public static double GetAmountOnFromLeaveDate(int empId, int leaveYear, int leaveid,
|
|
EnumLeaveStatus leaveStatus, DateTime startdate, DateTime enddate)
|
|
{
|
|
return LeaveEntry.Service.GetAmountOnFromDate(empId, leaveYear, leaveid, leaveStatus, startdate, enddate);
|
|
}
|
|
public static double GetTotalLeaveAmountInYear(int empId, int leaveYear, int leaveid,
|
|
EnumLeaveStatus leaveStatus)
|
|
{
|
|
return LeaveEntry.Service.GetTotalLeaveAmountInYear(empId, leaveYear, leaveid, leaveStatus);
|
|
}
|
|
|
|
public ID Save()
|
|
{
|
|
this.SetAuditTrailProperties();
|
|
return LeaveEntry.Service.Save(this);
|
|
}
|
|
|
|
public bool IsExist(Employee oEmployee, DateTime fromDate, DateTime toDate)
|
|
{
|
|
return LeaveEntry.Service.IsExist(oEmployee, fromDate, toDate);
|
|
}
|
|
|
|
public void SaveLeaveEntry(LeaveEntry oLeaveEntry)
|
|
{
|
|
LeaveEntry.Service.SaveLeaveEntry(oLeaveEntry);
|
|
}
|
|
public void SaveLeaveEntry(ObjectsTemplate<LeaveEntry> oLeaveEntry)
|
|
{
|
|
LeaveEntry.Service.SaveLeaveEntry(oLeaveEntry);
|
|
}
|
|
public void Delete()
|
|
{
|
|
LeaveEntry.Service.Delete(ID);
|
|
}
|
|
|
|
public void Delete(int id)
|
|
{
|
|
LeaveEntry.Service.Delete(ID.FromInteger(id));
|
|
}
|
|
public void DeleteByLeaveYear(int nLeaveYear)
|
|
{
|
|
LeaveEntry.Service.DeleteByLeaveYear(nLeaveYear);
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region Collection of Leave Entry
|
|
|
|
#region Methods
|
|
public static ObjectsTemplate<LeaveEntry> Get(string empIds, int leaveYear, EnumLeaveStatus leaveStatus)
|
|
{
|
|
ObjectsTemplate<LeaveEntry> oLeaveEntrys = null;
|
|
#region Cache Header
|
|
oLeaveEntrys = (ObjectsTemplate<LeaveEntry>)_cache["Get", empIds, leaveYear] as ObjectsTemplate<LeaveEntry>;
|
|
if (oLeaveEntrys != null)
|
|
{
|
|
return oLeaveEntrys;
|
|
}
|
|
#endregion
|
|
oLeaveEntrys = LeaveEntry.Service.Get(empIds, leaveYear, leaveStatus);
|
|
#region Cache Footer
|
|
_cache.Add(oLeaveEntrys, "Get", empIds, leaveYear);
|
|
#endregion
|
|
return oLeaveEntrys;
|
|
}
|
|
public static ObjectsTemplate<LeaveEntry> GetPending(int empId, int nLeaveID, EnumLeaveStatus leaveStatus)
|
|
{
|
|
ObjectsTemplate<LeaveEntry> oLeaveEntrys = LeaveEntry.Service.GetPending(empId, nLeaveID, leaveStatus);
|
|
|
|
return oLeaveEntrys;
|
|
}
|
|
public static ObjectsTemplate<LeaveEntry> GetByLeaveYear(int nLeaveYear)
|
|
{
|
|
ObjectsTemplate<LeaveEntry> oLeaveEntrys = null;
|
|
#region Cache Header
|
|
oLeaveEntrys = (ObjectsTemplate<LeaveEntry>)_cache["Get"] as ObjectsTemplate<LeaveEntry>;
|
|
if (oLeaveEntrys != null)
|
|
{
|
|
return oLeaveEntrys;
|
|
}
|
|
#endregion
|
|
oLeaveEntrys = LeaveEntry.Service.GetByLeaveYear(nLeaveYear);
|
|
#region Cache Footer
|
|
_cache.Add(oLeaveEntrys, "Get");
|
|
#endregion
|
|
return oLeaveEntrys;
|
|
}
|
|
public static ObjectsTemplate<LeaveEntry> Get(DateTime fromDate, DateTime toDate, EnumLeaveStatus leaveStatus)
|
|
{
|
|
ObjectsTemplate<LeaveEntry> oLeaveEntrys = null;
|
|
oLeaveEntrys = LeaveEntry.Service.Get(fromDate, toDate, leaveStatus);
|
|
return oLeaveEntrys;
|
|
}
|
|
public static ObjectsTemplate<LeaveEntry> Get(DateTime AttnDate)
|
|
{
|
|
ObjectsTemplate<LeaveEntry> oLeaveEntrys = null;
|
|
oLeaveEntrys = LeaveEntry.Service.Get(AttnDate);
|
|
return oLeaveEntrys;
|
|
}
|
|
|
|
public static ObjectsTemplate<LeaveEntry> GetByLeaveID(int nLeaveID, int nEmpID, DateTime fromDate, DateTime toDate)
|
|
{
|
|
ObjectsTemplate<LeaveEntry> oLeaveEntrys = null;
|
|
oLeaveEntrys = LeaveEntry.Service.GetByLeaveID(nLeaveID, nEmpID, fromDate, toDate);
|
|
return oLeaveEntrys;
|
|
}
|
|
public static ObjectsTemplate<LeaveEntry> Get(string empIds, DateTime fromDate, DateTime toDate, EnumLeaveStatus leaveStatus)
|
|
{
|
|
ObjectsTemplate<LeaveEntry> oLeaveEntrys = null;
|
|
oLeaveEntrys = LeaveEntry.Service.Get(empIds, fromDate, toDate, leaveStatus);
|
|
return oLeaveEntrys;
|
|
}
|
|
public static ObjectsTemplate<LeaveEntry> Get(int empId, int leaveYearID)
|
|
{
|
|
ObjectsTemplate<LeaveEntry> oLeaveEntrys = null;
|
|
oLeaveEntrys = LeaveEntry.Service.Get(empId, leaveYearID);
|
|
return oLeaveEntrys;
|
|
}
|
|
public static ObjectsTemplate<LeaveEntry> Get(string empIds, DateTime fromDate, DateTime toDate, string leaveStatus)
|
|
{
|
|
ObjectsTemplate<LeaveEntry> oLeaveEntrys = null;
|
|
oLeaveEntrys = LeaveEntry.Service.Get(empIds, fromDate, toDate, leaveStatus);
|
|
return oLeaveEntrys;
|
|
}
|
|
public static ObjectsTemplate<LeaveEntry> Get(string empIds, DateTime fromDate, DateTime toDate, EnumLeaveStatus leaveStatus, string sortExpression)
|
|
{
|
|
ObjectsTemplate<LeaveEntry> oLeaveEntrys = null;
|
|
oLeaveEntrys = LeaveEntry.Service.Get(empIds, fromDate, toDate, leaveStatus, sortExpression);
|
|
return oLeaveEntrys;
|
|
}
|
|
public static ObjectsTemplate<LeaveEntry> GetForAdminPanel(ID employeeID)
|
|
{
|
|
ObjectsTemplate<LeaveEntry> oLeaveEntrys = null;
|
|
oLeaveEntrys = LeaveEntry.Service.GetForAdminPanel(employeeID);
|
|
return oLeaveEntrys;
|
|
}
|
|
public static ObjectsTemplate<LeaveEntry> getWithinCurrentYear(ID employeeID, EnumLeaveStatus leaveStatus)
|
|
{
|
|
DateTime fromDate, toDate;
|
|
fromDate = DateTime.Now.Date.Month <= 6 ? new DateTime(DateTime.Now.Date.Year - 1, 7, 1) : new DateTime(DateTime.Now.Date.Year, 7, 1);
|
|
toDate = new DateTime(fromDate.Year + 1, 6, 30);
|
|
return Get(employeeID.Integer.ToString(), fromDate, toDate, leaveStatus);
|
|
}
|
|
public static ObjectsTemplate<LeaveEntry> GetEmployeeWiseLeaveDetailReport(int empId, DateTime fromDate, DateTime toDate, int leaveType)
|
|
{
|
|
return LeaveEntry.Service.GetEmployeeWiseLeaveDetailReport(empId, fromDate, toDate, leaveType);
|
|
}
|
|
|
|
public static ObjectsTemplate<LeaveEntry> GetEmployeeWiseLeaveDetailReport(int empId, DateTime fromDate, DateTime toDate)
|
|
{
|
|
return LeaveEntry.Service.GetEmployeeWiseLeaveDetailReport(empId, fromDate, toDate);
|
|
}
|
|
|
|
public static ObjectsTemplate<LeaveEntry> GetEmployeeWiseLeaveDetailReport(string empIds, DateTime fromDate, DateTime toDate, int leaveType)
|
|
{
|
|
return LeaveEntry.Service.GetEmployeeWiseLeaveDetailReport(empIds, fromDate, toDate, leaveType);
|
|
}
|
|
|
|
public static ObjectsTemplate<LeaveEntry> GetEmployeeWiseLeaveDetailReport(string empIds, DateTime fromDate, DateTime toDate)
|
|
{
|
|
return LeaveEntry.Service.GetEmployeeWiseLeaveDetailReport(empIds, fromDate, toDate);
|
|
}
|
|
|
|
|
|
public static int GetEmployeeLeaveBalance(int empId, int leaveYear, int leaveType)
|
|
{
|
|
return LeaveEntry.Service.GetEmployeeLeaveBalance(empId, leaveYear, leaveType);
|
|
}
|
|
public static ObjectsTemplate<LeaveEntry> getWithinCurrentYear(ID employeeID, string leaveStatus, LeaveYear lYear)
|
|
{
|
|
DateTime fromDate, toDate;
|
|
fromDate = lYear.StartDate;
|
|
toDate = lYear.EndDate;
|
|
return Get(employeeID.Integer.ToString(), fromDate, toDate, leaveStatus);
|
|
}
|
|
public static ObjectsTemplate<LeaveEntry> getSortedWithinCurrentYear(ID employeeID, EnumLeaveStatus leaveStatus, string sortExpresion, LeaveYear lYear)
|
|
{
|
|
DateTime fromDate, toDate;
|
|
fromDate = lYear.StartDate;
|
|
toDate = lYear.EndDate;
|
|
return Get(employeeID.Integer.ToString(), fromDate, toDate, leaveStatus, sortExpresion);
|
|
}
|
|
public static ObjectsTemplate<LeaveEntry> getWithinCurrentYear(string employeeIDs, EnumLeaveStatus leaveStatus, LeaveYear lYear)
|
|
{
|
|
DateTime fromDate, toDate;
|
|
fromDate = lYear.StartDate;
|
|
toDate = lYear.EndDate;
|
|
return Get(employeeIDs, fromDate, toDate, leaveStatus);
|
|
}
|
|
public static DataSet GetLeaveReport(int empId, DateTime fromDate, DateTime toDate)
|
|
{
|
|
return LeaveEntry.Service.GetLeaveReport(empId, fromDate, toDate);
|
|
}
|
|
public static DataSet GetAvailedLeave(int empId, DateTime fromDate, DateTime toDate)
|
|
{
|
|
return LeaveEntry.Service.GetAvailedLeave(empId, fromDate, toDate);
|
|
}
|
|
public static DataSet GetReport(string query)
|
|
{
|
|
return LeaveEntry.Service.GetReport(query);
|
|
}
|
|
public static DataSet GetRecord(string empIds, DateTime fromDate, DateTime toDate, EnumLeaveStatus leaveStatus)
|
|
{
|
|
return LeaveEntry.Service.GetRecord(empIds, fromDate, toDate, leaveStatus);
|
|
}
|
|
#endregion
|
|
|
|
#region Service Factory
|
|
internal static ILeaveEntryService Service
|
|
{
|
|
get { return Services.Factory.CreateService<ILeaveEntryService>(typeof(ILeaveEntryService)); }
|
|
}
|
|
#endregion
|
|
|
|
#region IworkflowInterface Members
|
|
|
|
public string objectDescription
|
|
{
|
|
get
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
set
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
|
|
//public ID setupId
|
|
//{
|
|
// get
|
|
// {
|
|
// throw new NotImplementedException();
|
|
// }
|
|
// set
|
|
// {
|
|
// throw new NotImplementedException();
|
|
// }
|
|
//}
|
|
|
|
|
|
/// <summary>
|
|
/// this property is used for work flow, which return leave description
|
|
/// </summary>
|
|
public string ObjectDescription
|
|
{
|
|
get
|
|
{
|
|
string str = "";
|
|
if (this.LeaveStatus == EnumLeaveStatus.Cancel_Request)
|
|
{
|
|
str = " " + this.Employee.Name + ", " + this.Employee.DescriptionText
|
|
+ " has applied for cancel " + this.Leave.Description + " from " +
|
|
this.AppliedFromDate.ToString("dd MMM yyyy") + " to " +
|
|
this.AppliedToDate.ToString("dd MMM yyyy") + ". ";
|
|
}
|
|
else
|
|
{
|
|
if (this.Leave.IsHalfDayLeave && this.Leave.IsCompensatoryLeave)
|
|
{
|
|
str = " " + this.Employee.Name + ", " + this.Employee.DescriptionText
|
|
+ " has applied for " + this.Leave.Description + " from " +
|
|
this.AppliedFromDate.ToString("dd MMM yyyy") + " to " +
|
|
this.AppliedToDate.ToString("dd MMM yyyy") + " on " + this.LeaveDayPeriod.ToString() + ", Worked at holiday on " + Convert.ToDateTime(this.WorkingDate).ToString("dd MMM yyyy") + ". ";
|
|
}
|
|
else if (this.Leave.IsHalfDayLeave)
|
|
{
|
|
str = " " + this.Employee.Name + ", " + this.Employee.DescriptionText
|
|
+ " has applied for " + this.Leave.Description + " from " +
|
|
this.AppliedFromDate.ToString("dd MMM yyyy") + " to " +
|
|
this.AppliedToDate.ToString("dd MMM yyyy") + " on " + this.LeaveDayPeriod.ToString() + ". ";
|
|
}
|
|
else if (this.Leave.IsCompensatoryLeave)
|
|
{
|
|
str = " " + this.Employee.Name + ", " + this.Employee.DescriptionText
|
|
+ " has applied for " + this.Leave.Description + " from " +
|
|
this.AppliedFromDate.ToString("dd MMM yyyy") + " to " +
|
|
this.AppliedToDate.ToString("dd MMM yyyy") + ", Worked at holiday on " + Convert.ToDateTime(this.WorkingDate).ToString("dd MMM yyyy") + ". ";
|
|
}
|
|
else
|
|
{
|
|
str = " " + this.Employee.Name + ", " + this.Employee.DescriptionText
|
|
+ " has applied for " + this.Leave.Description + " from " +
|
|
this.AppliedFromDate.ToString("dd MMM yyyy") + " to " +
|
|
this.AppliedToDate.ToString("dd MMM yyyy") + ". ";
|
|
}
|
|
}
|
|
return str;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// this property is used for work flow, it's a constant value
|
|
/// </summary>
|
|
public ID SetupID
|
|
{
|
|
get
|
|
{
|
|
if (this.LeaveStatus == EnumLeaveStatus.Cancel_Request)
|
|
{
|
|
return ID.FromInteger(2);
|
|
}
|
|
else
|
|
{
|
|
return ID.FromInteger(1);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// this property is used for work flow, which return leave entry id
|
|
/// </summary>
|
|
public ID ObjectID
|
|
{
|
|
get { return this.ID; }
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region ILeaveEntry Service
|
|
public interface ILeaveEntryService
|
|
{
|
|
LeaveEntry Get(ID id);
|
|
void SaveLeaveEntry(LeaveEntry oLeaveEntry);
|
|
bool IsEntered(DateTime year);
|
|
ObjectsTemplate<LeaveEntry> GetEmployeeWiseLeaveDetailReport(int empId, DateTime fromDate, DateTime toDate, int leaveType);
|
|
ObjectsTemplate<LeaveEntry> GetEmployeeWiseLeaveDetailReport(string empIds, DateTime fromDate, DateTime toDate, int leaveType);
|
|
ObjectsTemplate<LeaveEntry> GetEmployeeWiseLeaveDetailReport(int empId, DateTime fromDate, DateTime toDate);
|
|
ObjectsTemplate<LeaveEntry> GetEmployeeWiseLeaveDetailReport(string empIds, DateTime fromDate, DateTime toDate);
|
|
ObjectsTemplate<LeaveEntry> GetByLeaveYear(int nLeaveYear);
|
|
ObjectsTemplate<LeaveEntry> Get(string EmpIds, int leaveYear, EnumLeaveStatus leaveStatus);
|
|
ObjectsTemplate<LeaveEntry> Get(DateTime fromDate, DateTime toDate, EnumLeaveStatus leaveStatus);
|
|
ObjectsTemplate<LeaveEntry> Get(DateTime attnDate);
|
|
ObjectsTemplate<LeaveEntry> Get(string empIds, DateTime fromDate, DateTime toDate, EnumLeaveStatus leaveStatus);
|
|
ObjectsTemplate<LeaveEntry> GetPending(int empId, int nLeaveID, EnumLeaveStatus leaveStatus);
|
|
ObjectsTemplate<LeaveEntry> Get(int empId, int leaveYearID);
|
|
ObjectsTemplate<LeaveEntry> GetByLeaveID(int nLeaveID, int nEmpID, DateTime fromDate, DateTime toDate);
|
|
int GetEmployeeLeaveBalance(int empId, int leaveYear, int leaveType);
|
|
ObjectsTemplate<LeaveEntry> Get(string empIds, DateTime fromDate, DateTime toDate, string leaveStatus);
|
|
ObjectsTemplate<LeaveEntry> Get(string empIds, DateTime fromDate, DateTime toDate, EnumLeaveStatus leaveStatus, string sortExpresion);
|
|
ObjectsTemplate<LeaveEntry> GetForAdminPanel(ID employeeID);
|
|
double GetLeaveAmtByType(int empId, int leaveId, int leaveYear, EnumLeaveStatus leaveStatus);
|
|
double GetAvailedLeave(int empId, int leaveId, int leaveYear, EnumLeaveStatus leaveStatus);
|
|
double GetAmountOnFromDate(int empId, int leaveYearId, int leaveID, EnumLeaveStatus leaveStatus, DateTime startdate, DateTime enddate);
|
|
double GetTotalLeaveAmountInYear(int empId, int leaveYearId, int leaveID, EnumLeaveStatus leaveStatus);
|
|
|
|
ID Save(LeaveEntry oLeaveEntry);
|
|
void Delete(ID id);
|
|
void DeleteByLeaveYear(int nLeaveYear);
|
|
DataTable GetYearEndData(int leaveYear);
|
|
DataTable GetAvailedLeave(DateTime stDate, DateTime endDate, string empIds);
|
|
DataSet GetLeaveReport(int empId, DateTime fromDate, DateTime toDate);
|
|
DataSet GetAvailedLeave(int empId, DateTime fromDate, DateTime toDate);
|
|
DataSet GetRecord(string empIds, DateTime fromDate, DateTime toDate, EnumLeaveStatus leaveStatus);
|
|
DataSet GetReport(string query);
|
|
DataTable GetTotalLeaveAmountInYear(int leaveYearId, EnumLeaveStatus leaveStatus);
|
|
bool IsExist(Employee oEmployee, DateTime fromDate, DateTime toDate);
|
|
void SaveLeaveEntry(ObjectsTemplate<LeaveEntry> oLeaveEntry);
|
|
}
|
|
#endregion
|
|
} |