Пример #1
0
        public SOARolePropertyDefinitionCollection LoadByRoleID(string roleID)
        {
            roleID.CheckStringIsNullOrEmpty("roleID");

            string sql = string.Format("SELECT * FROM WF.ROLE_PROPERTIES_DEFINITIONS WHERE {0} ORDER BY SORT_ORDER",
                                       roleID.ToRoleIDCriteria());

            using (TransactionScope scope = TransactionScopeFactory.Create(TransactionScopeOption.Suppress))
            {
                DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0];

                SOARolePropertyDefinitionCollection result = new SOARolePropertyDefinitionCollection();

                foreach (DataRow row in table.Rows)
                {
                    SOARolePropertyDefinition property = new SOARolePropertyDefinition();

                    ORMapping.DataRowToObject(row, property);

                    result.Add(property);
                }

                return(result);
            }
        }
Пример #2
0
        private static bool IsQueryableColumn(SOARolePropertyDefinition pd, SOARolePropertyDefinitionCollection propertyDefines)
        {
            bool isReservered = true;

            switch (propertyDefines.MatrixType)
            {
            case WfMatrixType.RoleMatrix:
                isReservered = SOARolePropertyDefinition.IsRoleMatrixReservedPropertyName(pd.Name);
                break;

            case WfMatrixType.ActivityMatrix:
                isReservered = SOARolePropertyDefinition.IsActivityMatrixReservedPropertyName(pd.Name);
                break;
            }

            return(isReservered == false);
        }
Пример #3
0
        /// <summary>
        /// 从上下文和流程中得到值
        /// </summary>
        /// <param name="pd"></param>
        /// <param name="process"></param>
        /// <returns></returns>
        private static object GetQueryValueFromContext(SOARolePropertyDefinition pd, IWfProcess process)
        {
            WfApplicationParametersContext apContext = WfApplicationParametersContext.Current;

            object arpValue = null;

            if (apContext != null)
            {
                arpValue = apContext.ApplicationRuntimeParameters.GetValue(pd.Name, (string)null);
            }

            if (arpValue == null && process != null)
            {
                arpValue = process.ApplicationRuntimeParameters.GetValueRecursively(pd.Name, (string)null);
            }

            return(arpValue);
        }
Пример #4
0
        private static SOARolePropertiesQueryParamCollection CreateQueryParams(SOARolePropertyDefinitionCollection propertyDefines, IWfProcess process)
        {
            SOARolePropertiesQueryParamCollection queryParams = new SOARolePropertiesQueryParamCollection();

            WfApplicationParametersContext apContext = WfApplicationParametersContext.Current;

            //如果是审批矩阵,只取第一列作为条件
            if (propertyDefines.MatrixType == WfMatrixType.ApprovalMatrix)
            {
                if (propertyDefines.Count > 0)
                {
                    SOARolePropertyDefinition pd = propertyDefines[0];

                    object arpValue = GetQueryValueFromContext(pd, process);

                    queryParams.Add(new SOARolePropertiesQueryParam()
                    {
                        QueryName  = pd.Name,
                        QueryValue = arpValue
                    });
                }
            }
            else
            {
                //活动矩阵和角色矩阵,排除保留字
                foreach (SOARolePropertyDefinition pd in propertyDefines)
                {
                    //是否是可查询的列
                    if (IsQueryableColumn(pd, propertyDefines))
                    {
                        object arpValue = GetQueryValueFromContext(pd, process);

                        queryParams.Add(new SOARolePropertiesQueryParam()
                        {
                            QueryName  = pd.Name,
                            QueryValue = arpValue
                        });
                    }
                }
            }

            return(queryParams);
        }