Esempio n. 1
0
        } // _getVbProperties()

        /// <summary>
        /// Returns the JSON for a Vb prop
        /// </summary>
        private void _getVbPropData(JObject ParentObj, CswViewBuilderProp ViewBuilderProp)
        {
            if (null != ViewBuilderProp && ViewBuilderProp.FieldTypeRule.SearchAllowed)
            {
                CswNbtSubFieldColl SubFields = ViewBuilderProp.FieldTypeRule.SubFields;

                ParentObj["ownername"]         = ViewBuilderProp.OwnerName;
                ParentObj["propname"]          = ViewBuilderProp.MetaDataPropName;
                ParentObj["viewbuilderpropid"] = ViewBuilderProp.MetaDataPropId.ToString();
                ParentObj["relatedidtype"]     = ViewBuilderProp.RelatedIdType.ToString();
                ParentObj["proptype"]          = ViewBuilderProp.Type.ToString();
                ParentObj["metadatatypename"]  = ViewBuilderProp.MetaDataTypeName;
                ParentObj["fieldtype"]         = ViewBuilderProp.FieldType.ToString();
                if (ViewBuilderProp.ViewProp != null)
                {
                    ParentObj["proparbitraryid"] = ViewBuilderProp.ViewProp.ArbitraryId;
                }
                string FiltArbitraryId = string.Empty;
                if (ViewBuilderProp.Filters.Count > 0)
                {
                    CswNbtViewPropertyFilter Filt = (CswNbtViewPropertyFilter)ViewBuilderProp.Filters[0];
                    FiltArbitraryId = Filt.ArbitraryId;
                }
                ParentObj["filtarbitraryid"]    = FiltArbitraryId;
                ParentObj["defaultconjunction"] = CswEnumNbtFilterConjunction.And.ToString();
                ParentObj["defaultsubfield"]    = ViewBuilderProp.FieldTypeRule.SubFields.Default.Name.ToString();
                ParentObj["defaultfiltermode"]  = ViewBuilderProp.FieldTypeRule.SubFields.Default.DefaultFilterMode.ToString();
                ParentObj["helptext"]           = ViewBuilderProp.FieldTypeRule.getHelpText();

                ParentObj["subfields"] = new JObject();

                foreach (CswNbtSubField Field in SubFields)
                {
                    string OptName = Field.Name.ToString();
                    ParentObj["subfields"][OptName]           = new JObject();
                    ParentObj["subfields"][OptName]["column"] = Field.Column.ToString();
                    ParentObj["subfields"][OptName]["name"]   = OptName;
                    JObject FiltersObj = new JObject();
                    ParentObj["subfields"][OptName]["filtermodes"] = FiltersObj;

                    _addSubFieldFilterModes(FiltersObj, Field);
                }

                addVbPropFilters(ParentObj, ViewBuilderProp);

                if (ViewBuilderProp.FieldType == CswEnumNbtFieldType.List)
                {
                    ParentObj["filtersoptions"]         = new JObject();
                    ParentObj["filtersoptions"]["name"] = ViewBuilderProp.MetaDataPropName;
                    if (ViewBuilderProp.ListOptions.Count() > 0)
                    {
                        ParentObj["filtersoptions"]["selected"] = ViewBuilderProp.ListOptions.First();
                        ParentObj["filtersoptions"]["options"]  = _getListPropFilterOptions(ViewBuilderProp);
                    }
                }
            }
        } // _getVbPropData()
Esempio n. 2
0
        } // _addSubFieldFilterModes()

        /// <summary>
        /// Returns the List Options as JSON
        /// </summary>
        private JObject _getListPropFilterOptions(CswViewBuilderProp ViewBuilderProp)
        {
            JObject FilterOptions = new JObject();

            foreach (string Value in ViewBuilderProp.ListOptions)
            {
                FilterOptions[Value] = Value;
            }
            return(FilterOptions);
        } // _getListPropFilterOptions()
Esempio n. 3
0
        /// <summary>
        /// Returns all prop filters for a CswNbtViewProperty
        /// </summary>
        public void addVbPropFilters(JObject ParentObj, CswViewBuilderProp ViewBuilderProp)
        {
            if (null != ViewBuilderProp)
            {
                JObject PropFilters = new JObject();
                ParentObj["propfilters"] = PropFilters;

                Collection <CswNbtViewPropertyFilter> Filters = ViewBuilderProp.Filters;
                foreach (CswNbtViewPropertyFilter Filter in Filters)
                {
                    _addVbPropFilter(PropFilters, Filter);
                }
            }
        }
Esempio n. 4
0
        public JObject getVbProp(CswNbtView View, CswViewBuilderProp VbProp)
        {
            JObject Ret = new JObject();

            if (null != VbProp)
            {
                CswEnumNbtViewRelatedIdType Relationship = VbProp.RelatedIdType;
                Int32 NodeTypeOrObjectClassId            = VbProp.MetaDataPropId;
                if (Int32.MinValue != NodeTypeOrObjectClassId && CswEnumNbtViewRelatedIdType.Unknown != Relationship)
                {
                    _getVbPropData(Ret, VbProp);
                }
            }
            return(Ret);
        }
Esempio n. 5
0
        public JObject getVbProp(CswNbtView View, string ViewPropArbitraryId)
        {
            JObject Ret = new JObject();

            if (false == string.IsNullOrEmpty(ViewPropArbitraryId))
            {
                CswNbtViewProperty ThisProp = (CswNbtViewProperty)View.FindViewNodeByArbitraryId(ViewPropArbitraryId);
                if (null != ThisProp)
                {
                    CswViewBuilderProp VbProp = new CswViewBuilderProp(ThisProp);
                    Ret = getVbProp(View, VbProp);
                }
            }
            return(Ret);
        }
Esempio n. 6
0
        ///// <summary>
        ///// Returns all props and prop filters for a NodeType or ObjectClass
        ///// </summary>
        //public JObject getVbProperties( string RelatedIdTypeStr, string NodeTypeOrObjectClassId, string NodeKey )
        //{
        //    JObject ViewBuilderProps = new JObject();
        //    if( ( !string.IsNullOrEmpty( RelatedIdTypeStr ) && !string.IsNullOrEmpty( NodeTypeOrObjectClassId ) ) || !string.IsNullOrEmpty( NodeKey ) )
        //    {
        //        Int32 TypeOrObjectClassId = Int32.MinValue;
        //        NbtViewRelatedIdType Relationship = NbtViewRelatedIdType.Unknown;
        //        if( string.IsNullOrEmpty( NodeTypeOrObjectClassId ) && !string.IsNullOrEmpty( NodeKey ) )
        //        {
        //            CswNbtNodeKey NbtNodeKey = new CswNbtNodeKey( _CswNbtResources, NodeKey );
        //            CswNbtNode Node = _CswNbtResources.Nodes[NbtNodeKey];
        //            if( null != Node.getNodeType() )
        //            {
        //                TypeOrObjectClassId = Node.NodeTypeId;
        //                Relationship = NbtViewRelatedIdType.NodeTypeId;
        //            }
        //            else if( null != Node.getObjectClass() )
        //            {
        //                TypeOrObjectClassId = Node.getObjectClassId();
        //                Relationship = NbtViewRelatedIdType.ObjectClassId;
        //            }
        //        }
        //        else if( false == string.IsNullOrEmpty( NodeTypeOrObjectClassId ) )
        //        {
        //            TypeOrObjectClassId = CswConvert.ToInt32( NodeTypeOrObjectClassId );
        //            Relationship = (NbtViewRelatedIdType) RelatedIdTypeStr;
        //            //NbtViewRelatedIdType.TryParse( RelatedIdTypeStr, true, out Relationship );
        //        }
        //        ViewBuilderProps = _getVbProperties( Relationship, TypeOrObjectClassId );
        //    }
        //    return ViewBuilderProps;
        //}

        private void _getVbPropertiesRecursive(IEnumerable <CswNbtViewRelationship> Relationships, JObject PropObject)
        {
            foreach (CswNbtViewRelationship Relationship in Relationships)
            {
                foreach (CswNbtViewProperty ViewProperty in Relationship.Properties)
                {
                    CswViewBuilderProp VbProp   = new CswViewBuilderProp(ViewProperty);
                    JObject            ThisProp = new JObject();
                    PropObject[VbProp.ViewProp.ArbitraryId] = ThisProp;
                    _getVbPropData(ThisProp, VbProp);
                }
                if (Relationship.ChildRelationships.Count > 0)
                {
                    _getVbPropertiesRecursive(Relationship.ChildRelationships, PropObject);
                }
            }
        }