Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dirtyProperties"></param>
        public bool CheckDirty(DirtyProperties dirtyProperties)
        {
            Initialise();

            _id = dirtyProperties.Id;
            var failed = false;

            foreach (SimpleProperty prop in dirtyProperties.Properties)
            {
                string propValue = prop.Value?.ToString();

                // only continue if the prop has a value
                if (!propValue.HasValue())
                {
                    _hubContext.Clients.All.PreflightTest(new PreflightPropertyResponseModel
                    {
                        Name   = prop.Name,
                        Remove = true
                    });
                    continue;
                }

                failed = TestAndBroadcast(prop.Name, propValue, prop.Editor) || failed;
            }

            _hubContext.Clients.All.PreflightComplete();

            return(failed);
        }
Example #2
0
 public IHttpActionResult CheckDirty(DirtyProperties data)
 {
     try
     {
         return(Ok(new
         {
             status = HttpStatusCode.OK,
             failed = _contentChecker.CheckDirty(data)
         }));
     }
     catch (Exception ex)
     {
         return(Error(ex.Message));
     }
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="dirtyProperties"></param>
        public bool CheckDirty(DirtyProperties dirtyProperties)
        {
            _id       = dirtyProperties.Id;
            _settings = _settingsService.Get().Settings;

            var failed = false;

            foreach (SimpleProperty prop in dirtyProperties.Properties)
            {
                List <PreflightPropertyResponseModel> testResult = new List <PreflightPropertyResponseModel>();

                switch (prop.Editor)
                {
                case KnownPropertyAlias.Grid:
                    testResult = ExtractValuesFromSimpleProperty(prop, KnownStrings.RteJsonPath);
                    break;

                case KnownPropertyAlias.Archetype:
                    testResult = ExtractValuesFromSimpleProperty(prop, KnownStrings.ArchetypeRteJsonPath);
                    break;

                case KnownPropertyAlias.Rte:
                    testResult = RunPluginsAgainstValue(prop.Name, prop.Value).AsEnumerableOfOne().ToList();
                    break;
                }

                foreach (PreflightPropertyResponseModel result in testResult)
                {
                    if (result.Failed)
                    {
                        failed = true;
                    }
                    _hubContext.Clients.All.PreflightTest(result);
                }
            }

            return(failed);
        }