public async void CreateDummyData()
        {
            //this.jobService.SaveJob(new Job(BSA.Database.SampleData.SampleJobs.SampleJob1));
            //this.jobService.SaveJob(new Job(BSA.Database.SampleData.SampleJobs.SampleJob2));
            //this.jobService.SaveJob(new Job(BSA.Database.SampleData.SampleJobs.SampleJob3));
            //this.LoadData();

            var randomWords = await DummyDataHelper.GetRandomWords(2000);

            var dummyDataCount = 100;
            var random         = new Random();

            for (var i = 0; i < dummyDataCount; i++)
            {
                var day = await DummyDataHelper.GetRandomNumber(1, 28, random);

                var month = await DummyDataHelper.GetRandomNumber(1, 12, random);

                var year = await DummyDataHelper.GetRandomNumber(1950, 2050, random);

                var hour = await DummyDataHelper.GetRandomNumber(0, 23, random);

                var minute = await DummyDataHelper.GetRandomNumber(0, 59, random);

                var second = await DummyDataHelper.GetRandomNumber(0, 59, random);

                var date = new DateTime(year, month, day, hour, minute, second);

                var job = new Job
                {
                    Name              = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 5, random),
                    Date              = date,
                    Messenger         = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 2, random),
                    Organization      = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 5, random),
                    Communicationtool = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 1, random),
                    Location          = new JobLocation
                    {
                        Street                = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 2, random),
                        HouseNumber           = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 1, random),
                        ZipCode               = (await DummyDataHelper.GetRandomNumber(111111, 999999, random)).ToString(),
                        City                  = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 1, random),
                        FloorLevel            = (await DummyDataHelper.GetRandomNumber(0, 50, random)).ToString(),
                        AdditionalDescription = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 20, random)
                    },
                    JobType             = DummyDataHelper.GetRandomEnumValue <JobType>(random).ToString(),
                    NumberInjuredPerson = await DummyDataHelper.GetRandomNumber(0, 250, random),
                    Description         = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 20, random),
                    JobPriority         = DummyDataHelper.GetRandomEnumValue <JobPriority>(random),
                    JobStatus           = DummyDataHelper.GetRandomEnumValue <JobState>(random)
                };

                job.History.Add(job.IsNew
                    ? new HistoryItem(BsaContext.GetUserName(), $"Neuer Auftrag angelegt: {job.Description}")
                    : new HistoryItem(BsaContext.GetUserName(), $"Auftrag #1  ({job.Description}) modifiziert"));
                this.jobService.SaveJob(job);
            }


            //var job1 = new Job
            //{
            //    Name = "This is the job name",
            //    Date = DateTime.Now,
            //    Messenger = "Leitstelle",
            //    Organization = "Microsoft",
            //    Communicationtool = "Internet",
            //    Location = new JobLocation
            //    {
            //        Street = "Schaezlerstraße",
            //        HouseNumber = "30",
            //        ZipCode = "86152",
            //        City = "Augsburg",
            //        FloorLevel = "3",
            //        AdditionalDescription = "Kein Aufzug vorhanden!"
            //    },
            //    JobType = JobType.Fire.ToString(),
            //    NumberInjuredPerson = 3,
            //    Description = "Backofen wurde nicht ausgeschaltet",
            //    JobPriority = JobPriority.High,
            //    JobStatus = JobState.InProgress
            //};

            //var job2 = new Job
            //{
            //    Name = "This is the job name",
            //    Date = DateTime.Now,
            //    Messenger = "Random person",
            //    Organization = "HS AUgsburg",
            //    Communicationtool = "Brieftaube",
            //    Location = new JobLocation
            //    {
            //        Street = "Friedberger Straße",
            //        HouseNumber = "12",
            //        ZipCode = "86150",
            //        City = "Augsburg",
            //        FloorLevel = "3",
            //        AdditionalDescription = "Raum W3.18"
            //    },
            //    JobType = JobType.Flooding.ToString(),
            //    NumberInjuredPerson = 7,
            //    Description = "Wasserflasche ist umgefallen",
            //    JobPriority = JobPriority.Medium,
            //    JobStatus = JobState.NewCreated
            //};

            //this.jobs.Add(job1);
            //this.jobs.Add(job2);
        }
コード例 #2
0
        public async void CreateDummyData()
        {
            var randomWords = await DummyDataHelper.GetRandomWords(2000);

            var dummyDataCount = 100;
            var random         = new Random();

            for (var i = 0; i < dummyDataCount; i++)
            {
                var persons     = new ObservableCollection <Person>();
                var personCount = await DummyDataHelper.GetRandomNumber(1, 50, random);

                for (var ii = 0; ii < personCount; ii++)
                {
                    var day = await DummyDataHelper.GetRandomNumber(1, 28, random);

                    var month = await DummyDataHelper.GetRandomNumber(1, 12, random);

                    var year = await DummyDataHelper.GetRandomNumber(1930, 2005, random);

                    var hour = await DummyDataHelper.GetRandomNumber(0, 23, random);

                    var minute = await DummyDataHelper.GetRandomNumber(0, 59, random);

                    var second = await DummyDataHelper.GetRandomNumber(0, 59, random);

                    var date = new DateTime(year, month, day, hour, minute, second);

                    var person = new Person
                    {
                        Prename          = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 1, random),
                        Surname          = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 1, random),
                        RadioCallName    = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 3, random),
                        BirthDate        = date,
                        Additional       = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 10, random),
                        Street           = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 5, random),
                        ZipCode          = (await DummyDataHelper.GetRandomNumber(111111, 999999, random)).ToString(),
                        Employer         = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 3, random),
                        PhoneNumber      = (await DummyDataHelper.GetRandomNumber(10000, 1000000, random)).ToString(),
                        RelativesDetails = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 20, random),
                    };
                    persons.Add(person);
                }

                var force = new Force
                {
                    Name      = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 3, random),
                    RadioName = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 3, random),
                    Leader    = persons[await DummyDataHelper.GetRandomNumber(0, persons.Count, random)],
                    Persons   = persons,
                    Vehicle   = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 5, random),
                    Notes     = await DummyDataHelper.GetRandomWordsFromList(randomWords, 1, 10, random)
                };

                force.History.Add(force.IsNew
                    ? new HistoryItem(BsaContext.GetUserName(), $"Neue Einheit angelegt: {force.Name}")
                    : new HistoryItem(BsaContext.GetUserName(), $"Einheit ({force.Name}) modifiziert"));
                this.forceService.SaveForces(force);
            }

            //var sniper = new Person {Prename = "Chris", Surname = "Kyle", RadioCallName = "Peacemaker"};
            //var diver = new Person {Prename = "Colonel", Surname = "Sanders", RadioCallName = "The chicken"};
            //var cook = new Person {Prename = "Old", Surname = "McDonald", RadioCallName = "Mealmaker"};

            //var force = new Force
            //{
            //    Name = "US Navy",
            //    RadioName = "The Sharks",
            //    Leader = sniper,
            //    Persons = new ObservableCollection<Person>{sniper, cook, diver},
            //    Vehicle = "Submarine",
            //    Notes = "Incompetent"
            //};

            //var force2Leader = new Person {Prename = "Marvin", Surname = "Reiter", RadioCallName = "Mj"};
            //var force2 = new Force
            //{
            //    Name = "Mj-petworld",
            //    RadioName = "The petguy",
            //    Leader = force2Leader,
            //    Persons = new ObservableCollection<Person> { force2Leader},
            //    Vehicle = "Chopper",
            //    Notes = "Competent"
            //};

            //this.forces.Add(force);
            //this.forces.Add(force2);

            //this.forceService.SaveForces(new Force(SampleForces.SampleForce1));
            //this.forceService.SaveForces(new Force(SampleForces.SampleForce2));
            //this.forceService.SaveForces(new Force(SampleForces.SampleForce3));
        }