Beispiel #1
0
        private async void TabbedPage_Appearing(object sender, EventArgs e)
        {
            AppCore.VM.ShowLoading     = true; //This shows the loading spinner
            AppCore.VM.LoadingProgress = 0;
            while (!this.IsVisible)
            {
                await Task.Delay(50);
            }
            var contacts = new List <Contact>();
            var g        = new RandomNameGeneratorLibrary.PersonNameGenerator();

            for (int n = 0; n < 3000; n++)
            {
                contacts.Add(new Contact()
                {
                    Name    = g.GenerateRandomMaleFirstAndLastName(),
                    Company = g.GenerateRandomLastName(),
                    Job     = "Worker",
                });
            }
            AppCore.Model = new AppModel()
            {
                Contacts = contacts
            };
            AppCore.Settings = new Settings();
            AppCore.VM.LoadViewModel();
            AppCore.VM.ShowLoading = false;
        }
        public static IEnumerable<Citizen> GetCitizens(int count)
        {
            var random = new Random();

            var namegenerator = new PersonNameGenerator();

            return Enumerable.Range(0, count).Select(x => new Citizen
            {
                Firstname = namegenerator.GenerateRandomFirstName(),
                Cpr = random.Next(1111111111, 1999999999).ToString(),
                Lastname = namegenerator.GenerateRandomLastName()
            });
        }
        public static BarcodeGroup Generate(BarcodeWriter bw, string ap, string dayFrom, string dayTo)
        {
            var png = new PersonNameGenerator();
            string name;
            if (WinService.rndNumber.Next(0, 2) == 0)
                name = "Mrs " + png.GenerateRandomFemaleFirstName() + " "
                 + png.GenerateRandomLastName();
            else
                name = "Mr " + png.GenerateRandomMaleFirstName() + " "
                 + png.GenerateRandomLastName();
            var ag = AccessGateFlightInfo.ToList(DateTime.Today.AddDays(-7), DateTime.Today);
            Console.WriteLine(ag.Count);
            var randomFlight = ag[WinService.rndNumber.Next(0, ag.Count - 1)];
            var flightNo = randomFlight.FlightNo;
            if (flightNo.Length < 5)
                flightNo = flightNo.PadRight(5, ' ');
            var carrier = randomFlight.CarrierDesignator;
            if (carrier.Length < 3)
                carrier = carrier.PadRight(3, ' ');
            var pnr = "";
            name = name.Length > 20 ? name.Substring(0, 20) : name.PadRight(20, ' ');
            var rndCisn = WinService.rndNumber.Next(0, 150);
            var cisn = rndCisn.ToString().PadLeft(5, '0');
            var seat = "";
            var rndSeatLetter = WinService.rndNumber.Next(65, 73);
            var seatLetter = (char)rndSeatLetter;
            var rndSeatNumber = WinService.rndNumber.Next(1, 11);
            seat = string.Format("{0}{1}", rndSeatNumber, seatLetter).PadLeft(4, '0');
            var jDate = (randomFlight.DepartDateTime.DayOfYear + 14).ToString().PadLeft(3, '0');
            var securityValue = name.ToArray().Sum(c => (int)c) +randomFlight.FromAirport.ToArray().Sum(c => (int)c) + cisn.ToArray().Sum(c => (int)c);
            var r = (WinService.rndNumber).Next(100, 700).ToString();
            var securityFactor = Convert.ToInt32(r, 16);
            securityValue += securityFactor;
            pnr = string.Format("{0}{1}", securityFactor.ToString("X3"),securityValue.ToString("X4"));
            var d = ConfigurationManager.GetSAVConfigSetting("SmartAccessValidation", "CovertSerialNumber");
            var barcode = string.Format("M1{0}E{1}{10}{2}{3}{4}{5}Y{6}{7}01E0293[{8}To{9}]{11}", name, pnr, randomFlight.ToAirport,carrier, flightNo, jDate, seat, cisn, dayFrom, dayTo, ap, (Convert.ToInt32(d.KeyValue)+1).ToString().PadLeft(6, '0'));

            var bg = new BarcodeGroup
            {
                barcode = barcode,
                image = bw.Write(barcode)
            };

            return bg;
        }
 private void initNames()
 {
     PersonNameGenerator names = new PersonNameGenerator();
     _names.AddRange(names.GenerateMultipleFemaleFirstNames(500));
     _names.AddRange(names.GenerateMultipleMaleFirstNames(500));
 }