Ejemplo n.º 1
0
        private FilingSubcategory ReadValue(JsonReader reader, object existingValue, JsonSerializer serializer)
        {
            var filingSubcategory =
                (FilingSubcategory)_stringEnumConverter.ReadJson(reader, typeof(FilingSubcategory), existingValue, serializer);

            return(filingSubcategory);
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            switch (reader.Value)
            {
            case "Front Door":
                return(PackageLocation.FrontDoor);

            case "Back Door":
                return(PackageLocation.BackDoor);

            case "Side Door":
                return(PackageLocation.SideDoor);

            case "Knock on Door / Ring Bell":
                return(PackageLocation.KnockonDoorRingBell);

            case "MailRoom":
                return(PackageLocation.MailRoom);

            case "In / At Mailbox":
                return(PackageLocation.InAtMailbox);

            default:
                var converter = new StringEnumConverter();
                return(converter.ReadJson(reader, objectType, existingValue, serializer));
            }
        }
Ejemplo n.º 3
0
 public override T?ReadJson(JsonReader reader, Type objectType, T?existingValue, bool hasExistingValue, JsonSerializer serializer)
 {
     try
     {
         return((T?)converter.ReadJson(reader, objectType, existingValue, serializer));
     }
     catch (JsonException)
     {
         return(DefaultValue);
     }
 }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            switch (reader.Value)
            {
            case "In Transit":
                return(TrackingStatusCode.InTransit);

            default:
                var converter = new StringEnumConverter();
                return(converter.ReadJson(reader, objectType, existingValue, serializer));
            }
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            if (reader.TokenType == JsonToken.String)
            {
                string enumText = reader.Value.ToString();

                enumText = enumText.Replace("-", "");

                reader = new OneStringJsonReader(enumText);
            }

            return(_stringEnumConverter.ReadJson(reader, objectType, existingValue, serializer));
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            switch (reader.Value)
            {
            case "10KG":
                return(ParcelType.UPS_10KG);

            case "25KG":
                return(ParcelType.UPS_25KG);

            default:
                var converter = new StringEnumConverter();
                return(converter.ReadJson(reader, objectType, existingValue, serializer));
            }
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            switch (reader.Value)
            {
            case "POSTAGE FUND":
                return(TransactionType.POSTAGE_FUND);

            case "POSTAGE PRINT":
                return(TransactionType.POSTAGE_PRINT);

            case "POSTAGE REFUND":
                return(TransactionType.POSTAGE_REFUND);

            default:
                var converter = new StringEnumConverter();
                return(converter.ReadJson(reader, objectType, existingValue, serializer));
            }
        }
Ejemplo n.º 8
0
 public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
 {
     switch (reader.Value)
     {
         case "POSTAGE FUND":
             return TransactionType.POSTAGE_FUND;
         case "POSTAGE PRINT":
             return TransactionType.POSTAGE_PRINT;
         case "POSTAGE REFUND":
             return TransactionType.POSTAGE_REFUND;
         case "APV-POSTAGE OVERPAID":
             return TransactionType.APV_POSTAGE_OVERPAID;
         case "APV-POSTAGE UNDERPAID":
             return TransactionType.APV_POSTAGE_UNDERPAID;
         default:
             var converter = new StringEnumConverter();
             return converter.ReadJson(reader, objectType, existingValue, serializer);
     }
 }
Ejemplo n.º 9
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            switch (reader.Value)
            {
            case "2DA":
                return(Services.UPS_2DA);

            case "2DA_AM":
                return(Services.UPS_2DA_AM);

            case "3DA":
                return(Services.UPS_3DA);

            case "3DA_USA":
                return(Services.UPS_3DA_USA);

            default:
                var converter = new StringEnumConverter();
                return(converter.ReadJson(reader, objectType, existingValue, serializer));
            }
        }
Ejemplo n.º 10
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            switch (reader.Value)
            {
            case "liveanimal-poultry":
                return(SpecialServiceCodes.liveanimal_poultry);

            case "sunday-holiday":
                return(SpecialServiceCodes.sunday_holiday);

            case "1030":
                return(SpecialServiceCodes.TenThirty);

            case "PO to Addressee":
                return(SpecialServiceCodes.PO_to_Addressee);

            default:
                var converter = new StringEnumConverter();
                return(converter.ReadJson(reader, objectType, existingValue, serializer));
            }
        }
Ejemplo n.º 11
0
 public static TEnum Read <TRoot>(JsonReader reader, TRoot root)
 {
     return((TEnum)_enumConverter.ReadJson(reader, typeof(TEnum), null, null));
 }
Ejemplo n.º 12
0
 private object ReadValue(JsonReader reader, Type elementType, object existingValue, JsonSerializer serializer)
 {
     return(_stringEnumConverter.ReadJson(reader, elementType, existingValue, serializer));
 }
 public override ChangeReason ReadJson(JsonReader reader, Type objectType, ChangeReason existingValue, bool hasExistingValue, JsonSerializer serializer)
 {
     return((ChangeReason)_converter.ReadJson(reader, objectType, existingValue, serializer));
 }
Ejemplo n.º 14
0
 public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
 {
     return(sec.ReadJson(reader, objectType, existingValue, serializer));
 }