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

99 lines
2.7 KiB
C#

using System;
using Ease.Core.Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Ease.Core;
namespace HRM.BO
{
public class UnAuthorizeLeaveParam : AuditTrailBase
{
public UnAuthorizeLeaveParam()
{
}
#region Properties
#region UnAhuthorizeLeaveID : ID
private int _unAhuthorizeLeaveID = 0;
public int UnAhuthorizeLeaveID
{
get { return _unAhuthorizeLeaveID; }
set
{
_unAhuthorizeLeaveID = value;
}
}
public int PayrollTypeID { get; set; }
#endregion
public UnAuthorizeLeave UnAuthorizeLeave { get; set; }
public List<UnAuthorizeLeaveParamDetail> Details { get; set; }
public List<UnAuthorizeLeaveParamGrade> paramGrades { get; set; }
public class UnAuthorizeLeaveParamGrade
{
public int paramID { get; set; }
public int gradeID { get; set; }
public int id { get; set; }
public string gradeNameview { get; set; }
}
public static UnAuthorizeLeaveParam GetParameter(List<UnAuthorizeLeaveParam> parameters, int gradeid, int TermID)
{
List<UnAuthorizeLeaveParam> selectedTerms = parameters.FindAll(x => x.UnAhuthorizeLeaveID == TermID);
if (selectedTerms == null) return null;
foreach (UnAuthorizeLeaveParam item in selectedTerms)
{
var ei = item.paramGrades.FirstOrDefault(x => x.gradeID == gradeid);
if (ei != null) return item;
}
return null;
}
public static List<UnAuthorizeLeaveParam> ApplicableParameters(List<UnAuthorizeLeaveParam> parameters, int gradeid)
{
List<UnAuthorizeLeaveParam> selectedTerms = new List<UnAuthorizeLeaveParam>();
foreach (UnAuthorizeLeaveParam item in parameters)
{
var ei = item.paramGrades.FirstOrDefault(x => x.gradeID == gradeid);
if (ei != null) selectedTerms.Add(item);
}
return selectedTerms;
}
#endregion
}
#region IUnAuthorizeLeaveParameter Service
public interface IUnAuthorizeLeaveParamService
{
UnAuthorizeLeaveParam Get(int id);
List<UnAuthorizeLeaveParam> Get(int payrollTypeid, bool withDetail);
List<UnAuthorizeLeaveParam> GetByGrade(int gradeID);
int Save(UnAuthorizeLeaveParam item);
void Delete(int id);
List<UnAuthorizeLeaveParam> GetByLeaveID(int nLeaveID);
List<UnAuthorizeLeaveParam.UnAuthorizeLeaveParamGrade> GetUsedGrades(int UaLeaveID);
}
#endregion
}