Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 

100 rindas
3.7 KiB

  1. using HBLConsole.Model;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace HBLConsole.Attributes
  8. {
  9. [AttributeUsage(AttributeTargets.Property)]
  10. public class CircuitAttribute : Attribute
  11. {
  12. /// <summary>
  13. /// 流程属性特性
  14. /// </summary>
  15. /// <param name="classification">字符串数组格式,属于哪一个业务流程</param>
  16. /// <param name="propertyIllustrate">属性说明</param>
  17. /// <param name="isNot">布尔数组,是否对结果取反</param>
  18. public CircuitAttribute(string[] classification, string propertyIllustrate, bool[] isNot)
  19. {
  20. Classifiaction = classification;
  21. PropertyIllustrate = propertyIllustrate;
  22. int index = -1;
  23. foreach (var item in classification)
  24. {
  25. index++;
  26. if (!ProcessData.GetInstance.Conditions.ContainsKey(item))
  27. {
  28. ProcessData.GetInstance.Conditions.TryAdd(item, new List<Condition>());
  29. }
  30. if (ProcessData.GetInstance.Conditions[item].FirstOrDefault(p => p.propertyIllustrate == propertyIllustrate) == null)
  31. {
  32. ProcessData.GetInstance.Conditions[item].Add(new Condition() { propertyIllustrate = propertyIllustrate, IsNot = isNot[index] });
  33. }
  34. }
  35. }
  36. /// <summary>
  37. /// 流程属性特性
  38. /// </summary>
  39. /// <param name="classification">字符串数组格式,属于哪一个业务流程</param>
  40. /// <param name="propertyIllustrate">属性说明</param>
  41. public CircuitAttribute(string[] classification, string propertyIllustrate)
  42. {
  43. Classifiaction = classification;
  44. PropertyIllustrate = propertyIllustrate;
  45. foreach (var item in classification)
  46. {
  47. if (!ProcessData.GetInstance.Conditions.ContainsKey(item))
  48. {
  49. ProcessData.GetInstance.Conditions.TryAdd(item, new List<Condition>());
  50. }
  51. if (ProcessData.GetInstance.Conditions[item].FirstOrDefault(p => p.propertyIllustrate == propertyIllustrate) == null)
  52. {
  53. ProcessData.GetInstance.Conditions[item].Add(new Condition() { propertyIllustrate = propertyIllustrate });
  54. }
  55. }
  56. }
  57. /// <summary>
  58. /// 流程属性特性
  59. /// </summary>
  60. /// <param name="classification">业务流程名称</param>
  61. /// <param name="propertyIllustrate">属性说明</param>
  62. /// <param name="isNot">是否对结果取反</param>
  63. public CircuitAttribute(string classification, string propertyIllustrate, bool isNot = false)
  64. {
  65. Classifiaction = new string[1] { classification };
  66. PropertyIllustrate = propertyIllustrate;
  67. if (!ProcessData.GetInstance.Conditions.ContainsKey(classification))
  68. {
  69. ProcessData.GetInstance.Conditions.TryAdd(classification, new List<Condition>());
  70. }
  71. if (ProcessData.GetInstance.Conditions[classification].FirstOrDefault(p => p.propertyIllustrate == propertyIllustrate) == null)
  72. {
  73. ProcessData.GetInstance.Conditions[classification].Add(new Condition() { propertyIllustrate = propertyIllustrate, IsNot = isNot });
  74. }
  75. }
  76. /// <summary>
  77. /// 分类主题集合
  78. /// </summary>
  79. public string[] Classifiaction { get; set; } = new string[0];
  80. /// <summary>
  81. /// 属性说明
  82. /// </summary>
  83. public string PropertyIllustrate { get; set; }
  84. }
  85. }