|
- using HBLConsole.Model;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace HBLConsole.Attributes
- {
- [AttributeUsage(AttributeTargets.Property)]
- public class CircuitAttribute : Attribute
- {
- /// <summary>
- /// 流程属性特性
- /// </summary>
- /// <param name="classification">字符串数组格式,属于哪一个业务流程</param>
- /// <param name="propertyIllustrate">属性说明</param>
- /// <param name="isNot">布尔数组,是否对结果取反</param>
- public CircuitAttribute(string[] classification, string propertyIllustrate, bool[] isNot)
- {
- Classifiaction = classification;
- PropertyIllustrate = propertyIllustrate;
- int index = -1;
- foreach (var item in classification)
- {
- index++;
- if (!ProcessData.GetInstance.Conditions.ContainsKey(item))
- {
- ProcessData.GetInstance.Conditions.TryAdd(item, new List<Condition>());
- }
- if (ProcessData.GetInstance.Conditions[item].FirstOrDefault(p => p.propertyIllustrate == propertyIllustrate) == null)
- {
- ProcessData.GetInstance.Conditions[item].Add(new Condition() { propertyIllustrate = propertyIllustrate, IsNot = isNot[index] });
- }
-
-
- }
- }
-
- /// <summary>
- /// 流程属性特性
- /// </summary>
- /// <param name="classification">字符串数组格式,属于哪一个业务流程</param>
- /// <param name="propertyIllustrate">属性说明</param>
- public CircuitAttribute(string[] classification, string propertyIllustrate)
- {
- Classifiaction = classification;
- PropertyIllustrate = propertyIllustrate;
- foreach (var item in classification)
- {
- if (!ProcessData.GetInstance.Conditions.ContainsKey(item))
- {
- ProcessData.GetInstance.Conditions.TryAdd(item, new List<Condition>());
- }
- if (ProcessData.GetInstance.Conditions[item].FirstOrDefault(p => p.propertyIllustrate == propertyIllustrate) == null)
- {
- ProcessData.GetInstance.Conditions[item].Add(new Condition() { propertyIllustrate = propertyIllustrate });
- }
- }
- }
-
- /// <summary>
- /// 流程属性特性
- /// </summary>
- /// <param name="classification">业务流程名称</param>
- /// <param name="propertyIllustrate">属性说明</param>
- /// <param name="isNot">是否对结果取反</param>
- public CircuitAttribute(string classification, string propertyIllustrate, bool isNot = false)
- {
- Classifiaction = new string[1] { classification };
- PropertyIllustrate = propertyIllustrate;
- if (!ProcessData.GetInstance.Conditions.ContainsKey(classification))
- {
- ProcessData.GetInstance.Conditions.TryAdd(classification, new List<Condition>());
- }
- if (ProcessData.GetInstance.Conditions[classification].FirstOrDefault(p => p.propertyIllustrate == propertyIllustrate) == null)
- {
- ProcessData.GetInstance.Conditions[classification].Add(new Condition() { propertyIllustrate = propertyIllustrate, IsNot = isNot });
- }
- }
-
- /// <summary>
- /// 分类主题集合
- /// </summary>
- public string[] Classifiaction { get; set; } = new string[0];
-
- /// <summary>
- /// 属性说明
- /// </summary>
- public string PropertyIllustrate { get; set; }
-
-
- }
-
-
-
-
-
- }
|