364 lines
9.6 KiB
C#
364 lines
9.6 KiB
C#
|
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;
|
|||
|
using System.Collections;
|
|||
|
using System.Data;
|
|||
|
namespace Payroll.BO
|
|||
|
{
|
|||
|
#region SetupDetail
|
|||
|
|
|||
|
[Serializable]
|
|||
|
public class SetupDetail : ObjectTemplate
|
|||
|
{
|
|||
|
#region Cache Store
|
|||
|
|
|||
|
private static Cache _cache = new Cache(typeof(SetupDetail));
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Constructor
|
|||
|
|
|||
|
public SetupDetail()
|
|||
|
{
|
|||
|
_tranID = null;
|
|||
|
_tranType = EnmSetupManagerTranType.None;
|
|||
|
_code = string.Empty;
|
|||
|
_name = string.Empty;
|
|||
|
_isSelected = false;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Properties
|
|||
|
|
|||
|
#region SetupID : int
|
|||
|
|
|||
|
private ID _setupID;
|
|||
|
public ID SetupID
|
|||
|
{
|
|||
|
get { return _setupID; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("setupID", _setupID, value);
|
|||
|
_setupID = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
#region tranID : int
|
|||
|
|
|||
|
private ID _tranID;
|
|||
|
public ID TranID
|
|||
|
{
|
|||
|
get { return _tranID; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("tranID", _tranID, value);
|
|||
|
_tranID = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region tranType : EnmSetupManagerTranType
|
|||
|
|
|||
|
private EnmSetupManagerTranType _tranType;
|
|||
|
public EnmSetupManagerTranType TranType
|
|||
|
{
|
|||
|
get { return _tranType; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<short>("tranType", (short)_tranType, (short)value);
|
|||
|
_tranType = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region code : string
|
|||
|
|
|||
|
private string _code;
|
|||
|
public string Code
|
|||
|
{
|
|||
|
get { return _code; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<string>("code", _code, value);
|
|||
|
_code = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region name : string
|
|||
|
|
|||
|
private string _name;
|
|||
|
public string Name
|
|||
|
{
|
|||
|
get { return _name; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<string>("name", _name, value);
|
|||
|
_name = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region isSelected : bool
|
|||
|
|
|||
|
private bool _isSelected;
|
|||
|
public bool IsSelected
|
|||
|
{
|
|||
|
get { return _isSelected; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<bool>("isSelected", _isSelected, value);
|
|||
|
_isSelected = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Service Factory ISetupDetailService : ISetupDetailService
|
|||
|
|
|||
|
internal static ISetupDetailService Service
|
|||
|
{
|
|||
|
get { return Services.Factory.CreateService<ISetupDetailService>(typeof(ISetupDetailService)); }
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Functions
|
|||
|
public static ID GetTranID(Employee employee, EnmSetupManagerTranType type)
|
|||
|
{
|
|||
|
ID 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;
|
|||
|
}
|
|||
|
|
|||
|
public static int GetIndex(ObjectsTemplate<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 ObjectsTemplate<SetupDetail> GetParameters(EnumParameterSetup setup,int setupID)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<SetupDetail> setupDetails = _cache["Get",setupID] as ObjectsTemplate<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 ObjectsTemplate<SetupDetail> GetParameters(EnumParameterSetup setup)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<SetupDetail> setupDetails = _cache["Get"] as ObjectsTemplate<SetupDetail>;
|
|||
|
if (setupDetails != null)
|
|||
|
return setupDetails;
|
|||
|
|
|||
|
#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;
|
|||
|
}
|
|||
|
|
|||
|
internal static ObjectsTemplate<SetupDetail> GetOTDetail(EnumParameterSetup enumParameterSetup, EnmSetupManagerTranType enmSetupManagerTranType)
|
|||
|
{
|
|||
|
ObjectsTemplate<SetupDetail> setupDetails = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
setupDetails = Service.GetOTDetail(enumParameterSetup, enmSetupManagerTranType);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
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 ObjectsTemplate<SetupDetail> GetUsedParameters(EnumParameterSetup setup, int setupID, int parameterId)
|
|||
|
{
|
|||
|
ObjectsTemplate<SetupDetail> setupDetails = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
setupDetails = Service.GetUsedParameters( setup, setupID, parameterId);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
return setupDetails;
|
|||
|
}
|
|||
|
|
|||
|
public static ObjectsTemplate<SetupDetail> GetUsedParameters(EnumParameterSetup setup, int parameterId)
|
|||
|
{
|
|||
|
ObjectsTemplate<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 ID Save(EnumParameterSetup setup )
|
|||
|
//{
|
|||
|
// return SetupDetail.Service.Save(setup, this);
|
|||
|
//}
|
|||
|
//public void Delete(EnumParameterSetup setup)
|
|||
|
//{
|
|||
|
// SetupDetail.Service.Delete(setup, ID);
|
|||
|
//}
|
|||
|
|
|||
|
//public static bool IsExist(Employee employee)
|
|||
|
//{
|
|||
|
// Hashtable ids = new Hashtable();
|
|||
|
// foreach (SetupDetail detail in details)
|
|||
|
// {
|
|||
|
// ids[detail.ID] = detail.ID;
|
|||
|
// }
|
|||
|
// return ids;
|
|||
|
//}
|
|||
|
|
|||
|
public static Hashtable DistinctSetupID(ObjectsTemplate<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
|
|||
|
{
|
|||
|
ObjectsTemplate<SetupDetail> GetParameters(EnumParameterSetup setup);
|
|||
|
ObjectsTemplate<SetupDetail> GetParameters(EnumParameterSetup setup,int setupID);
|
|||
|
ObjectsTemplate<SetupDetail> GetUsedParameters(EnumParameterSetup setup, int setupID, int objectID);
|
|||
|
ObjectsTemplate<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);
|
|||
|
|
|||
|
ObjectsTemplate<SetupDetail> GetOTDetail(EnumParameterSetup enumParameterSetup, EnmSetupManagerTranType enmSetupManagerTranType);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
|