コード例 #1
0
ファイル: People.cs プロジェクト: LarsB-mans/School-Tycoon
 public Teacher(Gender Gender, Subject[] Subjects, int Salary)
 {
     if (Gender == Gender.Male)
     {
         this.FirstName = FirstNamesMale[Random.Next(FirstNamesMale.Count())];
     }
     else
     {
         this.FirstName = FirstNamesFemale[Random.Next(FirstNamesFemale.Count())];
     }
     this.LastName  = LastNames[Random.Next(LastNames.Count())];
     this.Gender    = Gender;
     this.Subjects  = Subjects;
     this.Salary    = Salary;
     this.Happiness = Random.Next(1000);
     this.FunFactor = Random.Next(-5, 6);
 }
コード例 #2
0
ファイル: People.cs プロジェクト: LarsB-mans/School-Tycoon
 public Pupil(Gender Gender, int Class)
 {
     if (Gender == Gender.Male)
     {
         this.FirstName = FirstNamesMale[Random.Next(FirstNamesMale.Count())];
     }
     else
     {
         this.FirstName = FirstNamesFemale[Random.Next(FirstNamesFemale.Count())];
     }
     this.LastName     = LastNames[Random.Next(LastNames.Count())];
     this.Gender       = Gender;
     this.Happiness    = Random.Next(1001);
     this.Class        = Class;
     this.Intelligence = Random.Next(11);
     this.Motivation   = Random.Next(11);
 }
コード例 #3
0
        private Contact CreateContact(int number)
        {
            var female          = _rnd.Next(2) == 1;
            int middleNameCount = _rnd.Next(5);

            if (middleNameCount > 2)
            {
                middleNameCount = 0;
            }

            var contact = new Contact(Guid.NewGuid());

            contact.Language.Value = SelectLanguage();
            contact.LastName.Value = LastNames.Skip(_rnd.Next(LastNames.Count())).First();

            if (female)
            {
                contact.FirstName.Value = FemaleFirstNames.Skip(_rnd.Next(FemaleFirstNames.Count())).First();
                var middleNames = new List <string>();
                for (int i = 0; i < middleNameCount; i++)
                {
                    middleNames.Add(FemaleFirstNames.Skip(_rnd.Next(FemaleFirstNames.Count())).First());
                }
                contact.MiddleNames.Value = string.Join(" ", middleNames);
            }
            else
            {
                contact.FirstName.Value = MaleFirstNames.Skip(_rnd.Next(MaleFirstNames.Count())).First();
                var middleNames = new List <string>();
                for (int i = 0; i < middleNameCount; i++)
                {
                    middleNames.Add(MaleFirstNames.Skip(_rnd.Next(MaleFirstNames.Count())).First());
                }
                contact.MiddleNames.Value = string.Join(" ", middleNames);
            }

            contact.BirthDate.Value    = new DateTime(1960, 1, 1).AddDays(_rnd.NextDouble() * 40d * 365d);
            contact.Organization.Value = "New Organization";

            var homeMail = new ServiceAddress(Guid.NewGuid());

            homeMail.Service.Value    = ServiceType.EMail;
            homeMail.Category.Value   = AddressCategory.Home;
            homeMail.Precedence.Value = contact.ServiceAddresses.MaxOrDefault(a => a.Precedence.Value, 0) + 1;
            homeMail.Address.Value    =
                "stefan+" +
                contact.FirstName.Value.ToLowerInvariant() + "." +
                contact.LastName.Value.ToLowerInvariant() + "@savvy.ch";
            homeMail.Contact.Value = contact;

            if (_rnd.Next(3) != 0)
            {
                var mobile = new ServiceAddress(Guid.NewGuid());
                mobile.Service.Value    = ServiceType.Phone;
                mobile.Category.Value   = AddressCategory.Mobile;
                mobile.Precedence.Value = contact.ServiceAddresses.MaxOrDefault(a => a.Precedence.Value, 0) + 1;
                mobile.Address.Value    =
                    MobilePrefix.Skip(_rnd.Next(MobilePrefix.Count())).First() +
                    ComposeNumber();
                mobile.Contact.Value = contact;
            }

            if (_rnd.Next(3) == 0)
            {
                var phone = new ServiceAddress(Guid.NewGuid());
                phone.Service.Value    = ServiceType.Phone;
                phone.Category.Value   = AddressCategory.Mobile;
                phone.Precedence.Value = contact.ServiceAddresses.MaxOrDefault(a => a.Precedence.Value, 0) + 1;
                phone.Address.Value    =
                    PhonePrefix.Skip(_rnd.Next(PhonePrefix.Count())).First() +
                    ComposeNumber();
                phone.Contact.Value = contact;
            }

            var place         = Places.Skip(_rnd.Next(Places.Count())).First();
            var postalAddress = new PostalAddress(Guid.NewGuid());

            postalAddress.Country.Value    = GetCountry("Schweiz");
            postalAddress.State.Value      = GetState(place.Item3);
            postalAddress.PostalCode.Value = place.Item1.ToString();
            postalAddress.Place.Value      = place.Item2;
            postalAddress.Street.Value     =
                Streets.Skip(_rnd.Next(Streets.Count())).First() +
                " " + (_rnd.Next(23) + 1).ToString();
            postalAddress.Precedence.Value = contact.PostalAddresses.MaxOrDefault(a => a.Precedence.Value, 0) + 1;
            postalAddress.Contact.Value    = contact;

            var subscription = new Subscription(Guid.NewGuid());

            subscription.Contact.Value   = contact;
            subscription.Feed.Value      = GetFeed("Piratenpartei Zentralschweiz", null);
            subscription.StartDate.Value = new DateTime(2018, 12, 18);

            switch (_rnd.Next(4))
            {
            case 0:
                var subscription2 = new Subscription(Guid.NewGuid());
                subscription2.Contact.Value   = contact;
                subscription2.Feed.Value      = GetFeed("Piratenpartei Zug", "Piratenpartei Zentralschweiz");
                subscription2.StartDate.Value = new DateTime(2018, 12, 18);
                break;

            case 1:
                var subscription3 = new Subscription(Guid.NewGuid());
                subscription3.Contact.Value   = contact;
                subscription3.Feed.Value      = GetFeed("Piratenpartei Luzern", "Piratenpartei Zentralschweiz");
                subscription3.StartDate.Value = new DateTime(2018, 12, 18);
                break;
            }

            var tagAssignment1 = new TagAssignment(Guid.NewGuid());

            tagAssignment1.Tag.Value     = GetTag("Partizipationsmails", TagUsage.Mailing, TagMode.Default | TagMode.Manual);
            tagAssignment1.Contact.Value = contact;

            if (_rnd.Next(5) < 4)
            {
                var tagAssignment2 = new TagAssignment(Guid.NewGuid());
                tagAssignment2.Tag.Value     = GetTag("Verantstaltungsmails", TagUsage.Mailing, TagMode.Default | TagMode.Manual | TagMode.Self);
                tagAssignment2.Contact.Value = contact;
            }

            if (_rnd.Next(5) < 4)
            {
                var tagAssignment3 = new TagAssignment(Guid.NewGuid());
                tagAssignment3.Tag.Value     = GetTag("Aktionsmails", TagUsage.Mailing, TagMode.Default | TagMode.Manual | TagMode.Self);
                tagAssignment3.Contact.Value = contact;
            }

            if (_rnd.Next(5) < 3)
            {
                var tagAssignment4 = new TagAssignment(Guid.NewGuid());
                tagAssignment4.Tag.Value     = GetTag("Aktivist", TagUsage.None, TagMode.Manual);
                tagAssignment4.Contact.Value = contact;
            }

            _db.Save(contact);

            return(contact);
        }