Ejemplo n.º 1
0
        public Error(XE errorElement)
        {
            var codeAttribute = ExpectAttribute(errorElement, C.code);

            Code    = FieldTypes.AssertString(codeAttribute.Value);
            Message = FieldTypes.AssertString(errorElement.Value);
        }
Ejemplo n.º 2
0
 public Currency(string value)
 {
     FieldTypes.AssertString(value);
     if (!Enum.IsDefined(typeof(Kind), value))
     {
         throw new ArgumentException($"Error parsing {nameof(Kind)}: {value}");
     }
     Value = (Kind)Enum.Parse(typeof(Kind), value);
 }
 public Type(string value)
 {
     FieldTypes.AssertString(value);
     if (!Enum.IsDefined(typeof(Kind), value))
     {
         throw new ArgumentException($"Unknown value '{value}'");
     }
     Value = (Kind)Enum.Parse(typeof(Kind), value);
 }
 /*
  * On success response contains
  *
  *   <ResponseCode>A</ResponseCode>
  *
  * On failure response contains
  *
  *   <ResponseCode>E</ResponseCode>
  *   <Error code="1">Unsupported parameter: NonExistingEntity</Error>
  *
  * Or for SetCustomer operation (among others):
  *
  *  <ResponseCode>D</ResponseCode>
  *  <DisplayMessage>com.micros.storedValue.worker.SetRollbackException: Update failed for row ID = 123</DisplayMessage>
  */
 public ResponseCode(string value)
 {
     FieldTypes.AssertString(value);
     Value = value switch
     {
         "A" => Kind.Approved,
         "D" => Kind.DataCenterInitiatedError,
         "E" => Kind.Error,
         _ => throw new ArgumentException($"Unsupported {nameof(Kind)} value: '{value}'")
     };
 }
 public Type(string value)
 {
     FieldTypes.AssertString(value);
     Value = value switch
     {
         "string" => K.String,
         "timestamp" => K.Timestamp,
         "boolean" => K.Boolean,
         "long" => K.Long,
         "short" => K.Short,
         "double" => K.Double,
         "int" => K.Int,
         _ => throw new ArgumentException($"Unsupported kind: '{value}"),
     };
 }