Ejemplo n.º 1
0
        public static int InsDObject(DObject _param)
        {
            int result = -1;

            _param.CreateUs = 1;
            if (_param.BPolicyOID == null)
            {
                _param.BPolicyOID = BPolicyRepository.SelBPolicy(new BPolicy {
                    Type = _param.Type
                }).First().OID;
            }

            if (_param.Revision == null)
            {
                BPolicy tmpBPolicy = BPolicyRepository.SelBPolicy(new BPolicy {
                    OID = _param.BPolicyOID
                }).First();
                if (tmpBPolicy.IsRevision != null && tmpBPolicy.IsRevision.Equals("Y"))
                {
                    _param.TdmxOID = DObjectRepository.SelTdmxOID(new DObject {
                        Type = _param.Type
                    });
                    _param.Revision = CommonConstant.REVISION_PREFIX + CommonConstant.INIT_REVISION;
                }
            }

            _param.IsLatest         = 1;
            _param.IsReleasedLatest = 0;
            result = DaoFactory.SetInsert("Comm.InsDObject", _param);
            return(result);
        }
Ejemplo n.º 2
0
        public static List <DObject> SelDObjects(DObject _param)
        {
            List <DObject> lDObject = DaoFactory.GetList <DObject>("Comm.SelDObject", _param);

            lDObject.ForEach(dObj =>
            {
                dObj.BPolicy = BPolicyRepository.SelBPolicy(new BPolicy {
                    Type = dObj.Type, OID = dObj.BPolicyOID
                }).First();
            });
            return(lDObject);
        }
Ejemplo n.º 3
0
        public static DObject SelDObject(DObject _param)
        {
            DObject dObject = DaoFactory.GetData <DObject>("Comm.SelDObject", _param);

            if (dObject != null)
            {
                dObject.BPolicy = BPolicyRepository.SelBPolicy(new BPolicy {
                    Type = dObject.Type, OID = dObject.BPolicyOID
                }).First();
            }
            return(dObject);
        }
Ejemplo n.º 4
0
        public static List <Library> SelLibrary(Library _param)
        {
            _param.Type = CommonConstant.TYPE_LIBRARY;
            List <Library> lLibrary = DaoFactory.GetList <Library>("Library.SelLibrary", _param);

            lLibrary.ForEach(obj =>
            {
                obj.BPolicy = BPolicyRepository.SelBPolicy(new BPolicy {
                    Type = obj.Type, OID = obj.BPolicyOID
                }).First();
            });
            return(lLibrary);
        }
Ejemplo n.º 5
0
        public static List <ApprovalTask> SelInboxTasks(ApprovalTask _param)
        {
            List <ApprovalTask> lApprovalTasks = DaoFactory.GetList <ApprovalTask>("Comm.SelApprovalTask", _param);

            lApprovalTasks.ForEach(task =>
            {
                task.BPolicy = BPolicyRepository.SelBPolicy(new BPolicy {
                    OID = task.BPolicyOID
                }).First();
                task.PersonObj = PersonRepository.SelPerson(new Person {
                    OID = task.PersonOID
                });
                task.PersonNm     = task.PersonObj.Name;
                task.DepartmentNm = task.PersonObj.DepartmentNm;
            });
            return(lApprovalTasks);;
        }
Ejemplo n.º 6
0
        public static string StatusCheckPromote(string RelType, string CurrentStatus, int OID, int RootOID, string Action, string Comment)
        {
            string result = "";
            List <Dictionary <string, string> > checkProgram = BPolicyRepository.SelCheckProgram(new BPolicy {
                Type = RelType, OID = Convert.ToInt32(CurrentStatus)
            });

            if (checkProgram != null && checkProgram.Count > 0)
            {
                checkProgram.ForEach(item =>
                {
                    if (result == null || result.Length < 1)
                    {
                        string returnMessage = SemsUtil.Invoke(item[CommonConstant.POLICY_TRIGGER_CLASS], item[CommonConstant.POLICY_TRIGGER_FUNCTION], new string[] { RelType, CurrentStatus, Convert.ToString(OID), Convert.ToString(RootOID), Action, Comment });
                        if (returnMessage != null && returnMessage.Length > 0)
                        {
                            result = returnMessage;
                        }
                    }
                });
            }
            return(result);
        }
Ejemplo n.º 7
0
        public static string StatusPromote(bool Transaction, string RelType, string CurrentStatus, int OID, int RootOID, string Action, string Comment)
        {
            string result = "";

            try
            {
                if (Transaction)
                {
                    DaoFactory.BeginTransaction();
                }
                string checkProgram = StatusCheckPromote(RelType, CurrentStatus, OID, RootOID, Action, Comment);
                if (checkProgram != null && checkProgram.Length > 0)
                {
                    throw new Exception(checkProgram);
                }

                List <Dictionary <string, string> > actionProgram = BPolicyRepository.SelActionProgram(new BPolicy {
                    Type = RelType, OID = Convert.ToInt32(CurrentStatus)
                });
                if (actionProgram != null && actionProgram.Count > 0)
                {
                    actionProgram.ForEach(item =>
                    {
                        string returnMessage = SemsUtil.Invoke(item[CommonConstant.POLICY_TRIGGER_CLASS], item[CommonConstant.POLICY_TRIGGER_FUNCTION], new string[] { RelType, CurrentStatus, Convert.ToString(OID), Convert.ToString(RootOID), Action, Comment });
                        if (returnMessage != null && returnMessage.Length > 0)
                        {
                            throw new Exception(returnMessage);
                        }
                    });
                }

                string strNextAction = BPolicyRepository.SelBPolicy(new BPolicy {
                    Type = RelType, OID = Convert.ToInt32(CurrentStatus)
                }).First().NextActionOID;
                string strActionOID = "";
                if (strNextAction != null)
                {
                    strNextAction.Split(',').ToList().ForEach(action =>
                    {
                        if (action.IndexOf(Action) > -1)
                        {
                            strActionOID = action.Substring(action.IndexOf(":") + 1);
                            return;
                        }
                    });
                }
                DObjectRepository.UdtDObject(new DObject {
                    OID = OID, BPolicyOID = Convert.ToInt32(strActionOID)
                });
                if (Transaction)
                {
                    DaoFactory.Commit();
                }
            }
            catch (Exception ex)
            {
                if (Transaction)
                {
                    DaoFactory.Rollback();
                }
                result = ex.Message;
            }
            return(result);
        }