CEL_Payroll/Payroll.BO/UnAuthLeave/UnAuthorizeLeaveParamMaster.cs

198 lines
5.9 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
using System;
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
{
[Serializable]
public class UnAuthorizeLeaveParam : AuditTrailBase,ISetupManager
{
public UnAuthorizeLeaveParam()
{
}
#region Cache Store
private static Cache _cache = new Cache(typeof(UnAuthorizeLeaveParam));
#endregion
#region Properties
#region UnAhuthorizeLeaveID : ID
private ID _unAhuthorizeLeaveID = null;
public ID UnAhuthorizeLeaveID
{
get { return _unAhuthorizeLeaveID; }
set
{
base.OnPropertyChange<ID>("UnAhuthorizeLeaveID", _unAhuthorizeLeaveID, value);
_unAhuthorizeLeaveID = value;
}
}
#endregion
#region UnAhuthorizeLeave : UnAhuthorizeLeave
private UnAuthorizeLeave _unAhuthorizeLeave = null;
public UnAuthorizeLeave UnAuthorizeLeave
{
get
{
if (_unAhuthorizeLeave == null && !_unAhuthorizeLeaveID.IsUnassigned && _unAhuthorizeLeaveID.Integer > 0)
{
_unAhuthorizeLeave = UnAuthorizeLeave.Get(_unAhuthorizeLeaveID);
}
return _unAhuthorizeLeave;
}
}
#endregion
#region UnAhuthorizeLeaveDetails : UnAhuthorizeLeaveDetails
private ObjectsTemplate<UnAuthorizeLeaveParamDetail> _details = null;
public ObjectsTemplate<UnAuthorizeLeaveParamDetail> Details
{
get
{
if (_details == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
{
_details = UnAuthorizeLeaveParamDetail.GetByParamID(this.ID);
}
if (_details == null)
{
_details = new ObjectsTemplate<UnAuthorizeLeaveParamDetail>();
}
return _details;
}
}
#endregion
#region Service Factory IUnAuthorizeLeaveParameterService : IUnAuthorizeLeaveParameterService
internal static IUnAuthorizeLeaveParamService Service
{
get { return Services.Factory.CreateService<IUnAuthorizeLeaveParamService>(typeof(IUnAuthorizeLeaveParamService)); }
}
#endregion
#endregion
#region Function
public ID Save()
{
this.SetAuditTrailProperties();
return Service.Save(this);
}
public void Delete()
{
Service.Delete(this.ID);
}
public static UnAuthorizeLeaveParam Get(ID id)
{
return Service.Get(id);
}
public static ObjectsTemplate<UnAuthorizeLeaveParam> Get()
{
return Service.Get();
}
public static ObjectsTemplate<UnAuthorizeLeaveParam> GetByLeaveID(ID nLeaveID)
{
return Service.GetByLeaveID(nLeaveID);
}
public static UnAuthorizeLeaveParamDetail GetItem(UnAuthorizeLeaveParam leaveParam,
int componentID)
{
foreach (UnAuthorizeLeaveParamDetail item in leaveParam.Details)
{
if (item.AllowanceID.Integer == componentID)
{
return item;
}
}
return null;
}
#endregion
#region ISetupManager Members
private ObjectsTemplate<SetupDetail> _setupDetails;
public ObjectsTemplate<SetupDetail> SetupDetails
{
get
{
return _setupDetails;
}
set
{
_setupDetails = value;
}
}
public EmployeeSetupParameter ApplicableParameters(Employee employee)
{
EmployeeSetupParameter empParameter = new EmployeeSetupParameter(EnumParameterSetup.SalaryDeduct);
empParameter.Employee = employee;
empParameter.ParameterIDs = SetupManager.ApplicableParameters(employee, EnumParameterSetup.SalaryDeduct);
return empParameter;
}
public List<EmployeeSetupParameter> ApplicableParameters(ObjectsTemplate<Employee> employees)
{
ObjectsTemplate<SetupDetail> details = SetupDetail.GetParameters(EnumParameterSetup.SalaryDeduct);
List<EnmSetupManagerTranType> types = SetupDetail.GetTypes(EnumParameterSetup.SalaryDeduct);
List<EmployeeSetupParameter> empParametes = new List<EmployeeSetupParameter>();
foreach (Employee emp in employees)
{
EmployeeSetupParameter empparameter = new EmployeeSetupParameter(EnumParameterSetup.SalaryDeduct);
empparameter.Employee = emp;
empparameter.ParameterIDs = SetupManager.ApplicableParameters(emp, EnumParameterSetup.SalaryDeduct,
types, details);
empParametes.Add(empparameter);
}
return empParametes;
}
public void FillMe(ID id)
{
UnAuthorizeLeaveParam tpm = UnAuthorizeLeaveParam.Get(id);
this.UnAhuthorizeLeaveID = tpm.UnAhuthorizeLeaveID;
this.CreatedBy = tpm.CreatedBy;
this.CreatedDate = tpm.CreatedDate;
this.ModifiedBy = tpm.ModifiedBy;
this.ModifiedDate = tpm.ModifiedDate;
this.SetID(tpm.ID);
this.SetState(ObjectState.Saved);
}
#endregion
}
#region IUnAuthorizeLeaveParameter Service
public interface IUnAuthorizeLeaveParamService
{
UnAuthorizeLeaveParam Get(ID id);
ObjectsTemplate<UnAuthorizeLeaveParam> Get();
ID Save(UnAuthorizeLeaveParam item);
void Delete(ID id);
ObjectsTemplate<UnAuthorizeLeaveParam> GetByLeaveID(ID nLeaveID);
}
#endregion
}