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

244 lines
6.8 KiB
C#

using Ease.Core.Model;
using System;
using System.Collections.Generic;
using System.Data;
namespace HRM.BO
{
#region SetupDetail
public class SetupDetail : ObjectTemplate
{
#region Constructor
public SetupDetail()
{
//_tranID = null;
//_tranType = EnmSetupManagerTranType.None;
//_code = string.Empty;
//_name = string.Empty;
//_isSelected = false;
}
#endregion
#region Properties
//public void SetObjectID(int IdValue)
//{
// this.SetID(ID.FromInteger(IdValue));
//}
public int SetupID { get; set; }
public int TranID { get; set; }
public EnmSetupManagerTranType TranType { get; set; }
public string Code { get; set; }
public string Name { get; set; }
public bool IsSelected { get; set; }
#region Service Factory ISetupDetailService : ISetupDetailService
internal static ISetupDetailService Service
{
get { return Services.Factory.CreateService<ISetupDetailService>(typeof(ISetupDetailService)); }
}
#endregion
#endregion
//#region Functions
public static int GetTranID(Employee employee, EnmSetupManagerTranType type)
{
int? nTranID = null;
switch (type)
{
case EnmSetupManagerTranType.Category:
nTranID = employee.CategoryID;
break;
case EnmSetupManagerTranType.Designation:
nTranID = employee.DesignationID;
break;
case EnmSetupManagerTranType.Grade:
nTranID = employee.GradeID;
break;
case EnmSetupManagerTranType.Location:
nTranID = employee.LocationID;
break;
}
return nTranID ?? 0;
}
//public static int GetIndex(List<SetupDetail> details, int tranID,
// EnmSetupManagerTranType type)
//{
// int index = -1;
// foreach (SetupDetail item in details)
// {
// index = index + 1;
// if (item.TranID.Integer == tranID && item.TranType == type)
// {
// return index;
// }
// }
// return -1;
//}
//public static List<SetupDetail> GetParameters(EnumParameterSetup setup,int setupID)
//{
// #region Cache Header
// List<SetupDetail> setupDetails = _cache["Get",setupID] as List<SetupDetail>;
// if (setupDetails != null)
// return setupDetails;
// #endregion
// try
// {
// setupDetails = Service.GetParameters(setup, setupID);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(setupDetails, "Get",setupID);
// #endregion
// return setupDetails;
//}
public static List<SetupDetail> GetParameters(EnumParameterSetup setup)
{
#region Cache Header
//List<SetupDetail> setupDetails = _cache["Get"] as List<SetupDetail>;
//if (setupDetails != null)
// return setupDetails;
List<SetupDetail> setupDetails = null;
#endregion
try
{
setupDetails = Service.GetParameters(setup);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
//_cache.Add(setupDetails, "Get");
#endregion
return setupDetails;
}
//public static DataSet GetParameters(EnumParameterSetup setup, List<string> sqlRelation, string InEmpSQL)
//{
// try
// {
// return Service.GetParameters(setup, sqlRelation,InEmpSQL);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
//}
//public static List<SetupDetail> GetUsedParameters(EnumParameterSetup setup, int setupID, int parameterId)
//{
// List<SetupDetail> setupDetails = null;
// try
// {
// setupDetails = Service.GetUsedParameters( setup, setupID, parameterId);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// return setupDetails;
//}
//public static List<SetupDetail> GetUsedParameters(EnumParameterSetup setup, int parameterId)
//{
// List<SetupDetail> setupDetails = null;
// try
// {
// setupDetails = Service.GetUsedParameters(setup, parameterId);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// return setupDetails;
//}
//public static List<EnmSetupManagerTranType> GetTypes(EnumParameterSetup setup)
//{
// List<EnmSetupManagerTranType> types = null;
// try
// {
// types = Service.GetTypes(setup);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// return types;
//}
//public static Hashtable DistinctSetupID(List<SetupDetail> details)
//{
// Hashtable ids = new Hashtable();
// foreach (SetupDetail detail in details)
// {
// ids[detail.ID] = detail.ID;
// }
// return ids;
//}
//#endregion
}
#endregion
#region ISetupDetail Service
public interface ISetupDetailService
{
List<SetupDetail> GetParameters(EnumParameterSetup setup);
//List<SetupDetail> GetParameters(EnumParameterSetup setup, int setupID);
//List<SetupDetail> GetUsedParameters(EnumParameterSetup setup, int setupID, int objectID);
//List<SetupDetail> GetUsedParameters(EnumParameterSetup setup, string setupIDs, int objectID);
//List<SetupDetail> GetUsedParameters(EnumParameterSetup setup, int objectID);
List<EnmSetupManagerTranType> GetTypes(EnumParameterSetup setup);
//DataSet GetParameters(EnumParameterSetup setup, List<string> sqlRelation, string InEmpSQL);
//List<int> GetParameterID(EnumParameterSetup setup, EnmSetupManagerTranType type, ID TranID);
}
#endregion
}