Exemple #1
0
 public WSFieldSchema(MetaFunctions _Func, WSTableParam _param, WSJProperty _Json, WSEntitySchema _Parent) : base(_Func, _Parent)
 {
     param = _param;
     if (_Json != null)
     {
         Name = _Json.Key;
         IOBaseOptions.Save(_Json.Value);
     }
 }
        private void proceedFieldFilter(WSJValue jField, ref WSFieldFilters filters)
        {
            bool replace = true;
            List <WSMemberSchema> schemas = readFieldSchema(jField, out replace);

            if (schemas != null && schemas.Any())
            {
                foreach (WSMemberSchema schema in schemas)
                {
                    saveFieldSchema(schema, replace, ref filters);
                }
            }
            else
            {
                IOBaseOptions.Save(jField);
            }
        }
        private void proceedFieldFilter(WSJProperty jField, ref WSFieldFilters filters)
        {
            bool replace = true;
            List <WSMemberSchema> schemas = readFieldSchema(jField, out replace);

            if (schemas.Any())
            {
                foreach (WSMemberSchema schema in schemas)
                {
                    saveFieldSchema(schema, replace, ref filters);
                }
            }
            else
            {
                IOBaseOptions.Save(new WSJObject(new List <WSJProperty> {
                    jField
                }));
            }
        }
 public WSEntityListSchema(WSTableParam _Param, WSJProperty _Json, MetaFunctions _Func, WSEntitySchema _Parent) : base(_Func, _Parent)
 {
     Param = _Param;
     if (_Json != null && !_Json.IsEmpty)
     {
         if (WSEntityFilter.OPERATIONS.STATE_OPERATIONS.Any(x => x.Match(_Json.Key)))
         {
             IOBaseOptions.Save(new WSJObject(new List <WSJProperty>()
             {
                 _Json
             }));
         }
         else if (_Json.Value != null)
         {
             if (_Json.Value is WSJArray)
             {
                 WSJArray arr  = (WSJArray)_Json.Value;
                 WSJArray temp = new WSJArray();
                 foreach (WSJson item in arr.Value)
                 {
                     if (item is WSJValue && WSEntityFilter.OPERATIONS.STATE_OPERATIONS.Any(x => x.Match(((WSJValue)item).Value)))
                     {
                         IOBaseOptions.Save(item);
                     }
                     else
                     {
                         temp.Value.Add(item);
                     }
                 }
                 _Json.Value = temp;
             }
             else if (_Json.Value is WSJObject)
             {
                 WSJObject          obj       = (WSJObject)_Json.Value;
                 List <WSJProperty> tempItems = new List <WSJProperty>();
                 WSJObject          temp      = new WSJObject(tempItems);
                 WSJObject          baseLocal = new WSJObject(tempItems);
                 foreach (WSJProperty item in obj.Value)
                 {
                     if (WSEntityFilter.OPERATIONS.STATE_OPERATIONS.Any(x => x.Match(item.Key)))
                     {
                         baseLocal.Value.Add(item);
                     }
                     else if (item.Value is WSJValue && WSEntityFilter.OPERATIONS.STATE_OPERATIONS.Any(x => x.Match(((WSJValue)item.Value).Value)))
                     {
                         baseLocal.Value.Add(item);
                     }
                     else if (item.Value is WSJArray && !item.Value.IsEmpty && !((WSJArray)item.Value).Value.Any(v => !(v is WSJValue) || !WSEntityFilter.OPERATIONS.STATE_OPERATIONS.Any(x => x.Match(((WSJValue)v).Value))))
                     {
                         baseLocal.Value.Add(item);
                     }
                     else if (item.Value is WSJObject && !item.Value.IsEmpty && !((WSJObject)item.Value).Value.Any(p => !(p.Value is WSJValue) || !WSEntityFilter.OPERATIONS.STATE_OPERATIONS.Any(x => x.Match(((WSJValue)p.Value).Value))))
                     {
                         baseLocal.Value.Add(item);
                     }
                     else
                     {
                         temp.Value.Add(item);
                     }
                 }
                 _Json.Value = temp;
                 if (!baseLocal.IsEmpty)
                 {
                     IOBaseOptions.Save(baseLocal);
                 }
             }
         }
     }
     if (Param != null)
     {
         EntitySchema = new WSEntitySchema((WSTableSource)Func.GetSourceByType(Param.DataType.GetEntityType()), _Json, Func, Parent);
         if (EntitySchema != null)
         {
             Name = EntitySchema.Name;
         }
     }
 }