public WorkFlowNodeStatus GetWorkFlowNodeStatus(Enum enumItem)
        {
            Type      e     = enumItem.GetType();
            FieldInfo field = e.GetField(enumItem.ToString());

            LabelAttribute[] laberAttrs = (LabelAttribute[])field.GetCustomAttributes(typeof(LabelAttribute), false);
            if (laberAttrs.Length > 0)
            {
                var result = new WorkFlowNodeStatus()
                {
                    Label = laberAttrs.First().Label,
                    Value = enumItem.ToString()
                };
                return(result);
            }
            return(new WorkFlowNodeStatus());
        }
 public static WorkFlowNodeStatus ToNodeState(this Enum enumItem)
 {
     try
     {
         Type             e          = enumItem.GetType();
         FieldInfo        field      = e.GetField(enumItem.ToString());
         LabelAttribute[] laberAttrs = (LabelAttribute[])field.GetCustomAttributes(typeof(LabelAttribute), false);
         if (laberAttrs.Length > 0)
         {
             var result = new WorkFlowNodeStatus()
             {
                 Label = laberAttrs.First().Label,
                 Value = enumItem.ToString()
             };
             return(result);
         }
         throw new Exception("无法将此枚举项转化为工作流节点状态项,请参考节点处理器中的节点状态设置代码要求.");
     }
     catch (Exception ex)
     {
         throw new Exception("无法将此枚举项转化为工作流节点状态项,发现异常.", ex);
     }
 }