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 Details { get; set; } public List 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 parameters, int gradeid, int TermID) { List 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 ApplicableParameters(List parameters, int gradeid) { List selectedTerms = new List(); 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 Get(int payrollTypeid, bool withDetail); List GetByGrade(int gradeID); int Save(UnAuthorizeLeaveParam item); void Delete(int id); List GetByLeaveID(int nLeaveID); List GetUsedGrades(int UaLeaveID); } #endregion }