/// <summary> /// Gets a random age. /// </summary> /// <param name="ageGroup">The (optional) age group.</param> /// <returns>An integer within the specified age group range.</returns> public static int RandomAge(AgeGroup ageGroup = AgeGroup.Any) { const int maximumAge = 120; const int minimumAge = 0; switch (ageGroup) { case AgeGroup.Any: return(RandomInteger(minimumAge, maximumAge)); case AgeGroup.Infant: return(RandomInteger(minimumAge, 1)); case AgeGroup.Toddler: return(RandomInteger(1, 3)); case AgeGroup.Preschooler: return(RandomInteger(3, 5)); case AgeGroup.Gradeschooler: return(RandomInteger(5, 12)); case AgeGroup.Teen: return(RandomInteger(12, 18)); case AgeGroup.Adult: return(RandomInteger(18, maximumAge)); case AgeGroup.Senior: return(RandomInteger(65, maximumAge)); default: return(RandomInteger(minimumAge, maximumAge)); } }
private decimal GetAgeMultiplier(AgeGroup ageGroup) { decimal factor; switch (ageGroup) { case AgeGroup.LessThanTwenty: factor = 0.01m; break; case AgeGroup.TwentyOneToForty: factor = 0.03m; break; case AgeGroup.FortyOneToSixty: factor = 0.05m; break; case AgeGroup.AboveSixty: default: factor = 0.08m; break; } return(factor); }
public async Task <IActionResult> Edit(int id, [Bind("Id,AgeGroupName")] AgeGroup ageGroup) { if (id != ageGroup.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ageGroup); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AgeGroupExists(ageGroup.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(ageGroup)); }
/// <summary> /// AgeGroup to string /// </summary> /// <param name="age"></param> /// <returns></returns> public static string AgeGroupToString(AgeGroup age) { String ageFilter = String.Empty; switch (age) { case AgeGroup.One: ageFilter = "0_24"; break; case AgeGroup.Two: ageFilter = "25_34"; break; case AgeGroup.Three: ageFilter = "35_44"; break; case AgeGroup.Four: ageFilter = "45_54"; break; case AgeGroup.Five: ageFilter = "55_64"; break; case AgeGroup.Six: ageFilter = "65_plus"; break; } return ageFilter; }
private void InitAgeGroup() { if (_db.AgeGroups.Count() > 0) { return; } string file = System.IO.File.ReadAllText("RawData/case_details_210320.json"); dynamic json = JsonConvert.DeserializeObject(file); List <AgeGroup> ageGroups = new List <AgeGroup>(); foreach (JObject record in json) { AgeGroup ageGroup = new AgeGroup(); ageGroup.Range = record["Age_Group"].ToString(); ageGroups.Add(ageGroup); } List <AgeGroup> distinct = ageGroups.DistinctBy(ag => ag.Range).ToList(); _db.AddRange(distinct); _db.SaveChanges(); }
private void GenerateCaseReceivedEvents( CaseReportData caseReportData, AgeGroup group, Sex sex, int count, int healthRiskNumber) { for (int i = 0; i < count; i++) { var caseRegistered = new CaseRegistered( Guid.NewGuid(), caseReportData.CaseReportId, (int)group, (int)sex, caseReportData.Latitude, caseReportData.Longitude, caseReportData.Timestamp, caseReportData.DataCollectorId, caseReportData.HealthRiskId, healthRiskNumber, caseReportData.PhoneNumber); Apply(caseRegistered); } }
public void UpdateDiaryFixture(int diaryId, AgeGroup @group, string homeOrAway, string detail, string link, string photos, string report, bool isLeague) { using (OleDbConnection cn = new OleDbConnection(connectionString)) { cn.Open(); var sql = String.Format(@"update Diary set Fixture{0}Detail = @FixtureDetail, Fixture{0}HA = @FixtureHA, Fixture{0}Link = @FixtureLink, Fixture{0}Photos = @FixturePhotos, Fixture{0}Report = @FixtureReport, Fixture{0}League = @FixtureLeague where DiaryId = {1}", group.ToString(), diaryId); var command = cn.CreateCommand(); command.CommandText = sql; command.Parameters.AddWithValue("FixtureDetail", detail); command.Parameters.AddWithValue("FixtureHA", homeOrAway); command.Parameters.AddWithValue("FixtureLink", link); command.Parameters.AddWithValue("FixturePhotos", photos); command.Parameters.AddWithValue("FixtureReport", report); command.Parameters.AddWithValue("FixtureLeague", isLeague); command.ExecuteNonQuery(); // var dates = cn.Execute(sql, parameters); } }
/// <summary> /// AgeGroup to string /// </summary> /// <param name="age"></param> /// <returns></returns> public static string AgeGroupToString(AgeGroup age) { String ageFilter = String.Empty; switch (age) { case AgeGroup.One: ageFilter = "0_24"; break; case AgeGroup.Two: ageFilter = "25_34"; break; case AgeGroup.Three: ageFilter = "35_44"; break; case AgeGroup.Four: ageFilter = "45_54"; break; case AgeGroup.Five: ageFilter = "55_64"; break; case AgeGroup.Six: ageFilter = "65_plus"; break; } return(ageFilter); }
public void OnGet() { Deaths = diagnosisService.Deaths(); Recovered = diagnosisService.Recovered(); Diagnoses = diagnosisService.GetDiagnosesWithCorona(); var Ddiagnoses = Diagnoses.GroupBy(x => 10 * ((DateTime.Now.Year - x.Patient.BirthDate.Year) / 10)); foreach (var item in Ddiagnoses.OrderBy(i => i.Key)) { AgeGroup.Add(new StatisticsCore { Age = item.Key.ToString() + "-" + $"{item.Key + 9}", TotalPatients = item.GroupBy(x => x.Patient.Name).Count() });; } var patientDeath = Deaths.GroupBy(x => 10 * ((DateTime.Now.Year - x.Patient.BirthDate.Year) / 10)); foreach (var item in patientDeath) { PatientDeath.Add(new StatisticsCore { Age = item.Key.ToString() + "-" + $"{item.Key + 9}", TotalPatients = item.GroupBy(x => x.Patient.Name).Count() }); } }
/// <summary> /// Helper method used to convert DataTable to list of AgeGroups. /// </summary> /// <param name="dataTable">The DataTable to be converted to list of AgeGroups</param> /// <returns>A list of AgeGroups from the database (empty list if the parameter is null)</returns> private List <AgeGroup> HandleData(DataTable dataTable) { List <AgeGroup> ageGroups = new List <AgeGroup>(); if (dataTable is null) { return(ageGroups); } dataTable.Rows.Cast <DataRow>().ToList().ForEach(row => { AgeGroup ageGroup = new AgeGroup() { Id = (int)row["Id"], Name = (string)row["Name"] }; if (row["MinAge"] != DBNull.Value) { ageGroup.MinAge = (byte)row["MinAge"]; } if (row["MaxAge"] != DBNull.Value) { ageGroup.MaxAge = (byte)row["MaxAge"]; } ageGroups.Add(ageGroup); }); return(ageGroups); }
public async Task <IHttpActionResult> PutAgeGroup(int id, AgeGroup ageGroup) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ageGroup.AgeGroupId) { return(BadRequest()); } db.Entry(ageGroup).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AgeGroupExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IEnumerable <EventCountDTO> GetEventsNumber() { IDbConnection con = DBUtils.getConnection(); IList <EventCountDTO> events = new List <EventCountDTO>(); using (var comm = con.CreateCommand()) { comm.CommandText = "SELECT Event, AgeGroup, COUNT(*) AS Number FROM (SELECT Event1 AS Event, AgeGroup FROM Entry UNION ALL SELECT Event2, AgeGroup FROM Entry WHERE Event2 != 'NONE') GROUP BY Event, AgeGroup;"; using (var dataR = comm.ExecuteReader()) { while (dataR.Read()) { Event Eventt = (Event)Enum.Parse(typeof(Event), dataR.GetString(0)); AgeGroup ageGroup = (AgeGroup)Enum.Parse(typeof(AgeGroup), dataR.GetString(1)); long Count = dataR.GetInt64(2); EventCountDTO eventt = new EventCountDTO { Event = Eventt, AgeGroup = ageGroup, Count = Count }; events.Add(eventt); } } } return(events); }
protected override ActionResult DisplayResultsView(RaceFilterViewModel filter) { var viewModel = new TriStatsViewModel(); viewModel.Filter = filter; List <Triathlete> allAthletes = GetAllAthletesForRaces(filter); var selectedAgeGroupIds = AgeGroup.Expand(filter.SelectedAgeGroupIds); var selectedGenderIds = Gender.Expand(filter.SelectedGenderIds); var athletes = new List <Triathlete>(); foreach (string raceId in filter.SelectedRaceIds) { var athletesPerRace = allAthletes.Where( a => a.RequestContext.RaceId.Equals(raceId, System.StringComparison.CurrentCultureIgnoreCase) && selectedAgeGroupIds.Contains(a.RequestContext.AgeGroupId) && selectedGenderIds.Contains(a.RequestContext.GenderId) ).ToList(); // new BasicDurationFilter() { } //bypass the user's duration filter so we can get all athletes, including DNFs athletes.AddRange(athletesPerRace); viewModel.Stats.Add( GetStats(athletesPerRace, filter.AvailableRaces.Single(r => r.RaceId == raceId))); } viewModel.Triathletes = athletes; return(View("Compare", viewModel)); }
internal decimal CalculateWith(Gender gender, AgeGroup ageGroup, Province province) { SubmitValuesInIndexPage(gender, ageGroup, province); remoteWebDriver.WaitUntilElementIsPresent(By.Id(ResultTextIdentifier)); return(decimal.Parse(remoteWebDriver.FindElementById(ResultTextIdentifier).Text)); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string ageGroupLabel = Properties.Resources.AgeGroupUnknown; if (value != null) { AgeGroup ageGroup = (AgeGroup)value; if (ageGroup == AgeGroup.Youth) { ageGroupLabel = Properties.Resources.AgeGroupYouth; } else if (ageGroup == AgeGroup.Adult) { ageGroupLabel = Properties.Resources.AgeGroupAdult; } else if (ageGroup == AgeGroup.MiddleAge) { ageGroupLabel = Properties.Resources.AgeGroupMiddleAge; } else if (ageGroup == AgeGroup.Senior) { ageGroupLabel = Properties.Resources.AgeGroupSenior; } } return(ageGroupLabel); }
private HypotheticalsViewModel GetEstimatedTime(RaceFilterViewModel filter) { var modelView = new HypotheticalsViewModel(); modelView.Filter = filter; string raceId = filter.SelectedRaceIds.First(); var athletes = _RaceService.GetAthletes( new BasicRaceCriteria { SelectedRaceIds = new string[] { raceId }, SelectedAgeGroupIds = AgeGroup.Expand(filter.SelectedAgeGroupIds), SelectedGenderIds = Gender.Expand(filter.SelectedGenderIds) }, filter ); modelView.Triathletes = athletes; modelView.Stats.Add(GetStats(athletes, filter.AvailableRaces.Single(r => r.RaceId == raceId))); modelView.SelectedSkillLevel = filter.SkillLevel; //TO-DO: fix this up so it removes the redundancy return(modelView); }
public List <IAgeGroup> Map(IDataReader from) { var list = new List <IAgeGroup>(); if (from == null) { return(list); } while (from.Read()) { var item = new AgeGroup(); if (!from.IsDBNull(0)) { item.Id = Convert.ToInt32(from["Id"]); } if (!from.IsDBNull(1)) { item.MinAge = Convert.ToInt32(from["MinAge"]); } if (!from.IsDBNull(2)) { item.MaxAge = Convert.ToInt32(from["MaxAge"]); } if (!from.IsDBNull(3)) { item.Description = from["Description"].ToString(); } ; list.Add(item); } return(list); }
public static string ToStravaString(this AgeGroup ageGroup) { switch (ageGroup) { case AgeGroup.From0To24: return("0_24"); case AgeGroup.From25To34: return("25_34"); case AgeGroup.From35To44: return("35_44"); case AgeGroup.From45To54: return("45_54"); case AgeGroup.From55To64: return("55_64"); case AgeGroup.From64: return("64Plus"); default: throw new NotSupportedException(string.Format("Unknown age group: {0}", ageGroup)); } }
public static Wealth RootWealth(AgeGroup group) { float det = Random.Range(0.0f, 1.0f); if (group == AgeGroup.youngAdult) { if (det <= 0.6f) { return(Wealth.poor); } else if (det <= 0.99f) { return(Wealth.middleClass); } else { return(Wealth.wealthy); } } else { if (det <= 0.2f) { return(Wealth.poor); } else if (det <= 0.98f) { return(Wealth.middleClass); } else { return(Wealth.wealthy); } } }
private static string GetRankingPageUrl(int year, Gender gender, AgeGroup ageGroup) { const string RankingWebPageTemplate = "http://www.iva.org.il/Ranking.asp?cYear={0}&cMode=0&GenderId={1}&level_id={2}"; int genderId = GetGenderId(gender); int levelId = GetLevelId(ageGroup); return(string.Format(RankingWebPageTemplate, year, genderId, levelId)); }
public void ValidateGroup(AgeGroup group, ModelStateDictionary ms) { if (_context.AgeGroups.Any(g => g.Value == group.Value)) { ms.AddModelError("Value", "Дане ім'я не є унікальним"); ms["Value"].ValidationState = ModelValidationState.Invalid; } }
public Questionnaire(int grade, string desc, string country, Gender gender, AgeGroup ageGroup) { Grade = grade; Description = desc; Country = country; Gender = gender; AgeGr = ageGroup; }
public object[] getEnumDisplayAnnotaion(AgeGroup group, int num) { var enumType = group.GetType(); var enumValue = Enum.GetName(enumType, num); var member = enumType.GetMember(enumValue)[0]; return(member.GetCustomAttributes(typeof(DisplayAttribute), false)); }
public DetailsViewModel(AgeGroup categoryName, List <Participant> participants) { var helper = new HelperFunctions(); var attr = helper.getEnumDisplayAnnotaion(categoryName, (int)categoryName); CategoryName = ((DisplayAttribute)attr[0]).Name; Participants = participants; }
public void CanCalculateAge() { Assert.Equal(50, AgeGroup.GetAgeOnDate(raceDate, DateTime.Parse("25/01/1965"))); Assert.Equal(20, AgeGroup.GetAgeOnDate(raceDate, DateTime.Parse("27/09/1995"))); Assert.Equal(19, AgeGroup.GetAgeOnDate(raceDate, DateTime.Parse("28/09/1995"))); Assert.Equal(20, AgeGroup.GetAgeOnDate(raceDate, DateTime.Parse("26/09/1995"))); Assert.Equal(29, AgeGroup.GetAgeOnDate(raceDate, DateTime.Parse("12/12/1985"))); Assert.Equal(29, AgeGroup.GetAgeOnDate(raceDate, DateTime.Parse("12/02/1986"))); }
public void UpdateAgeGroup(AgeGroup ageGroup) { var aG = GetAgeGropuById(ageGroup.AgeGroupID); aG.MaxAge = ageGroup.MaxAge; aG.MinAge = ageGroup.MinAge; aG.Name = ageGroup.Name; dbContext.SaveChanges(); }
public void AddAgeGroup(AgeGroup ageGroup) { if (ageGroup != null) { // dbContext.AgeGroups.Add(new AgeGroup { MaxAge = ageGroup.MaxAge, MinAge = ageGroup.MinAge, Name = ageGroup.Name }); dbContext.AgeGroups.Add(ageGroup); dbContext.SaveChanges(); } }
/// <summary> /// 키워드 순위를 제공 /// </summary> /// <param name="ageGroup">연령대</param> /// <returns>키워드 순위</returns> public async Task <IEnumerable <string> > ParseKeywordRankAsync(AgeGroup ageGroup) { var document = await GetHtmlDocumentAsync(); var keywordNodes = document .DocumentNode .SelectNodes($"//div[@class='keyword_carousel']//div[@data-age='{ageGroup.GetDataAge()}']//ul[@class='rank_list v2']//span[@class='title']"); return(keywordNodes.Select(n => n.InnerText).ToList()); }
private void GenPartner(RootPerson root) { gender = Generators.PartnerGender(root); ageGroup = Generators.PartnerAgeGroup(root); age = Generators.Age(ageGroup); skinColor = Generators.PartnerSkinColor(root); hairColor = Generators.RootHairColor(skinColor); eyeColor = Generators.RootEyeColor(skinColor); }
public async Task OnPostCreate([Bind("Value")] AgeGroup group) { ValidateGroup(group, ModelState); if (ModelState.IsValid) { _context.AgeGroups.Add(group); await _context.SaveChangesAsync(); } Groups = await _context.AgeGroups.ToListAsync(); }
public async Task <IHttpActionResult> GetAgeGroup(int id) { AgeGroup ageGroup = await db.AgeGroups.FindAsync(id); if (ageGroup == null) { return(NotFound()); } return(Ok(ageGroup)); }
//Increases the age and scale of a token public void Age() { if(age == AgeGroup.Cub){ age = AgeGroup.Adult; SetScale(AgeGroup.Adult); } if(age == AgeGroup.Baby){ age = AgeGroup.Cub; SetScale(AgeGroup.Cub); } if(age == AgeGroup.Adult){ Mama = null; } }
private IQueryable<CrashData> FilterAgeGroup(IQueryable<CrashData> crashes, AgeGroup ageGroup) { switch (ageGroup) { case AgeGroup.Unknown: break; case AgeGroup.Young: crashes = crashes.Where(x => x.YoungDriverCount > 0); break; case AgeGroup.MiddleAge: crashes = crashes.Where(x => x.DriverCount > x.YoungDriverCount + x.OldDriverCount); break; case AgeGroup.Old: crashes = crashes.Where(x => x.OldDriverCount > 0); break; default: throw new ArgumentOutOfRangeException("ageGroup", ageGroup, null); } return crashes; }
/// <summary> /// Gets the gender-filtered and age-filtered leaderboard of a segment. This method requires the currently authenticated /// athlete to have a Strava premium account. /// </summary> /// <param name="segmentId">The Strava segment Id.</param> /// <param name="gender">The gender used to filter the leaderboard.</param> /// /// <param name="age">The age range used to filter the leaderboard.</param> /// <returns>The leaderboard filtered by gender and age.</returns> public Leaderboard GetSegmentLeaderboard(String segmentId, Gender gender, AgeGroup age) { String getUrl = String.Format("{0}/{1}/leaderboard?gender={2}&age_group={3}&filter=age_group&access_token={4}", Endpoints.Leaderboard, segmentId, gender.ToString().Substring(0, 1), UrlHelper.AgeGroupToString(age), Authentication.AccessToken ); String json = WebRequest.SendGet(new Uri(getUrl)); return Unmarshaller<Leaderboard>.Unmarshal(json); }
public DiaryFixture GetDiaryFixture(int diaryId, AgeGroup group) { using (OleDbConnection cn = new OleDbConnection(connectionString)) { cn.Open(); var sql = String.Format(@"select DiaryId, [Date] as FixtureDate, Fixture{0}HA as FixtureHA, Fixture{0}Detail as FixtureDetail, Fixture{0}Link as FixtureLink, Fixture{0}Photos as FixturePhotos, Fixture{0}Report as FixtureReport, Fixture{0}League as FixtureLeague from Diary where DiaryId = @DiaryId", group.ToString()); var dates = cn.Query<DiaryFixture>(sql, new { DiaryId = diaryId }); return dates.First(); } }
public IEnumerable<DiaryFixture> GetAgeGroupDiaryNew(AgeGroup ageGroup) { var calendarId = 1; using (OleDbConnection cn = new OleDbConnection(connectionString)) { cn.Open(); var sql = String.Format(@"SELECT f.FixtureID AS DiaryId, cd.CalendarDate AS FixtureDate, f.Details AS FixtureDetail, f.HA AS FixtureHA, f.Link AS FixtureLink, f.Photos AS FixturePhotos, f.Report AS FixtureReport, f.League AS FixtureLeague FROM (CalendarDates cd LEFT OUTER JOIN (SELECT FixtureID, CalendarDateID, AgeGroup, Details, HA, Link, Photos, Report, League FROM Fixtures WHERE (AgeGroup = '{0}')) f ON f.CalendarDateID = cd.CalendarDateID) ORDER BY cd.CalendarDate", ageGroup.ToString()); return cn.Query<DiaryFixture>(sql, new { CalendarId = calendarId }); } }
public IEnumerable<DiaryFixture> GetAgeGroupDiary(AgeGroup ageGroup) { var calendarId = 1; using (OleDbConnection cn = new OleDbConnection(connectionString)) { cn.Open(); var sql = String.Format(@"select DiaryId, [Date] as FixtureDate, Fixture{0}HA as FixtureHA, Fixture{0}Detail as FixtureDetail, Fixture{0}Link as FixtureLink, Fixture{0}Photos as FixturePhotos, Fixture{0}Report as FixtureReport, Fixture{0}League as FixtureLeague, FixtureSocialDetail <> '' as IsSocial from Diary where CalendarId = @CalendarId order by [Date]", ageGroup.ToString()); return cn.Query<DiaryFixture>(sql, new { CalendarId = calendarId }); } }
private async Task<Leaderboard> GetLeaderboardInternal(int segmentId, int? page, int? perPage, Gender? gender, AgeGroup? ageGroup, bool following = false) { var request = new RestRequest(EndPoint + "/" + segmentId + "/leaderboard", Method.GET); if (page != null) request.AddParameter("page", page); if (perPage != null) request.AddParameter("per_page", perPage); request.AddParameter("following", following ? "true" : "false"); if (gender.HasValue) request.AddParameter("gender", gender.Value.ToStravaString()); if (ageGroup.HasValue) request.AddParameter("age_group", ageGroup.Value.ToStravaString()); var response = await _client.RestClient.Execute<Leaderboard>(request); return response.Data; }
public void SetScale(AgeGroup newAge) { age = newAge; if(age == AgeGroup.Adult) {baseSize = 1;} else if(age == AgeGroup.Cub) {baseSize = .75f;} else if(age == AgeGroup.Baby) {baseSize = .45f;} baseSize /= (6 - critter.GetSize()) *.25f; }
public Task<Leaderboard> GetLeaderboard(int segmentId, int page, int perPage, Gender? gender, AgeGroup? ageGroup) { return GetLeaderboardInternal(segmentId, page, perPage, gender, ageGroup); }
/// <summary> /// Gets the gender-filtered and age-filtered leaderboard of a segment. This method requires the currently authenticated /// athlete to have a Strava premium account. /// </summary> /// <param name="segmentId">The Strava segment Id.</param> /// <param name="gender">The gender used to filter the leaderboard.</param> /// /// <param name="age">The age range used to filter the leaderboard.</param> /// <returns>The leaderboard filtered by gender and age.</returns> public Leaderboard GetSegmentLeaderboard(String segmentId, Gender gender, AgeGroup age) { String ageFilter = String.Empty; switch (age) { case AgeGroup.One: ageFilter = "0_24"; break; case AgeGroup.Two: ageFilter = "25_34"; break; case AgeGroup.Three: ageFilter = "35_44"; break; case AgeGroup.Four: ageFilter = "45_54"; break; case AgeGroup.Five: ageFilter = "55_64"; break; case AgeGroup.Six: ageFilter = "65_plus"; break; } String getUrl = String.Format("{0}/{1}/leaderboard?gender={2}&age_group={3}&filter=age_group&access_token={4}", Endpoints.Leaderboard, segmentId, gender.ToString().Substring(0, 1), ageFilter, Authentication.AccessToken ); String json = WebRequest.SendGet(new Uri(getUrl)); return Unmarshaller<Leaderboard>.Unmarshal(json); }
public Movie(string name, int id, decimal price, int movieLength, string actor, int year, AgeGroup ageGroup) : this(name, id, price, movieLength, actor, year) { this.AgeGroup = ageGroup; }
public void SetAge(AgeGroup newAge) { age = newAge; }
/// <summary> /// Gets leaderboard for a segment. /// </summary> /// <param name="segmentId">ID of the segment.</param> /// <param name="gender"></param> /// <returns>Leaderboard of the segment</returns> public Task<Leaderboard> GetLeaderboard(int segmentId, Gender? gender, AgeGroup? ageGroup) { return GetLeaderboardInternal(segmentId, null, null, gender, ageGroup); }
public Game(string name, int id, decimal price, string creator, int year, string platform, AgeGroup ageGroup) : this(name, id, price, creator, year, platform) { this.AgeGroup = ageGroup; }
private void ParseAgeGroups(Parser parser) { parser.lineno++; if (parser.curr.indent == 0) return; var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { var agegroup = new AgeGroup(); if (parser.curr.kw != Parser.RegKeywords.None) throw parser.GetException("unexpected line"); agegroup.SmallGroup = parser.GetLine(); var m = parser.agerange.Match(agegroup.SmallGroup); if (!m.Success) { parser.lineno--; throw parser.GetException("expected age range like 0-12"); } agegroup.StartAge = m.Groups["start"].Value.ToInt(); agegroup.EndAge = m.Groups["end"].Value.ToInt(); if (parser.curr.indent <= startindent) throw parser.GetException("expected either indented SmallGroup or Fee"); var ind = parser.curr.indent; while (parser.curr.indent == ind) { switch (parser.curr.kw) { case Parser.RegKeywords.SmallGroup: agegroup.SmallGroup = parser.GetString(agegroup.SmallGroup); break; case Parser.RegKeywords.Fee: agegroup.Fee = parser.GetDecimal(); break; default: throw parser.GetException("unexpected line"); } } AgeGroups.Add(agegroup); } }