public ParsedFullName Parse(string rawName) { var match = Rx.Match(rawName); if (!match.Success) { return(null); } var pn = new ParsedFullName { DisplayName = rawName, Score = 50, Rule = nameof(SingleNameOnlyPattern) }; var matchedName = match.Groups["first"].Value; if (LastNames.Contains(matchedName)) { pn.LastName = matchedName; } else { pn.FirstName = matchedName; } return(pn); }
public List <UserEntity> Generate(int count) { var fn = new FirstNames(); var ln = new LastNames(); var d = new Departments(); var t = new Titles(); var r = new Random(); List <UserEntity> users = new List <UserEntity>(); for (int i = 0; i < count; i++) { var user = new UserEntity { Id = i + 1, Age = r.Next(1, 100), Department = d.GetRandom(), FirstName = fn.GetRandom(), LastName = ln.GetRandom(), Title = t.GetRandom() }; users.Add(user); } return(users); }
private static Contact CreateContact(int seed) { Contact contact = new Contact(); contact.Name = FirstNames.GetSeededEntry(seed) + " " + LastNames.GetSeededEntry(seed); return(contact); }
private void ParseLastNames() { foreach (Match m in GetMatch(lastNamesFile, @"<td.*>([А-Яа-я]*)</td>")) { LastNames.Add($"{m.Groups[1]}"); } }
public void InitNull(IdStorage ids) { Cities.InitNull(ids); Countries.InitNull(ids); Interests.InitNull(ids); FirstNames.InitNull(ids); LastNames.InitNull(ids); Phones.InitNull(ids); Premiums.InitNull(ids); }
public override void Process(XFireClient context) { var usernames = context.Server.Database.QueryUsers(_queryByUsername).Select(a => a.Username).ToList(); Usernames.AddRange(usernames); // Don't really care about these but they're necessary to work properly var unknowns = usernames.Select(a => "Unknown").ToList(); FirstNames.AddRange(unknowns); LastNames.AddRange(unknowns); Emails.AddRange(unknowns); }
private int getLastNameId(string data) { LastNames lastName = _context.LastName.Where(l => l.LastName.Equals(data)).FirstOrDefault(); if (lastName == null) { lastName = new LastNames(); lastName.CreateTime = DateTime.Now; lastName.LastName = data; _context.Entry(lastName).State = EntityState.Added; _context.SaveChanges(); } return(lastName.ID); }
public void Process(Context context) { var users = context.Server.Database.QueryUsers(queryByUsername); var usernames = users.Select(a => a.Username); Usernames.AddRange(usernames); // Don't really care about these but they're necessary to work properly var unknowns = usernames.Select(a => "Unknown"); FirstNames.AddRange(unknowns); LastNames.AddRange(unknowns); Emails.AddRange(unknowns); }
public void LoadEnded() { Emails.LoadEnded(); FirstNames.LoadEnded(); LastNames.LoadEnded(); Phones.LoadEnded(); Sex.LoadEnded(); Countries.LoadEnded(); Cities.LoadEnded(); Statuses.LoadEnded(); Joined.LoadEnded(); Birth.LoadEnded(); Interests.LoadEnded(); Premiums.LoadEnded(); }
public void Compress() { Emails.Compress(); FirstNames.Compress(); LastNames.Compress(); Phones.Compress(); Sex.Compress(); Countries.Compress(); Cities.Compress(); Statuses.Compress(); Joined.Compress(); Birth.Compress(); Interests.Compress(); Premiums.Compress(); }
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); }
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); }
static MockPersonRepository() { var rng = new Random(); // Ugly randomization to create different people people = Enumerable.Range(1, 30).Select(index => new Person { Id = index, DateOfBirth = DateTime.Now.AddYears(-rng.Next(5, 40)), DateOfDeath = rng.Next(10) == 1 ? DateTime.Now.AddYears(-rng.Next(5)) : (DateTime?)null, FirstName = FirstNames.GetRandom(), LastName = LastNames.GetRandom(), Street1 = $"{rng.Next(999)} {Streets.GetRandom()} {StreetTypes.GetRandom()}", Street2 = rng.Next(10) < 3 ? $"Apt {rng.Next(1, 30)}" : null, City = Cities.GetRandom(), State = States.GetRandom(), PostalCode = $"{rng.Next(99999):00000}", Interests = rng.Next(10) < 5 ? Interests.GetRandom() : null, AvatarUrl = $"/images/{(index % 2 == 0 ? "m" : "f")}/{index}.png" }).ToArray(); }
public ContactPersonalData CreateValueObject() { if (string.IsNullOrEmpty(FirstName) || string.IsNullOrEmpty(LastName)) { throw new NoRequiredDataProvidedForPersonalData(this); } FirstNames firstNames = new FirstNames(FirstName, AdditionalFirstNames.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries)); var tmpLastAddNames = AdditionalLastNames.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries); LastNames lastNames = UseDashBeetwenLastNames && tmpLastAddNames.Length == 1 ? new LastNames(LastName, AdditionalLastNames) : new LastNames(LastName, tmpLastAddNames); DateTime? dateOfBirth = DateOfBirthNotSpecified ? new DateTime?() : DateOfBirth; Sex sex = IsMale ? Sex.Male : (IsFemale ? Sex.Female : Sex.Unknown); RelationType relation = RelationType.None; foreach (var relationType in Relations.Where(c => c.IsChecked)) { relation = relation | relationType.RelationType; } ContactPersonalData contactPersonalData = new ContactPersonalData(firstNames, lastNames, dateOfBirth, sex, relation); return(contactPersonalData); }
public string GetLastName(int localeId) { var nameDTO = LastNames.FirstOrDefault(f => f.LocaleId == localeId); return(nameDTO?.Name); }
public static IEnumerable <string> RetrieveExampleList(string word) { word = word.ToLower(); if (!word.StartsWith("something")) { if (word.StartsWith("the title") || word.StartsWith("a title")) { word = word.Replace("the title ", string.Empty).Replace("a title ", string.Empty); } else { Regex firstWordRegex = new Regex(@"^\w+ "); word = firstWordRegex.Replace(word, ""); word = word.Replace("type of ", string.Empty); word = word.Replace("kind of ", string.Empty); } } switch (word) { case "noun": return(Nouns.Take(3)); case "adjective": return(Adjectives.Take(3)); case "plural noun": case "noun (plural)": return(PluralNouns.Take(3)); case "verb": return(Verbs.Take(3)); case "number": Random rand = new Random(); return(new List <string>() { rand.Next(1, 999).ToString(), rand.Next(1, 999).ToString(), rand.Next(1, 999).ToString() }); case @"verb ending in ""ing""": return(GerundVerbs.Take(3)); case "adverb": return(Adverbs.Take(3)); case "part of the body": case "body part": return(PartsOfBody.Take(3)); case "liquid": return(Liquids.Take(3)); case "place": return(Places.Take(3)); case "animal": return(Animals.Take(3)); case "food": return(Foods.Take(3)); case "color": return(Colors.Take(3)); case "verb (past tense)": return(PastTenseVerbs.Take(3)); case "celebrity": return(Celebrities.Take(3)); case "exclamation": return(Exclamations.Take(3)); case "part of the body (plural)": case "body part (plural)": return(PluralBodyParts.Take(3)); case "silly word": return(SillyWords.Take(3)); case "animal (plural)": return(PluralAnimals.Take(3)); case "city": return(Cities.Take(3)); case "nonsense word": return(NonsenseWords.Take(3)); case "famous person": return(FamousPeople.Take(3)); case "article of clothing": return(Clothing.Take(3)); case "vehicle": return(Vehicles.Take(3)); case "something alive (plural)": return(PluralAliveSomethings.Take(3)); case "geographical location": return(GeographicalLocations.Take(3)); case "town": return(Towns.Take(3)); case "country": return(Countries.Take(3)); case "container": return(Containers.Take(3)); case "last name": return(LastNames.Take(3)); case "name": return(Names.Take(3)); case @"verb ending in ""s""": return(VerbsEndingInS.Take(3)); case "occupation": case "occupation or job": case "profession": return(Occupations.Take(3)); case "silly noise": return(SillyNoises.Take(3)); case "male celebrity": case "celebrity (male)": return(MaleCelebrities.Take(3)); case "article of clothing (plural)": return(PluralClothing.Take(3)); case "name of a school": case "school": return(Schools.Take(3)); case "building": return(Buildings.Take(3)); case "bird": return(Birds.Take(3)); case @"adjective ending in ""est""": case "adjective (superlative)": return(Superlatives.Take(3)); case "letter": return(Letters.Take(3)); case "game": return(Games.Take(3)); case "holiday": return(Holidays.Take(3)); case "silly word (plural)": return(PluralSillyWords.Take(3)); case "something round": return(RoundSomethings.Take(3)); case "piece of furniture": return(Furniture.Take(3)); case "vegetable": return(Vegetables.Take(3)); case "spanish word": return(SpanishWords.Take(3)); case "tv actor": return(TVActors.Take(3)); case "boy's name": return(BoyNames.Take(3)); case "something alive": return(AliveSomethings.Take(3)); case "female celebrity": case "celebrity (female)": return(FemaleCelebrities.Take(3)); case "italian word": return(ItalianWords.Take(3)); case "occupation (plural)": return(PluralOccupations.Take(3)); case "first name": return(FirstNames.Take(3)); case "room in a house": return(HouseRooms.Take(3)); case "relative": return(Relatives.Take(3)); case "movie star": return(MovieStars.Take(3)); case "disease": return(Diseases.Take(3)); case "sport": return(Sports.Take(3)); case "something icky": return(IckySomethings.Take(3)); case "actor": return(Actors.Take(3)); case "concept or ideal": return(Concepts.Take(3)); default: return(new string[3] { string.Empty, string.Empty, string.Empty }); } }
public TableRecordModel ConstructRecordModel(int recno) { TableRecordModel newRecord = null; string tablename = name; // Need to reverse the name if BE if (BigEndian) { string rev = ConvertBE(name); tablename = rev; } switch (tablename) { case EditorModel.CITY_TABLE: newRecord = new CityRecord(recno, this, parentModel); break; case EditorModel.COACH_TABLE: { // coch table in streameddata is different than ros/fra if (parentModel.FileType == MaddenFileType.Streameddata) { newRecord = new CoachCollection(recno, this, parentModel); } else { newRecord = new CoachRecord(recno, this, parentModel); } break; } case EditorModel.SALARY_CAP_TABLE: newRecord = new SalaryCapRecord(recno, this, parentModel); break; case EditorModel.COACH_SLIDER_TABLE: newRecord = new CoachPrioritySliderRecord(recno, this, parentModel); break; case EditorModel.TEAM_CAPTAIN_TABLE: newRecord = new TeamCaptainRecord(recno, this, parentModel); break; case EditorModel.OWNER_TABLE: newRecord = new OwnerRecord(recno, this, parentModel); break; case EditorModel.DEPTH_CHART_TABLE: newRecord = new DepthChartRecord(recno, this, parentModel); break; case EditorModel.INJURY_TABLE: newRecord = new InjuryRecord(recno, this, parentModel); break; case EditorModel.PLAYER_TABLE: newRecord = new PlayerRecord(recno, this, parentModel); break; case EditorModel.TEAM_TABLE: newRecord = new TeamRecord(recno, this, parentModel); break; case EditorModel.SCHEDULE_TABLE: newRecord = new ScheduleRecord(recno, this, parentModel); break; case EditorModel.STADIUM_TABLE: newRecord = new StadiumRecord(recno, this, parentModel); break; case EditorModel.UNIFORM_TABLE: newRecord = new UniformRecord(recno, this, parentModel); break; // MADDEN DRAFT EDIT case EditorModel.DRAFT_PICK_TABLE: newRecord = new DraftPickRecord(recno, this, parentModel); break; case EditorModel.DRAFTED_PLAYERS_TABLE: newRecord = new RookieRecord(recno, this, parentModel); break; case EditorModel.BOXSCORE_DEFENSE_TABLE: newRecord = new BoxScoreDefenseRecord(recno, this, parentModel); break; case EditorModel.BOXSCORE_OFFENSE_TABLE: newRecord = new BoxScoreOffenseRecord(recno, this, parentModel); break; case EditorModel.CAREER_STATS_DEFENSE_TABLE: newRecord = new CareerStatsDefenseRecord(recno, this, parentModel); break; case EditorModel.CAREER_STATS_OFFENSE_TABLE: newRecord = new CareerStatsOffenseRecord(recno, this, parentModel); break; case EditorModel.SEASON_STATS_DEFENSE_TABLE: newRecord = new SeasonStatsDefenseRecord(recno, this, parentModel); break; case EditorModel.SEASON_STATS_OFFENSE_TABLE: newRecord = new SeasonStatsOffenseRecord(recno, this, parentModel); break; case EditorModel.TEAM_SEASON_STATS: newRecord = new TeamSeasonStatsRecord(recno, this, parentModel); break; case EditorModel.FRANCHISE_TIME_TABLE: newRecord = new FranchiseTimeRecord(recno, this, parentModel); break; case EditorModel.BOXSCORE_TEAM_TABLE: newRecord = new BoxScoreTeamStats(recno, this, parentModel); break; case EditorModel.BOXSCORE_OFFENSIVE_LINE_TABLE: newRecord = new BoxScoreOffensiveLineRecord(recno, this, parentModel); break; case EditorModel.SEASON_STATS_OFFENSIVE_LINE_TABLE: newRecord = new SeasonStatsOffensiveLineRecord(recno, this, parentModel); break; case EditorModel.CAREER_STATS_OFFENSIVE_LINE_TABLE: newRecord = new CareerStatsOffensiveLineRecord(recno, this, parentModel); break; case EditorModel.CAREER_GAMES_PLAYED_TABLE: newRecord = new CareerGamesPlayedRecord(recno, this, parentModel); break; case EditorModel.SEASON_GAMES_PLAYED_TABLE: newRecord = new SeasonGamesPlayedRecord(recno, this, parentModel); break; case EditorModel.CAREER_STATS_KICKPUNT_TABLE: newRecord = new CareerPuntKickRecord(recno, this, parentModel); break; case EditorModel.SEASON_STATS_KICKPUNT_TABLE: newRecord = new SeasonPuntKickRecord(recno, this, parentModel); break; case EditorModel.CAREER_STATS_KICKPUNT_RETURN_TABLE: newRecord = new CareerPKReturnRecord(recno, this, parentModel); break; case EditorModel.SEASON_STATS_KICKPUNT_RETURN_TABLE: newRecord = new SeasonPKReturnRecord(recno, this, parentModel); break; case EditorModel.SCOUTING_STATE_TABLE: newRecord = new ScoutingStateRecord(recno, this, parentModel); break; case EditorModel.RFA_STATE_TABLE: newRecord = new RFAStateRecord(recno, this, parentModel); break; case EditorModel.RFA_PLAYERS: newRecord = new RestrictedFreeAgentPlayers(recno, this, parentModel); break; case EditorModel.RFA_SALARY_TENDERS: newRecord = new RestrictedFreeAgentSigningTenders(recno, this, parentModel); break; case EditorModel.RESIGN_PLAYERS_STATE_TABLE: newRecord = new ResignPlayersStateRecord(recno, this, parentModel); break; case EditorModel.FREE_AGENCY_STATE_TABLE: newRecord = new FreeAgencyStateRecord(recno, this, parentModel); break; case EditorModel.DRAFT_STATE_TABLE: newRecord = new DraftStateRecord(recno, this, parentModel); break; case EditorModel.FRANCHISE_STAGE_TABLE: newRecord = new FranchiseStageRecord(recno, this, parentModel); break; case EditorModel.GAME_OPTIONS_TABLE: newRecord = new GameOptionRecord(recno, this, parentModel); break; case EditorModel.PLAYER_AWARDS_TABLE: newRecord = new YearlyAwards(recno, this, parentModel); break; case EditorModel.FREE_AGENT_PLAYERS: newRecord = new FreeAgentPlayers(recno, this, parentModel); break; case EditorModel.COACHES_EXPECTED_SALARY: newRecord = new CoachExpectedSalary(recno, this, parentModel); break; case EditorModel.COACHING_HISTORY_TABLE: newRecord = new CoachHistory(recno, this, parentModel); break; case EditorModel.PROGRESSION_SCHEDULE: newRecord = new ProgressionSchedule(recno, this, parentModel); break; case EditorModel.USER_OPTIONS_TABLE: newRecord = new UserOptionRecord(recno, this, parentModel); break; case EditorModel.TEAM_RIVAL_HISTORY: newRecord = new TeamRivalHistory(recno, this, parentModel); break; case EditorModel.PRO_BOWL_PLAYERS: newRecord = new ProBowlPlayer(recno, this, parentModel); break; case EditorModel.USER_INFO_TABLE: newRecord = new UserInfoRecord(recno, this, parentModel); break; #region Streamed Data case EditorModel.COLLEGES_TABLE: newRecord = new CollegesRecord(recno, this, parentModel); break; case EditorModel.PLAYER_FIRST_NAMES: newRecord = new FirstNames(recno, this, parentModel); break; case EditorModel.PLAYER_LAST_NAMES: newRecord = new LastNames(recno, this, parentModel); break; case EditorModel.ROLES_DEFINE: newRecord = new PRDF(recno, this, parentModel); break; case EditorModel.ROLES_INFO: newRecord = new RoleInfo(recno, this, parentModel); break; case EditorModel.ROLES_PLAYER_EFFECTS: newRecord = new RolePlayerEffects(recno, this, parentModel); break; case EditorModel.ROLES_TEAM_EFFECTS: newRecord = new RoleTeamEffects(recno, this, parentModel); break; case EditorModel.STATS_REQUIRED: newRecord = new SuperStarStatsRequired(recno, this, parentModel); break; case EditorModel.PROGRESSION: newRecord = new PlayerProgression(recno, this, parentModel); break; case EditorModel.REGRESSION: newRecord = new PlayerRegression(recno, this, parentModel); break; case EditorModel.PTCB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTCE: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTDE: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTDT: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTFB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTFS: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTGA: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTHB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTKI: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTKP: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTMB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTOB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTPU: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTQB: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTSS: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTTA: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTTE: newRecord = new ProgressionTracking(recno, this, parentModel); break; case EditorModel.PTWR: newRecord = new ProgressionTracking(recno, this, parentModel); break; #endregion case EditorModel.POSITION_SUBS: newRecord = new PlayerSubs(recno, this, parentModel); break; case EditorModel.DEPTH_CHART_SUBS: newRecord = new DepthChartSubs(recno, this, parentModel); break; case EditorModel.SALARY_CAP_INCREASE: newRecord = new SalaryCapIncrease(recno, this, parentModel); break; case EditorModel.PLAYER_MINIMUM_SALARY_TABLE: newRecord = new SalaryYearsPro(recno, this, parentModel); break; case EditorModel.PLAYER_SALARY_DEMAND_TABLE: newRecord = new PlayerSalaryDemands(recno, this, parentModel); break; case EditorModel.INACTIVE_TABLE: newRecord = new InactiveRecord(recno, this, parentModel); break; case EditorModel.LEAGUE_REVENUE_TABLE: newRecord = new LeagueRevenue(recno, this, parentModel); break; case EditorModel.OWNER_REVENUE_TABLE: newRecord = new OwnerRevenue(recno, this, parentModel); break; case EditorModel.WEEKLY_INCOME_TABLE: newRecord = new Income(recno, this, parentModel); break; case EditorModel.TEAM_WIN_LOSS_RECORD: newRecord = new TeamWinLossRecord(recno, this, parentModel); break; // DB Templates case EditorModel.PLAYER_OVERALL_CALC: newRecord = new OverallRecord(recno, this, parentModel); break; case EditorModel.PLAYBOOK_TABLE: newRecord = new FRAPlayBooks(recno, this, parentModel); break; default: newRecord = new TableRecordModel(recno, this, parentModel); break; } //Add the new record to our list of records recordList.Add(newRecord); return(newRecord); }
public static Host GenerateHost() => new Host { Name = $"{FirstNames.GetRandom()} {LastNames.GetRandom()}", Job = $"{Jobs1.GetRandom()} {Jobs2.GetRandom()}", ImageUrl = ImageUrls.GetRandom(), };
/// <summary> /// Returns a value indicating whether the provided string corresponds to a common last /// name in the English language. Lookups are performed in a case insensitive manner and /// currently do not respect plurality. /// </summary> /// <param name="text">The Name to lookup</param> /// <returns> /// <c>true</c> if the provided string corresponds to a common last name in the English /// language; otherwise, <c>false</c>. /// </returns> public bool IsLastName(string text) => LastNames.Contains(text);
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); }