Ejemplo n.º 1
0
        public static Spec ToSpec(this byte[] value)
        {
            switch (TLV.ToStr(value))
            {
            case "0":
                return(Spec.None);

            case "1":
                return(Spec.WhiteCane);

            case "2":
                return(Spec.ExtendedMinor);

            case "3":
                return(Spec.WhiteCane | Spec.ExtendedMinor);

            case "4":
                return(Spec.YellowCane);

            case "5":
                return(Spec.YellowCane | Spec.ExtendedMinor);

            default:
                throw new InvalidOperationException("Unknown Spec: " + value.ToStr());
            }
        }
Ejemplo n.º 2
0
        public static DocType ToDocType(this byte[] value)
        {
            switch (TLV.ToStr(value))
            {
            case "1":
            case "01":
                return(DocType.IdentityCard);

            case "6":
            case "06":
                return(DocType.KidsCard);

            case "7":
            case "07":
                return(DocType.BootstrapCard);

            case "8":
            case "08":
                return(DocType.HabilitationCard);

            case "11":
                return(DocType.ForeignerA);

            case "12":
                return(DocType.ForeignerB);

            case "13":
                return(DocType.ForeignerC);

            case "14":
                return(DocType.ForeignerD);

            case "15":
                return(DocType.ForeignerE);

            case "16":
                return(DocType.ForeignerEplus);

            case "17":
                return(DocType.ForeignerF);

            case "18":
                return(DocType.ForeignerFplus);

            case "19":
                return(DocType.EuBlueCard);

            default:
                throw new InvalidOperationException("Unknown Document Type: " + value.ToStr());
            }
        }
Ejemplo n.º 3
0
        public static Gender ToGender(this byte[] value)
        {
            switch (TLV.ToStr(value))
            {
            case "M":
                return(Gender.Male);

            case "V":
            case "F":
            case "W":
                return(Gender.Female);

            default:
                return(Gender.Unknown);
            }
        }
Ejemplo n.º 4
0
        public static DateTime ToBirthDate(this byte[] value)
        {
            String stringValue = TLV.ToStr(value);

            String[] parts = stringValue.Split(new char[] { '.', ' ' }, StringSplitOptions.RemoveEmptyEntries); //split on . and ' '
            if (parts.Length == 3)
            {
                return(new DateTime(
                           Int32.Parse(parts[2]),
                           parts[1].ToMonth(),
                           Int32.Parse(parts[0])));
            }
            else
            {
                //only year, set to 1st of Jan.
                return(new DateTime(Int32.Parse(parts[0]), 1, 1));
            }
        }
Ejemplo n.º 5
0
 public static DateTime ToDate(this byte[] value) => DateTime.ParseExact(TLV.ToStr(value).Replace(" ", "").Replace(".", ""), "ddMMyyyy", CultureInfo.InvariantCulture);