Пример #1
0
        public static SOARoleContext CreateContext(SOARolePropertyDefinitionCollection propertyDefines, IWfProcess process)
        {
            propertyDefines.NullCheck("propertyDefines");

            SOARolePropertiesQueryParamCollection queryParams = CreateQueryParams(propertyDefines, process);

            SOARoleContext context = SOARoleContext.CreateContext(queryParams, process);

            context.PropertyDefinitions = propertyDefines;

            return(context);
        }
Пример #2
0
        /// <summary>
        /// 创建一个新的上下文,并且使用它进行计算。计算完成后恢复上下文。
        /// </summary>
        /// <param name="role"></param>
        /// <param name="process"></param>
        /// <param name="action"></param>
        public static void DoNewContextAction(IRole role, IWfProcess process, Action <SOARoleContext> action)
        {
            if (action != null)
            {
                SOARoleContext originalRoleContext = SOARoleContext.Current;

                try
                {
                    SOARoleContext.Current = null;
                    SOARoleContext.CreateContext(role, process);

                    action(SOARoleContext.Current);
                }
                finally
                {
                    SOARoleContext.Current = originalRoleContext;
                }
            }
        }
Пример #3
0
        /// <summary>
        /// 创建一个新的上下文,并且使用它进行计算。计算完成后恢复上下文。
        /// </summary>
        /// <param name="propertyDefines"></param>
        /// <param name="process"></param>
        /// <param name="action"></param>
        public static void DoNewContextAction(SOARolePropertyDefinitionCollection propertyDefines, IWfProcess process, Action <SOARoleContext> action)
        {
            if (action != null)
            {
                SOARoleContext originalRoleContext = SOARoleContext.Current;

                try
                {
                    SOARoleContext.Current = null;
                    SOARoleContext.CreateContext(propertyDefines, process);

                    action(SOARoleContext.Current);
                }
                finally
                {
                    SOARoleContext.Current = originalRoleContext;
                }
            }
        }
Пример #4
0
        /// <summary>
        /// 展开内部角色的行
        /// </summary>
        /// <param name="innerRole"></param>
        /// <param name="extractedRows"></param>
        /// <returns></returns>
        private bool ExtractSOARoleRows(SOARole innerRole, SOARolePropertyRowCollection extractedRows)
        {
            bool extracted = false;

            if (innerRole.PropertyDefinitions.Count > 0)
            {
                SOARoleContext originalContext = SOARoleContext.Current;
                SOARoleContext.Current = null;
                try
                {
                    using (SOARoleContext innerContext = SOARoleContext.CreateContext(innerRole, originalContext.Process))
                    {
                        extracted = this.ExtractSOARoleMatrixRows(innerRole, extractedRows);
                    }
                }
                finally
                {
                    SOARoleContext.Current = originalContext;
                }
            }

            return(extracted);
        }