Пример #1
0
        public static string[] FindAllChangeActionNamesByType(
            Session userSession,
            OAdEntity entity,
            int changeType)
        {
            // find the entity type
            OAdEntityDef entityDef = CQWrapper.GetEntityDef(userSession, CQWrapper.GetEntityDefName(entity));

            // find the MODIFY action def name to open the record
            object[] actionDefNames      = CQWrapper.GetActionDefNames(entityDef) as object[];
            string[] allValidActionNames = CQUtilityMethods.FindActionNameByType(entityDef, actionDefNames, changeType);

            return(allValidActionNames);
        }
        private string FindCQActionDefName(
            OAdEntityDef entityDef,
            int actionType)
        {
            // find the MODIFY action def name to open the record
            object[] actionDefNames       = CQWrapper.GetActionDefNames(entityDef) as object[];
            string[] modifyActionDefNames = CQUtilityMethods.FindActionNameByType(entityDef, actionDefNames, actionType);

            if (modifyActionDefNames.Length == 0)
            {
                // [teyang] todo error handling
                throw new InvalidOperationException();
            }
            else if (modifyActionDefNames.Length > 1)
            {
                // [teyang] todo error handling
                throw new InvalidOperationException();
            }
            else
            {
                return(modifyActionDefNames[0]);
            }
        }