788 lines
32 KiB
C#
788 lines
32 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Ease.Core;
|
|
using Ease.Core.Model;
|
|
using System.Data;
|
|
using HRM.BO.Configuration;
|
|
|
|
namespace HRM.BO
|
|
{
|
|
#region Leave Entry
|
|
|
|
public class LeaveEntry : AuditTrailBase, IworkflowInterface
|
|
{
|
|
#region Constructor
|
|
public LeaveEntry()
|
|
{
|
|
//_empID = 0;//
|
|
_aprFromDate = DateTime.Now.Date;//
|
|
_aprToDate = DateTime.Now.Date;//
|
|
EntryDate = DateTime.Now.Date;//
|
|
IsDrafted = 0;//
|
|
IsAvailed = 0;//
|
|
LeaveName = string.Empty;
|
|
_leaveStatus = EnumLeaveStatus.Approved;//
|
|
|
|
Remarks = string.Empty;//
|
|
ErnLeaveRemarks = string.Empty;//
|
|
|
|
ItemId = 0;
|
|
OtValue = 0;
|
|
DoctorCertificate = false;
|
|
LFAAmount = 0;
|
|
DayPeriod = 0;
|
|
ResponsiblePersonID = 0;
|
|
AvailRemarks = "";
|
|
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region Properties
|
|
|
|
public EnumSystemType SystemType { get; set; }
|
|
public EnumCompensatoryLeaveFor CompensatoryLeaveFor { get; set; }
|
|
public bool DoctorCertificate { get; set; }
|
|
public int EmpID { get; set; }
|
|
public Employee Employee { get; set; }
|
|
public int EmpGradeId { get; set; }
|
|
|
|
public int ItemId { get; set; }
|
|
|
|
public double OtValue { get; set; }
|
|
|
|
public int LeaveYearId { get; set; }
|
|
|
|
public int AppliedParamId { get; set; }
|
|
public EnumHalf SelectedHalf { get; set; }
|
|
|
|
public LeaveParameter LeaveParameter { get; set; }
|
|
|
|
public DateTime LeaveAgainstDate { get; set; }
|
|
|
|
public DateTime AppliedLeaveDate { get; set; }
|
|
|
|
public DateTime AppliedFromDate { get; set; }
|
|
|
|
public DateTime AppliedToDate { get; set; }
|
|
|
|
public double AppliedTotalDays { get; set; }
|
|
public double LFAAmount { get; set; }
|
|
|
|
public double DayPeriod { get; set; }
|
|
|
|
public double LFASmokingAmount { get; set; }
|
|
public DateTime SalaryMonth { get; set; }
|
|
public int ApprovedParamId { get; set; }
|
|
|
|
public DateTime ApprovedLeaveDate { get; set; }
|
|
public DateTime? ApprovedDate { get; set; }
|
|
public DateTime? CompensatoryDate { get; set; }
|
|
|
|
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; }
|
|
}
|
|
|
|
public int ApprovedBy { get; set; }
|
|
|
|
public int ResponsiblePersonID { get; set; }
|
|
|
|
public string Remarks { get; set; }
|
|
|
|
|
|
public DateTime EntryDate { get; set; }
|
|
|
|
public int IsDrafted { get; set; }
|
|
|
|
public int IsAvailed { get; set; }
|
|
public string ConnectionString { get; set; }
|
|
|
|
public int LeaveEntryType { get; set; }
|
|
public DateTime? WorkingDate { get; set; }
|
|
public string LeaveName { get; set; }
|
|
|
|
|
|
private EnumLeaveStatus _leaveStatus;
|
|
public EnumLeaveStatus LeaveStatus
|
|
{
|
|
get { return _leaveStatus; }
|
|
set { _leaveStatus = value; }
|
|
}
|
|
|
|
public string LeaveDayPeriod { get; set; }
|
|
|
|
public int GetStatusbyWf(EnumwfStatus wfstatus)
|
|
{
|
|
EnumLeaveStatus lvstatus;
|
|
switch (wfstatus)
|
|
{
|
|
case EnumwfStatus.Received:
|
|
case EnumwfStatus.Revert:
|
|
lvstatus = EnumLeaveStatus.OnApproval;
|
|
break;
|
|
case EnumwfStatus.Reject:
|
|
lvstatus = EnumLeaveStatus.Declined;
|
|
break;
|
|
case EnumwfStatus.Approve:
|
|
lvstatus = EnumLeaveStatus.Approved;
|
|
break;
|
|
case EnumwfStatus.End:
|
|
lvstatus = EnumLeaveStatus.Approved;
|
|
break;
|
|
default:
|
|
lvstatus = EnumLeaveStatus.OnApproval;
|
|
break;
|
|
}
|
|
return (int)lvstatus;
|
|
}
|
|
|
|
public string LeaveStatusDescription
|
|
{
|
|
get
|
|
{
|
|
return LeaveStatus.ToString().Replace("_", " ");
|
|
}
|
|
}
|
|
|
|
public string WFDesciption()
|
|
{
|
|
string sDescription;
|
|
|
|
sDescription = this.ObjectDescription;
|
|
return sDescription;
|
|
}
|
|
public string ErnLeaveRemarks { get; set; }
|
|
public int LeaveID { get; set; }
|
|
public int AppliedLeaveID { get; set; }
|
|
public int SbuID { get; set; }
|
|
public int DepartmentID { get; set; }
|
|
public int FunctionID { get; set; }
|
|
public int LocationID { get; set; }
|
|
public int DesignationID { get; set; }
|
|
public bool IsHalfday { get; set; }
|
|
public int FromHalf { get; set; }
|
|
public int ToHalf { get; set; }
|
|
public string ContactNumber { get; set; }
|
|
public string AddressDuringLeave { get; set; }
|
|
|
|
public bool isLFA { get; set; }
|
|
//public List<PendingJobDetail> GetDetails()
|
|
//{
|
|
// DataTable dt = Service.GetPendingJobDetail(this.ID);
|
|
// List<PendingJobDetail> opJobsDetail = new List<PendingJobDetail>();
|
|
// if (dt.Rows.Count > 0)
|
|
// {
|
|
// opJobsDetail.Add(new PendingJobDetail() { Type = "Applier:", Value = dt.Rows[0]["Applier"].ToString() });
|
|
// opJobsDetail.Add(new PendingJobDetail() { Type = "Leave Type:", Value = dt.Rows[0]["Leave"].ToString() });
|
|
// opJobsDetail.Add(new PendingJobDetail() { Type = "From Date:", Value = dt.Rows[0]["FromDate"].ToString() });
|
|
// opJobsDetail.Add(new PendingJobDetail() { Type = "To Date:", Value = dt.Rows[0]["ToDate"].ToString() });
|
|
// opJobsDetail.Add(new PendingJobDetail() { Type = "Total Days:", Value = dt.Rows[0]["TotalDays"].ToString() });
|
|
// opJobsDetail.Add(new PendingJobDetail() { Type = "Remarks:", Value = dt.Rows[0]["Remarks"].ToString() });
|
|
// }
|
|
// return opJobsDetail;
|
|
//}
|
|
|
|
#region Leave Properties for Avail
|
|
|
|
public DateTime AvailFromDate { get; set; }
|
|
public DateTime AvailToDate { get; set; }
|
|
public string AvailRemarks { get; set; }
|
|
|
|
public int AvailedBy { get; set; }
|
|
public double AvailTotalDays { get; set; }
|
|
#endregion
|
|
|
|
public List<LeaveAttachment> Attachments { get; set; }
|
|
public Leave Leave { get; set; }
|
|
|
|
//#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 void SaveLeaveEntry(List<LeaveEntry> oLeaveEntry)
|
|
//{
|
|
// LeaveEntry.Service.SaveLeaveEntry(oLeaveEntry);
|
|
//}
|
|
//public bool IsExist(Employee oEmployee, DateTime fromDate, DateTime toDate)
|
|
//{
|
|
// return LeaveEntry.Service.IsExist(oEmployee, fromDate, toDate);
|
|
//}
|
|
|
|
|
|
//public void Delete()
|
|
//{
|
|
// LeaveEntry.Service.Delete(ID);
|
|
//}
|
|
//public void Delete(LeaveEntry oLeaveEntry)
|
|
//{
|
|
// LeaveEntry.Service.Delete(oLeaveEntry);
|
|
//}
|
|
//public void Delete(int id)
|
|
//{
|
|
// LeaveEntry.Service.Delete(ID.FromInteger(id));
|
|
//}
|
|
//public void DeleteByLeaveYear(int nLeaveYear, int LeaveID)
|
|
//{
|
|
// LeaveEntry.Service.DeleteByLeaveYear(nLeaveYear, LeaveID);
|
|
//}
|
|
//public static bool IsAttachmentAplicable(Leave leave, decimal totalDays)
|
|
//{
|
|
// if (totalDays >= 2 && leave.Code.ToLower() == "sl" && leave.ID.Integer == 3 && leave.IsAttachmentNeeded)
|
|
// return true;
|
|
// else
|
|
// return false;
|
|
//}
|
|
//public void RefreshLeaveAttachment(Leave leave, byte[] fileBody, string fileName)
|
|
//{
|
|
// try
|
|
// {
|
|
// string fullPath = string.Empty;
|
|
// string directory = string.Empty;
|
|
// string path = string.Empty;
|
|
// string extension = string.Empty;
|
|
// string leaveAttachmentPath = string.Empty;
|
|
// byte[] body = null;
|
|
|
|
// LeaveAttachment attachment = new LeaveAttachment();
|
|
// List<LeaveAttachment> attachments = new List<LeaveAttachment>();
|
|
// List<PhotoPath> photoPaths = PhotoPath.Get();
|
|
|
|
// if (photoPaths != null && photoPaths.Count > 0)
|
|
// {
|
|
// leaveAttachmentPath = photoPaths[0].LetterTempPath;
|
|
// directory = leaveAttachmentPath + "/" + DateTime.Today.ToString("dd MMM yyyy") + "/" + this.Employee.EmployeeNo + "/";
|
|
// if (!Directory.Exists(directory))
|
|
// Directory.CreateDirectory(directory);
|
|
|
|
// extension = Path.GetExtension(fileName);
|
|
// path = directory + leave.Description + "_" + Convert.ToDateTime(this.ApprovedFromDate).ToString("dd MMM yyyy") + "_To_" +
|
|
// Convert.ToDateTime(this.ApprovedToDate).ToString("dd MMM yyyy") + extension;
|
|
|
|
// fullPath = DateTime.Today.ToString("dd MMM yyyy") + "/" + this.Employee.EmployeeNo + "/" + leave.Description +
|
|
// "_" + Convert.ToDateTime(this.ApprovedFromDate).ToString("dd MMM yyyy") + "_To_" +
|
|
// Convert.ToDateTime(this.ApprovedToDate).ToString("dd MMM yyyy") + extension;
|
|
|
|
// body = fileBody;
|
|
// File.WriteAllBytes(path, body);
|
|
// attachment.AttachmentPath = fullPath;
|
|
// attachments.Add(attachment);
|
|
// this.Attachments = attachments;
|
|
// }
|
|
// else
|
|
// {
|
|
// throw new Exception("Leave attachment path not found.");
|
|
// }
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// throw ex;
|
|
// }
|
|
//}
|
|
|
|
//#endregion
|
|
|
|
#region Collection of Leave Entry
|
|
|
|
//#region Methods
|
|
//public static List<LeaveEntry> Get(string empIds, int leaveYear, EnumLeaveStatus leaveStatus)
|
|
//{
|
|
// List<LeaveEntry> oLeaveEntrys = null;
|
|
// #region Cache Header
|
|
// oLeaveEntrys = (List<LeaveEntry>)_cache["Get", empIds, leaveYear] as List<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 List<LeaveEntry> GetPending(int empId, int nLeaveID, EnumLeaveStatus leaveStatus)
|
|
//{
|
|
// List<LeaveEntry> oLeaveEntrys = LeaveEntry.Service.GetPending(empId, nLeaveID, leaveStatus);
|
|
|
|
// return oLeaveEntrys;
|
|
//}
|
|
//public static List<LeaveEntry> GetByLeaveYear(int nLeaveYear)
|
|
//{
|
|
// List<LeaveEntry> oLeaveEntrys = null;
|
|
// #region Cache Header
|
|
// //oLeaveEntrys = (List<LeaveEntry>)_cache["Get"] as List<LeaveEntry>;
|
|
// if (oLeaveEntrys != null)
|
|
// {
|
|
// return oLeaveEntrys;
|
|
// }
|
|
// #endregion
|
|
// oLeaveEntrys = LeaveEntry.Service.GetByLeaveYear(nLeaveYear);
|
|
// #region Cache Footer
|
|
// //_cache.Add(oLeaveEntrys, "Get");
|
|
// #endregion
|
|
// return oLeaveEntrys;
|
|
//}
|
|
//public static List<LeaveEntry> Get(DateTime fromDate, DateTime toDate, EnumLeaveStatus leaveStatus)
|
|
//{
|
|
// List<LeaveEntry> oLeaveEntrys = null;
|
|
// oLeaveEntrys = LeaveEntry.Service.Get(fromDate, toDate, leaveStatus);
|
|
// return oLeaveEntrys;
|
|
//}
|
|
//public static List<LeaveEntry> Get(DateTime AttnDate)
|
|
//{
|
|
// List<LeaveEntry> oLeaveEntrys = null;
|
|
// oLeaveEntrys = LeaveEntry.Service.Get(AttnDate);
|
|
// return oLeaveEntrys;
|
|
//}
|
|
|
|
//public static List<LeaveEntry> GetAll()
|
|
//{
|
|
// List<LeaveEntry> oLeaveEntrys = null;
|
|
// oLeaveEntrys = LeaveEntry.Service.GetAll();
|
|
// return oLeaveEntrys;
|
|
//}
|
|
|
|
//public static List<LeaveEntry> GetByLeaveID(int nLeaveID, int nEmpID, DateTime fromDate, DateTime toDate)
|
|
//{
|
|
// List<LeaveEntry> oLeaveEntrys = null;
|
|
// oLeaveEntrys = LeaveEntry.Service.GetByLeaveID(nLeaveID, nEmpID, fromDate, toDate);
|
|
// return oLeaveEntrys;
|
|
//}
|
|
//public static List<LeaveEntry> Get(string empIds, DateTime fromDate, DateTime toDate, EnumLeaveStatus leaveStatus)
|
|
//{
|
|
// List<LeaveEntry> oLeaveEntrys = null;
|
|
// oLeaveEntrys = LeaveEntry.Service.Get(empIds, fromDate, toDate, leaveStatus);
|
|
// return oLeaveEntrys;
|
|
//}
|
|
//public static List<LeaveEntry> Get(int empId, int leaveYearID)
|
|
//{
|
|
// List<LeaveEntry> oLeaveEntrys = null;
|
|
// oLeaveEntrys = LeaveEntry.Service.Get(empId, leaveYearID);
|
|
// return oLeaveEntrys;
|
|
//}
|
|
//public static List<LeaveEntry> Get(string empIds, DateTime fromDate, DateTime toDate, string leaveStatus)
|
|
//{
|
|
// List<LeaveEntry> oLeaveEntrys = null;
|
|
// oLeaveEntrys = LeaveEntry.Service.Get(empIds, fromDate, toDate, leaveStatus);
|
|
// return oLeaveEntrys;
|
|
//}
|
|
//public static List<LeaveEntry> Get(string empIds, DateTime fromDate, DateTime toDate, EnumLeaveStatus leaveStatus, string sortExpression)
|
|
//{
|
|
// List<LeaveEntry> oLeaveEntrys = null;
|
|
// oLeaveEntrys = LeaveEntry.Service.Get(empIds, fromDate, toDate, leaveStatus, sortExpression);
|
|
// return oLeaveEntrys;
|
|
//}
|
|
//public static List<LeaveEntry> GetForAdminPanel(ID employeeID)
|
|
//{
|
|
// List<LeaveEntry> oLeaveEntrys = null;
|
|
// oLeaveEntrys = LeaveEntry.Service.GetForAdminPanel(employeeID);
|
|
// return oLeaveEntrys;
|
|
//}
|
|
//public static List<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 List<LeaveEntry> GetEmployeeWiseLeaveDetailReport(int empId, DateTime fromDate, DateTime toDate, int leaveType)
|
|
//{
|
|
// return LeaveEntry.Service.GetEmployeeWiseLeaveDetailReport(empId, fromDate, toDate, leaveType);
|
|
//}
|
|
//public static int GetEmployeeLeaveBalance(int empId, int leaveYear, int leaveType)
|
|
//{
|
|
// return LeaveEntry.Service.GetEmployeeLeaveBalance(empId, leaveYear, leaveType);
|
|
//}
|
|
//public static List<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 List<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 List<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);
|
|
//}
|
|
//public List<LeaveAttachment> GetAttachments()
|
|
//{
|
|
// return LeaveEntry.Service.GetAttachments(this.ID);
|
|
//}
|
|
//#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
|
|
// + " has applied leave cancellation for " + 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 + " 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 && (this.LeaveDayPeriod != null && this.LeaveDayPeriod != string.Empty))
|
|
//{
|
|
// str = " " + this.Employee.Name + " has applied for " + this.Leave.Description + " from " +
|
|
// this.AppliedFromDate.ToString("dd MMM yyyy") + " to " +
|
|
// this.AppliedToDate.ToString("dd MMM yyyy") + (this.LeaveDayPeriod.ToString() == "" ? this.LeaveDayPeriod.ToString() : " on " + this.LeaveDayPeriod.ToString()) + ". ";
|
|
//}
|
|
//else if (this.Leave.IsCompensatoryLeave)
|
|
//{
|
|
// str = " " + this.Employee.Name + " 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 + " 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 int SetupID
|
|
{
|
|
get {
|
|
if (this.LeaveStatus != EnumLeaveStatus.Cancel_Request)
|
|
{
|
|
return 1;
|
|
} else return 2;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// this property is used for work flow, which return leave entry id
|
|
/// </summary>
|
|
public int ObjectID
|
|
{
|
|
get { return this.ID; }
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Leave Attachment
|
|
public class LeaveAttachment : BasicBaseObject
|
|
{
|
|
#region Constructor
|
|
public LeaveAttachment()
|
|
{
|
|
AttachmentPath = string.Empty;
|
|
}
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
public int LeaveEntryID { get; set; }
|
|
|
|
public string AttachmentPath { get; set; }
|
|
public string OriginalFileName { get; set; }
|
|
public EnumFileType FileType { get; set; }
|
|
public byte[] FileAsByteArray { get; set; }
|
|
|
|
#endregion
|
|
}
|
|
#endregion
|
|
|
|
public class LeaveEntryShort
|
|
{
|
|
public int leaveEntryID { get; set; }
|
|
public int employeeID { get; set; }
|
|
public DateTime fromDate { get; set; }
|
|
public DateTime toDate { get; set; }
|
|
public double totalDays { get; set; }
|
|
public EnumLeaveStatus leaveStatus { get; set; }
|
|
}
|
|
|
|
#region Leave Entry Details for Schedular
|
|
|
|
public class LeaveEntryDetailsMailSenderReport : AuditTrailBase
|
|
{
|
|
public int EmployeeId { get; set; }
|
|
public string EmployeeNo { get; set; }
|
|
public string Name { get; set; }
|
|
public string Designation { get; set; }
|
|
public string Department { get; set; }
|
|
public int LeaveEntryID { get; set; }
|
|
public string LeaveStatus { get; set; }
|
|
public string Reason { get; set; }
|
|
public string LocationName { get; set; }
|
|
public string LeaveName { get; set; }
|
|
public DateTime FromDate { get; set; }
|
|
public DateTime ToDate { get; set; }
|
|
public DateTime AprovedDate { get; set; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ILeaveEntry Service
|
|
public interface ILeaveEntryService
|
|
{
|
|
List<LeaveEntry> GetAll();
|
|
LeaveEntry Get(int id);
|
|
bool IsEntered(DateTime year);
|
|
List<LeaveEntry> GetLeaveEntries(int empId, int leaveYearID);
|
|
List<LeaveEntry> Get(string EmpIds, int? employeeid, int? leaveYearid, int? leaveid, DateTime? fromDate, DateTime? toDate, EnumLeaveStatus? leaveStatus, bool? isLfa);
|
|
|
|
List<LeaveEntry> Get(int EmpID, DateTime fromDate, DateTime toDate, EnumLeaveStatus leaveStatus);
|
|
//List<LeaveEntry> GetEmployeeWiseLeaveDetailReport(int empId, DateTime fromDate, DateTime toDate, int leaveType);
|
|
List<LeaveEntry> GetByLeaveYear(int nLeaveYear);
|
|
List<LeaveEntry> Get(string EmpIds, int leaveYear, EnumLeaveStatus leaveStatus);
|
|
//List<LeaveEntry> Get(DateTime fromDate, DateTime toDate, EnumLeaveStatus leaveStatus);
|
|
//List<LeaveEntry> Get(DateTime attnDate);
|
|
//List<LeaveEntry> Get(string empIds, DateTime fromDate, DateTime toDate, EnumLeaveStatus leaveStatus);
|
|
//List<LeaveEntry> GetPending(int empId, int nLeaveID, EnumLeaveStatus leaveStatus);
|
|
//List<LeaveEntry> Get(int empId, int leaveYearID);
|
|
//List<LeaveEntry> GetByLeaveID(int nLeaveID, int nEmpID, DateTime fromDate, DateTime toDate);
|
|
//List<LeaveEntry> Get(string empIds, DateTime fromDate, DateTime toDate, string leaveStatus);
|
|
//List<LeaveEntry> Get(string empIds, DateTime fromDate, DateTime toDate, EnumLeaveStatus leaveStatus, string sortExpresion);
|
|
//List<LeaveEntry> GetForAdminPanel(int employeeID);
|
|
|
|
List<LeaveEntry> GetSumOfAvailedLeave(int empId, int leaveYear);
|
|
List<LeaveEntry> GetSumOfAvailedLeave(int leaveYear);
|
|
|
|
int GetEmployeeLeaveBalance(int empId, int leaveYear, int leaveType);
|
|
|
|
List<LeaveEntry> GetEmployeeWiseLeaveDetailReport(string empId, DateTime fromDate, DateTime toDate,
|
|
int leaveType);
|
|
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);
|
|
List<LeaveEntry> GetLFAOnMonth(DateTime onMonth);
|
|
int Save(LeaveEntry oLeaveEntry);
|
|
void SaveLeaveEntry(List<LeaveEntry> oLeaveEntry);
|
|
void LeaveApplicationApprove(WFMovementTran approver);
|
|
void LeaveApplicationReject(WFMovementTran approver);
|
|
void LeaveApplicationRevert(WFMovementTran approver);
|
|
void Delete(int id, int userid);
|
|
void Delete(LeaveEntry oLeaveEntry);
|
|
void DeleteByLeaveYear(int nLeaveYear, int nLeaveID);
|
|
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);
|
|
List<LeaveAttachment> GetAttachments(int leaveEntryID);
|
|
double CalculatedLeaveDays(int leaveid, int itemid, int locationid, EnumLeaveparamOn paramType, int payrollTypeid,
|
|
DateTime FromDate, DateTime ToDate, bool firstHalf, bool secondHalf, bool IsHalfDay, int empId);
|
|
|
|
DataTable GetPendingJobDetail(int ID);
|
|
DataTable GetMyTeamLeave(int lineManagerID, DateTime fromDate, DateTime toDate);
|
|
|
|
double GetApplicableDays(Leave oLeave, Employee oEmployee, DateTime FromDate, DateTime ToDate, bool IsHalfDay = false);
|
|
LeaveEntry RefreshObject(int responsiblePersonID, string address, int leaveid, Employee oEmployee, DateTime FromDate, DateTime Todate, double TotalDays,
|
|
string Reason, string LeaveDayPeriod, EnumHalf SelectedHalf, int userid, int LeaveEntryID = 0, bool IsLFA = false, bool IsHalfDay=false);
|
|
void InitiateCancelRequest(LeaveEntry oLeaveEntry);
|
|
void OnapprovalCancelRequest(int tranId);
|
|
List<string> SendMailToTheApproversForCancellation(int tranId, EmailSettings emailSettings);
|
|
void CancelRequestApprove(WFMovementTran approver);
|
|
void CancelRequestReject(WFMovementTran rejectTran);
|
|
List<LeaveEntryDetailsMailSenderReport> GetPreviousDateApprovedLeaveEntry(DateTime leaveApprovedDate, string salesHeadEmailAddress, EnumLeaveStatus leaveStatus);
|
|
DataTable AllApproverInfo(int tranId);
|
|
string UploadLeaveAttachment(int leaveId, string fileName, byte[] fileData);
|
|
DataTable GetMultipleLeaveLedgerData(int leaveYearId, int leaveId, string empIds, DateTime fromDate, DateTime toDate);
|
|
DataTable GetMultipleLeaveLedgerData(int leaveYearId, string empIds, DateTime fromDate, DateTime toDate);
|
|
List<LeaveLedgerMobile> GetEmpLeaveLedger(int empId, DateTime fromDate, DateTime toDate);
|
|
List<LeaveLedgerMobile> GetMyTeamUpcomingLeave(int empId, DateTime fromDate, DateTime toDate);
|
|
DataTable GetLeaveTodayAndNextWeek(Employee employee, EnumLeaveStatus status);
|
|
DataTable getTopLeaveChartData(Employee oEmp, int leaveYearId, EnumLeaveStatus status);
|
|
DataTable getcorehrLeaveChartData(Employee oEmp, int leaveYearId, EnumLeaveStatus status);
|
|
}
|
|
#endregion
|
|
|
|
} |