Esempio n. 1
0
        /// <inheritdoc />
        public TRuleInfo(XmlNode node)
        {
            if (node != null)
            {
                RuleID     = Extensions.GetNodeInnerText(node.GetSingleNode(ClassHelper.GetMemberName(() => RuleID)));
                Title      = Extensions.GetNodeInnerText(node.GetSingleNode(ClassHelper.GetMemberName(() => Title)));
                Active     = Extensions.GetNodeInnerTextAsBool(node.GetSingleNode(ClassHelper.GetMemberName(() => Active)));
                ActionType = (TRuleMessageActionType)Extensions.GetNodeInnerTextAsInt(node.GetSingleNode(ClassHelper.GetMemberName(() => ActionType)));

                var condition = node.GetSingleNode(ClassHelper.GetMemberName(() => Condition));
                if (condition != null)
                {
                    var className = Extensions.GetNodeInnerText(condition.GetSingleNode(XmlHelper.ClassNameTag));
                    if (!String.IsNullOrEmpty(className))
                    {
                        var classType = ClassHelper.TRuleConditionClasses()
                                        .FirstOrDefault(x => x.ClassName.ToLower() == className.ToLower());
                        if (classType != null)
                        {
                            Condition = (TRuleCondition)ClassHelper.GetInstance(classType.AssemblyQualifiedName, new[] { condition });
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        /// <inheritdoc />
        public TPropertyInfo(XmlNode node)
        {
            if (node != null)
            {
                APIProperty = new TAPIProperty(node.GetSingleNode(ClassHelper.GetMemberName(() => APIProperty)));

                var propertyVal = node.GetSingleNode(ClassHelper.GetMemberName(() => PropertyVal));
                if (propertyVal != null)
                {
                    var className = Extensions.GetNodeInnerText(propertyVal.GetSingleNode(XmlHelper.ClassNameTag));
                    if (!String.IsNullOrEmpty(className))
                    {
                        var classType = ClassHelper.TPropertyValClasses()
                                        .FirstOrDefault(x => x.ClassName.ToLower() == className.ToLower());
                        if (classType != null)
                        {
                            PropertyVal = (TPropertyVal)ClassHelper.GetInstance(classType.AssemblyQualifiedName, new[] { propertyVal });
                        }
                    }
                }

                PropertyRight      = (TPermission)Extensions.GetNodeInnerTextAsInt(node.GetSingleNode(ClassHelper.GetMemberName(() => PropertyRight)));
                PropertyEnumValues = new TPropertyEnumValues(node.GetSingleNode(ClassHelper.GetMemberName(() => PropertyEnumValues)));
                PropertyComment    = Extensions.GetNodeInnerText(node.GetSingleNode(ClassHelper.GetMemberName(() => PropertyComment)));
                PropertyGroup      = Extensions.GetNodeInnerText(node.GetSingleNode(ClassHelper.GetMemberName(() => PropertyGroup)));
                PropertyValueType  = (TPropertyValueType)Extensions.GetNodeInnerTextAsInt(node.GetSingleNode(ClassHelper.GetMemberName(() => PropertyValueType)));
            }
        }
Esempio n. 3
0
 /// <inheritdoc />
 public override void ProcessResultNode(XmlNode node)
 {
     if (node != null)
     {
         var className = Extensions.GetNodeInnerText(node.GetSingleNode(XmlHelper.ClassNameTag));
         if (!String.IsNullOrEmpty(className))
         {
             var classType = ClassHelper.TServiceStatisticsClasses()
                             .FirstOrDefault(x => x.ClassName.ToLower() == className.ToLower());
             if (classType != null)
             {
                 Statistics = (TServiceStatistics)ClassHelper.GetInstance(classType.AssemblyQualifiedName);
             }
         }
     }
 }
Esempio n. 4
0
 /// <inheritdoc />
 public TRuleActions(XmlNode node)
 {
     Items = new List <TRuleAction>();
     if (node != null)
     {
         var items = node.GetNodes(XmlHelper.ItemTag);
         foreach (XmlNode item in items)
         {
             var className = Extensions.GetNodeInnerText(item.GetSingleNode(XmlHelper.ClassNameTag));
             if (!String.IsNullOrEmpty(className))
             {
                 var classType = ClassHelper.TRuleActionClasses()
                                 .FirstOrDefault(x => x.ClassName.ToLower() == className.ToLower());
                 if (classType != null)
                 {
                     Items.Add((TRuleAction)ClassHelper.GetInstance(classType.AssemblyQualifiedName, new[] { item }));
                 }
             }
         }
     }
 }