/// <summary> /// Fetches the requested event fields from the event. /// </summary> private HistoryEventFieldList GetEventFields(HistoryReadRequest request, IFilterTarget instance) { // fetch the event fields. HistoryEventFieldList fields = new HistoryEventFieldList(); foreach (SimpleAttributeOperand clause in request.Filter.SelectClauses) { // get the value of the attribute (apply localization). object value = instance.GetAttributeValue( request.FilterContext, clause.TypeDefinitionId, clause.BrowsePath, clause.AttributeId, clause.ParsedIndexRange); // add the value to the list of event fields. if (value != null) { // translate any localized text. LocalizedText text = value as LocalizedText; if (text != null) { value = Server.ResourceManager.Translate(request.FilterContext.PreferredLocales, text); } // add value. fields.EventFields.Add(new Variant(value)); } // add a dummy entry for missing values. else { fields.EventFields.Add(Variant.Null); } } return(fields); }
/// <summary> /// Fetches the requested event fields from the event. /// </summary> private HistoryEventFieldList GetEventFields(HistoryReadRequest request, IFilterTarget instance) { // fetch the event fields. HistoryEventFieldList fields = new HistoryEventFieldList(); foreach (SimpleAttributeOperand clause in request.Filter.SelectClauses) { // get the value of the attribute (apply localization). object value = instance.GetAttributeValue( request.FilterContext, clause.TypeDefinitionId, clause.BrowsePath, clause.AttributeId, clause.ParsedIndexRange); // add the value to the list of event fields. if (value != null) { // translate any localized text. LocalizedText text = value as LocalizedText; if (text != null) { value = Server.ResourceManager.Translate(request.FilterContext.PreferredLocales, text); } // add value. fields.EventFields.Add(new Variant(value)); } // add a dummy entry for missing values. else { fields.EventFields.Add(Variant.Null); } } return fields; }