Exemplo n.º 1
0
        /// <summary>
        /// Retrieves a list of <see cref="IshField"/> using a filter.
        /// </summary>
        /// <param name="fieldName">The field name.</param>
        /// <param name="fieldLevel">The field level <see cref="Enumerations.Level"/>.</param>
        /// <param name="valueType">The value type <see cref="Enumerations.ValueType"/>.</param>
        /// <returns>An array of <see cref="IshField"/>.</returns>
        /// <remarks></remarks>
        public IshField[] Retrieve(string fieldName, Enumerations.Level fieldLevel, Enumerations.ValueType valueType)
        {
            List <IshField> returnFields = new List <IshField>();

            foreach (IshField ishField in _fields)
            {
                if ((ishField.Name == fieldName) && (ishField.Level == fieldLevel))
                {
                    if (ishField is IshMetadataField)
                    {
                        if (((IshMetadataField)ishField).ValueType == valueType)
                        {
                            returnFields.Add(ishField);
                        }
                    }
                    else if (ishField is IshMetadataFilterField)
                    {
                        if (((IshMetadataFilterField)ishField).ValueType == valueType)
                        {
                            returnFields.Add(ishField);
                        }
                    }
                    else
                    {
                        returnFields.Add(ishField);
                    }
                }
            }
            return(returnFields.ToArray());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the value for a field.
        /// </summary>
        /// <param name="fieldName">The fieldname to get the value from.</param>
        /// <param name="fieldLevel">The fieldlevel (<see cref="Enumerations.Level"/>).</param>
        /// <param name="valueType">The valuetype (<see cref="Enumerations.ValueType"/>).</param>
        /// <returns></returns>
        public string GetFieldValue(string fieldName, Enumerations.Level fieldLevel, Enumerations.ValueType valueType)
        {
            if (_fields == null)
            {
                throw new InvalidOperationException("No fields are set.");
            }

            IshField field      = RetrieveFirst(fieldName, fieldLevel, valueType);
            string   fieldValue = string.Empty;

            if (field != null)
            {
                var filterField = field.ToMetadataFilterField() as IshMetadataFilterField;
                if (filterField == null)
                {
                    throw new InvalidOperationException("field.ToMetadataFilterField() is not IshMetadataFilterField");
                }

                fieldValue = filterField.Value;
            }
            return(fieldValue);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Remove a field from the current list.
        /// </summary>
        /// <param name="fieldName">The name of the field.</param>
        /// <param name="fieldLevel">The level of the field (<see cref="Enumerations.Level"/>).</param>
        /// <param name="valueType">The type of the field (<see cref="Enumerations.ValueType"/>).</param>
        /// <returns>The current list of <see cref="IshFields"/>.</returns>
        public IshFields RemoveField(string fieldName, Enumerations.Level fieldLevel, Enumerations.ValueType valueType)
        {
            var compareField = new IshRequestedMetadataField(fieldName, fieldLevel, valueType);

            return(RemoveField(compareField));
        }
Exemplo n.º 4
0
 /// <summary>
 /// Retrieves the first occurance out of the list of matching IshFields
 /// </summary>
 /// <returns>The first <see cref="IshField"/> in the current list.</returns>
 public IshField RetrieveFirst(string fieldName, Enumerations.Level fieldLevel, Enumerations.ValueType valueType)
 {
     IshField[] ishFields = Retrieve(fieldName, fieldLevel, valueType);
     if ((ishFields != null) && (ishFields.Length > 0))
     {
         return(ishFields[0]);
     }
     return(null);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Constructs a Get/Requested IshField
 /// </summary>
 public IshMetadataField(string fieldName, Enumerations.Level fieldLevel, Enumerations.ValueType valueType, string value)
     : base(fieldName, fieldLevel, valueType)
 {
     _value = value;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Constructs a Set IshField
 /// </summary>
 public IshMetadataFilterField(string fieldName, Enumerations.Level fieldLevel, Enumerations.FilterOperator filterOperator, string value, Enumerations.ValueType valueType)
     : base(fieldName, fieldLevel, valueType)
 {
     _filterOperator = filterOperator;
     _value          = (value == null) ? "" : value;
 }
Exemplo n.º 7
0
 public IshField(string fieldName, Enumerations.Level fieldLevel, Enumerations.ValueType valueType)
 {
     _fieldName  = (fieldName == null) ? "" : fieldName;
     _fieldLevel = fieldLevel;
     _valueType  = valueType;
 }
Exemplo n.º 8
0
 protected IshField()
 {
     _fieldName  = "";
     _fieldLevel = Enumerations.Level.None;
     _valueType  = Enumerations.ValueType.Value;
 }
 /// <summary>
 /// Constructs a Set IshField
 /// </summary>
 public IshRequestedMetadataField(string fieldName, Enumerations.Level fieldLevel, Enumerations.ValueType valueType)
     : base(fieldName, fieldLevel, valueType)
 {
 }