public Maybe<string> GetAttributeString(MessageAttributeTypeContract type)
 {
     for (int i = Items.Length - 1; i >= 0; i--)
     {
         var item = Items[i];
         if (item.Type == type)
         {
             var value = item.StringValue;
             if (value == null)
                 throw new InvalidOperationException("String attribute can't be null");
             return value;
         }
     }
     return Maybe<string>.Empty;
 }
 public Maybe<DateTime> GetAttributeDate(MessageAttributeTypeContract type)
 {
     for (int i = Items.Length - 1; i >= 0; i--)
     {
         var item = Items[i];
         if (item.Type == type)
         {
             var value = item.NumberValue;
             if (value == 0)
                 throw new InvalidOperationException("Date attribute can't be empty");
             return DateTime.FromBinary(value);
         }
     }
     return Maybe<DateTime>.Empty;
 }
Example #3
0
 public Maybe <DateTime> GetAttributeDate(MessageAttributeTypeContract type)
 {
     for (int i = Items.Length - 1; i >= 0; i--)
     {
         var item = Items[i];
         if (item.Type == type)
         {
             var value = item.NumberValue;
             if (value == 0)
             {
                 throw new InvalidOperationException("Date attribute can't be empty");
             }
             return(DateTime.FromBinary(value));
         }
     }
     return(Maybe <DateTime> .Empty);
 }
Example #4
0
 public Maybe <string> GetAttributeString(MessageAttributeTypeContract type)
 {
     for (int i = Items.Length - 1; i >= 0; i--)
     {
         var item = Items[i];
         if (item.Type == type)
         {
             var value = item.StringValue;
             if (value == null)
             {
                 throw new InvalidOperationException("String attribute can't be null");
             }
             return(value);
         }
     }
     return(Maybe <string> .Empty);
 }
Example #5
0
 public MessageAttributeContract(MessageAttributeTypeContract type, long numberValue)
 {
     Type        = type;
     NumberValue = numberValue;
 }
Example #6
0
 public MessageAttributeContract(MessageAttributeTypeContract type, byte[] binaryValue)
 {
     Type        = type;
     BinaryValue = binaryValue;
 }
Example #7
0
 public MessageAttributeContract(MessageAttributeTypeContract type, string stringValue)
 {
     Type        = type;
     StringValue = stringValue;
 }
 public MessageAttributeContract(MessageAttributeTypeContract type, long numberValue)
 {
     Type = type;
     NumberValue = numberValue;
 }
 public MessageAttributeContract(MessageAttributeTypeContract type, byte[] binaryValue)
 {
     Type = type;
     BinaryValue = binaryValue;
 }
 public MessageAttributeContract(MessageAttributeTypeContract type, string stringValue)
 {
     Type = type;
     StringValue = stringValue;
 }
 public void Add(MessageAttributeTypeContract type, long value)
 {
     _list.Add(new MessageAttributeContract(type, value));
 }
 public void Add(MessageAttributeTypeContract type, long value)
 {
     _list.Add(new MessageAttributeContract(type, value));
 }