Beispiel #1
0
        /// <summary>
        /// Random gen for the vehicle id section
        /// </summary>
        /// <param name="isLateModel"></param>
        /// <param name="maxYear"></param>
        /// <returns></returns>
        public static VehicleIdSection GetVehicleIdSection(bool isLateModel = false, int?maxYear = null)
        {
            var yy = maxYear ?? DateTime.Today.Year;

            if (yy < Vin.BASE_YEAR)
            {
                yy = Vin.BASE_YEAR;
            }

            var pick = Etx.RandomInteger(0, yy - Vin.AMENDED_BASE_YEAR);

            if (isLateModel)
            {
                pick = Etx.RandomInteger(0, Vin.YearIdx.Length - 1);
            }

            var vis = new VehicleIdSection
            {
                ModelYear        = Vin.YearIdx[pick],
                PlantCode        = Vin.GetRandomVinChar(),
                SequentialNumber = new string(Etx.RandomChars(0x30, 0x39, 6))
            };

            return(vis);
        }
        public static WorldManufacturerId CreateRandomManufacturerId()
        {
            var wmiOut = new WorldManufacturerId();
            //JA-J0 Japan
            //KL-KR Korea
            //LA-L0 China
            //1A-10, 4A-40, 5A-50 US
            //3A-37 Mexico
            var pick = Etx.RandomInteger(1, 12);

            switch (pick)
            {
            case 1:
                wmiOut.Country = 'J';
                break;

            case 2:
                wmiOut.Country = 'K';
                break;

            case 3:
                wmiOut.Country = 'L';
                break;

            case 4:
            case 5:
            case 6:
                wmiOut.Country = '1';
                break;

            case 7:
                wmiOut.Country = '4';
                break;

            case 8:
                wmiOut.Country = '5';
                break;

            case 9:
            case 10:
            case 11:
            case 12:
                wmiOut.Country = '3';
                break;
            }

            wmiOut.RegionMaker = Vin.GetRandomVinChar();

            pick = Etx.RandomInteger(1, 3);
            switch (pick)
            {
            case 1:
                wmiOut.VehicleType = '2';
                break;

            case 2:
                wmiOut.VehicleType = '3';
                break;

            case 3:
                wmiOut.VehicleType = '7';
                break;
            }

            return(wmiOut);
        }