internal static Workshare.PolicyContent.ActionProperty GetActionProperty(IActionPropertyResponse apr) { if (null == apr) throw new ArgumentNullException("apr"); Workshare.PolicyContent.ActionProperty actionProperty = new Workshare.PolicyContent.ActionProperty(); actionProperty.Name = apr.Name; actionProperty.Value = apr.Value; actionProperty.Type = apr.Type; actionProperty.Override = apr.Override; actionProperty.ReadOnly = apr.ReadOnly; actionProperty.Visible = apr.Visible; List<CustomProperty> props = new List<CustomProperty>(); foreach (string key in apr.Properties.Keys) { props.Add(new CustomProperty(key, apr.Properties[key])); } actionProperty.Properties = props.ToArray(); return actionProperty; }
static ActionEvent[] CreateEvents(string type, string id, ActionProperty[] properties) { var events = new List<ActionEvent>(); foreach (var property in properties) { var risk = GetElementRiskRating(type, property.Name); if (String.IsNullOrEmpty(risk)) { continue; } try { if(!ExcludePropery(property.Name, properties)) { events.Add(CreateEvent( Convert.ToBoolean(property.Value) ? "ActionApplied" : "ActionNotApplied", String.Format("{0} - {1}", type, property.Name), risk, id)); } } catch (FormatException ex) { Logger.LogError(ex); } } return events.ToArray(); }
static bool ExcludePropery(string name, ActionProperty[] properties) { if (String.Compare(name, "Footnotes", true) == 0) { ActionProperty property = Array.Find(properties, e => e.Name == "HandleFootnotesHiddenData"); if(property != null && !Convert.ToBoolean(property.Value)) { return true; } } return false; }