public DynamicExpression(XPathNavigator expression, XmlNamespaceManager nm)
        {
            XPathNavigator scope  = expression.SelectSingleNode("parent::c:*", nm);
            XPathNavigator target = expression.SelectSingleNode("parent::c:*/parent::c:*", nm);

            if (scope.LocalName == "validate")
            {
                _scope  = DynamicExpressionScope.Field;
                _target = target.GetAttribute("name", String.Empty);
            }
            else
            if (scope.LocalName == "styles")
            {
                _scope  = DynamicExpressionScope.ViewRowStyle;
                _target = target.GetAttribute("id", String.Empty);
            }
            else
            if (scope.LocalName == "visibility")
            {
                // determine the scope and target of visibility
                if (target.LocalName == "field")
                {
                    _scope  = DynamicExpressionScope.DataFieldVisibility;
                    _target = target.GetAttribute("name", String.Empty);
                }
                else
                if (target.LocalName == "dataField")
                {
                    _scope  = DynamicExpressionScope.DataFieldVisibility;
                    _target = target.GetAttribute("fieldName", String.Empty);
                }
                else
                if (target.LocalName == "category")
                {
                    _scope  = DynamicExpressionScope.CategoryVisibility;
                    _target = target.GetAttribute("id", String.Empty);
                }
            }
            else
            if (scope.LocalName == "defaultValues")
            {
                // determine the scope and target of default values
                if (target.LocalName == "field")
                {
                    _scope  = DynamicExpressionScope.DataFieldVisibility;
                    _target = target.GetAttribute("name", String.Empty);
                }
                else
                if (target.LocalName == "dataField")
                {
                    _scope  = DynamicExpressionScope.DataFieldVisibility;
                    _target = target.GetAttribute("fieldName", String.Empty);
                }
            }
            else
            if (scope.LocalName == "readOnly")
            {
                // determine the scope and target of read-only expression
                if (target.LocalName == "field")
                {
                    _scope  = DynamicExpressionScope.ReadOnly;
                    _target = target.GetAttribute("name", String.Empty);
                }
                else
                if (target.LocalName == "dataField")
                {
                    _scope  = DynamicExpressionScope.ReadOnly;
                    _target = target.GetAttribute("fieldName", String.Empty);
                }
            }
            string expressionType = expression.GetAttribute("type", String.Empty);

            if (String.IsNullOrEmpty(expressionType))
            {
                expressionType = "ClientScript";
            }
            _type   = ((DynamicExpressionType)(TypeDescriptor.GetConverter(typeof(DynamicExpressionType)).ConvertFromString(expressionType)));
            _test   = expression.GetAttribute("test", String.Empty);
            _result = expression.GetAttribute("result", String.Empty);
            if (_result == String.Empty)
            {
                _result = null;
            }
            _viewId = ((string)(expression.Evaluate("string(ancestor::c:view/@id)", nm)));
        }
Beispiel #2
0
 public DynamicExpression(XPathNavigator expression, XmlNamespaceManager nm)
 {
     XPathNavigator scope = expression.SelectSingleNode("parent::c:*", nm);
     XPathNavigator target = expression.SelectSingleNode("parent::c:*/parent::c:*", nm);
     if (scope.LocalName == "validate")
     {
         _scope = DynamicExpressionScope.Field;
         _target = target.GetAttribute("name", String.Empty);
     }
     else
         if (scope.LocalName == "styles")
         {
             _scope = DynamicExpressionScope.ViewRowStyle;
             _target = target.GetAttribute("id", String.Empty);
         }
         else
             if (scope.LocalName == "visibility")
             {
                 // determine the scope and target of visibility
                 if (target.LocalName == "field")
                 {
                     _scope = DynamicExpressionScope.DataFieldVisibility;
                     _target = target.GetAttribute("name", String.Empty);
                 }
                 else
                     if (target.LocalName == "dataField")
                     {
                         _scope = DynamicExpressionScope.DataFieldVisibility;
                         _target = target.GetAttribute("fieldName", String.Empty);
                     }
                     else
                         if (target.LocalName == "category")
                         {
                             _scope = DynamicExpressionScope.CategoryVisibility;
                             _target = target.GetAttribute("id", String.Empty);
                         }
             }
             else
                 if (scope.LocalName == "defaultValues")
                 {
                     // determine the scope and target of default values
                     if (target.LocalName == "field")
                     {
                         _scope = DynamicExpressionScope.DataFieldVisibility;
                         _target = target.GetAttribute("name", String.Empty);
                     }
                     else
                         if (target.LocalName == "dataField")
                         {
                             _scope = DynamicExpressionScope.DataFieldVisibility;
                             _target = target.GetAttribute("fieldName", String.Empty);
                         }
                 }
                 else
                     if (scope.LocalName == "readOnly")
                     {
                         // determine the scope and target of read-only expression
                         if (target.LocalName == "field")
                         {
                             _scope = DynamicExpressionScope.ReadOnly;
                             _target = target.GetAttribute("name", String.Empty);
                         }
                         else
                             if (target.LocalName == "dataField")
                             {
                                 _scope = DynamicExpressionScope.ReadOnly;
                                 _target = target.GetAttribute("fieldName", String.Empty);
                             }
                     }
     string expressionType = expression.GetAttribute("type", String.Empty);
     if (String.IsNullOrEmpty(expressionType))
         expressionType = "ClientScript";
     _type = ((DynamicExpressionType)(TypeDescriptor.GetConverter(typeof(DynamicExpressionType)).ConvertFromString(expressionType)));
     _test = expression.GetAttribute("test", String.Empty);
     _result = expression.GetAttribute("result", String.Empty);
     if (_result == String.Empty)
         _result = null;
     _viewId = ((string)(expression.Evaluate("string(ancestor::c:view/@id)", nm)));
 }