示例#1
0
        internal static InvoiceNumberingFormatApiModel DeserializeInvoiceNumberingFormatApiModel(XElement element)
        {
            long?  id        = default;
            bool?  isActive  = default;
            bool?  isDefault = default;
            string mask      = default;
            string name      = default;
            InvoiceNumberingFormatApiModelType?type = default;

            if (element.Element("id") is XElement idElement)
            {
                id = (long?)idElement;
            }
            if (element.Element("isActive") is XElement isActiveElement)
            {
                isActive = (bool?)isActiveElement;
            }
            if (element.Element("isDefault") is XElement isDefaultElement)
            {
                isDefault = (bool?)isDefaultElement;
            }
            if (element.Element("mask") is XElement maskElement)
            {
                mask = (string)maskElement;
            }
            if (element.Element("name") is XElement nameElement)
            {
                name = (string)nameElement;
            }
            if (element.Element("type") is XElement typeElement)
            {
                type = new InvoiceNumberingFormatApiModelType(typeElement.Value);
            }
            return(new InvoiceNumberingFormatApiModel(id, isActive, isDefault, mask, name, type));
        }
示例#2
0
        internal static InvoiceNumberingFormatApiModel DeserializeInvoiceNumberingFormatApiModel(JsonElement element)
        {
            Optional <long>   id        = default;
            Optional <bool>   isActive  = default;
            Optional <bool>   isDefault = default;
            Optional <string> mask      = default;
            Optional <string> name      = default;
            Optional <InvoiceNumberingFormatApiModelType> type = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    id = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("isActive"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    isActive = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("isDefault"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    isDefault = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("mask"))
                {
                    mask = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    type = new InvoiceNumberingFormatApiModelType(property.Value.GetString());
                    continue;
                }
            }
            return(new InvoiceNumberingFormatApiModel(Optional.ToNullable(id), Optional.ToNullable(isActive), Optional.ToNullable(isDefault), mask.Value, name.Value, Optional.ToNullable(type)));
        }