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(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 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 GetParameters(EnumParameterSetup setup,int setupID) //{ // #region Cache Header // List setupDetails = _cache["Get",setupID] as List; // 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 GetParameters(EnumParameterSetup setup) { #region Cache Header //List setupDetails = _cache["Get"] as List; //if (setupDetails != null) // return setupDetails; List 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 sqlRelation, string InEmpSQL) //{ // try // { // return Service.GetParameters(setup, sqlRelation,InEmpSQL); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } //} //public static List GetUsedParameters(EnumParameterSetup setup, int setupID, int parameterId) //{ // List setupDetails = null; // try // { // setupDetails = Service.GetUsedParameters( setup, setupID, parameterId); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // return setupDetails; //} //public static List GetUsedParameters(EnumParameterSetup setup, int parameterId) //{ // List setupDetails = null; // try // { // setupDetails = Service.GetUsedParameters(setup, parameterId); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // return setupDetails; //} //public static List GetTypes(EnumParameterSetup setup) //{ // List types = null; // try // { // types = Service.GetTypes(setup); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // return types; //} //public static Hashtable DistinctSetupID(List 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 GetParameters(EnumParameterSetup setup); //List GetParameters(EnumParameterSetup setup, int setupID); //List GetUsedParameters(EnumParameterSetup setup, int setupID, int objectID); //List GetUsedParameters(EnumParameterSetup setup, string setupIDs, int objectID); //List GetUsedParameters(EnumParameterSetup setup, int objectID); List GetTypes(EnumParameterSetup setup); //DataSet GetParameters(EnumParameterSetup setup, List sqlRelation, string InEmpSQL); //List GetParameterID(EnumParameterSetup setup, EnmSetupManagerTranType type, ID TranID); } #endregion }