using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.CoreV35; using Ease.CoreV35.Caching; using Ease.CoreV35.Model; using Ease.CoreV35.Utility; namespace Payroll.BO { [Serializable] public class WFRuleDetailDesignation : BasicBaseObject { #region Cache Store private static Cache _cache = new Cache(typeof(WFRuleDetailDesignation)); #endregion #region Constructor & Private Declarations public WFRuleDetailDesignation() { _designationId = ID.FromInteger(0); _wfSetupId = null; _wfSetupRuleId = null; _sequenceId = 0; } #endregion #region Property #region DesignationId : ID private ID _designationId; public ID DesignationId { get { return _designationId; } set { _designationId = value; } } #endregion #region Property WfSetupId : ID private ID _wfSetupId; public ID WfSetupId { get { return _wfSetupId; } set { _wfSetupId = value; } } #endregion #region Property WfSetupRuleId : ID private ID _wfSetupRuleId; public ID WfSetupRuleId { get { return _wfSetupRuleId; } set { _wfSetupRuleId = value; } } #endregion #region SequenceID : int private int _sequenceId; public int SequenceId { get { return _sequenceId; } set { _sequenceId = value; } } #endregion #region Designation : Designation Object private Designation _designation; public Designation Designation { get { if (_designation == null) { _designation = Designation.Get(_designationId); } return _designation; } set { _designation = value; } } #endregion #region IsInitiator : Boolean public static bool IsInitiator(ObjectsTemplate ordesgs, ID designationID) { foreach (WFRuleDetailDesignation oItem in ordesgs) { if (oItem.SequenceId == 1 && oItem.DesignationId.Integer == designationID.Integer) { return true; } } return false; } #endregion #endregion } public enum enumWFRuleManual { Employee = 1, Line_Manager = 2, Positions_type = 3, Og_Nodes = 4 } [Serializable] public class WFRuleDetailManual : BasicBaseObject { #region Cache Store private static Cache _cache = new Cache(typeof(WFRuleDetailManual)); #endregion #region Constructor & Private Declarations public WFRuleDetailManual() { _objectId = 0; _wfSetupId = null; _wfSetupRuleId = null; _sequenceId = 0; _ruleType = enumWFRuleManual.Employee; } #endregion #region Property #region DesignationId : ID private int _objectId; public int ObjectID { get { return _objectId; } set { _objectId = value; } } #endregion #region Property WfSetupId : ID private ID _wfSetupId; public ID WfSetupId { get { return _wfSetupId; } set { _wfSetupId = value; } } #endregion #region Property WfSetupRuleId : ID private ID _wfSetupRuleId; public ID WfSetupRuleId { get { return _wfSetupRuleId; } set { _wfSetupRuleId = value; } } #endregion #region SequenceID : int private int _sequenceId; public int SequenceId { get { return _sequenceId; } set { _sequenceId = value; } } #endregion #region SequenceID : int private enumWFRuleManual _ruleType; public enumWFRuleManual RuleType { get { return _ruleType; } set { _ruleType = value; } } #endregion //public string GetRuleDetailDescription(int nSequenceID) //{ // string desc = string.Empty; // foreach (WFRuleDetailManual oItem in WFRuleDetailNodes) // { // if (oItem.SequenceId == nSequenceID) // { // desc = desc + oItem.OrganogramBasic.PositionName + ", "; // } // } // if (WFRuleDetailNodes.Count >= 1) desc = desc.Substring(0, desc.Length - 2); // return desc; //} #region IsInitiator : Boolean public static bool IsInitiator(ObjectsTemplate Manuals, ID nodeid) { foreach (WFRuleDetailManual oItem in Manuals) { if (oItem.SequenceId == 1 && oItem.RuleType != enumWFRuleManual.Line_Manager) { if (oItem.RuleType == enumWFRuleManual.Employee) return true; else if (oItem.RuleType == enumWFRuleManual.Positions_type) { ObjectsTemplate opprovers = OrganogramBasic.GetbyPositionTypeid(Ease.CoreV35.Model.ID.FromInteger(oItem.ObjectID)); if (opprovers.Contains(nodeid) == true) return true; } else { OrganogramBasic og = OrganogramBasic.Get(ID.FromInteger(oItem.ObjectID)); if (og != null) return true; } } } return false; } #endregion #endregion } }