コード例 #1
0
 public static AgeBandInfo GetAgeBandFromEnum(AgeBand ageBandPassed)
 {
     int fromAge = GetFromAgeOfBand(ageBandPassed);
     int thruAge = GetThruAgeOfBand(ageBandPassed);
     AgeBandInfo newAgeBandInfo = new AgeBandInfo(ageBandPassed, fromAge, thruAge);
     return newAgeBandInfo;
 }
コード例 #2
0
        public static AgeBandInfo GetAgeBandFromName(string ageBandNamePassed)
        {
            AgeBandInfo newAgeBandInfo = new AgeBandInfo();
            if (CheckIfAgeBandPassedValid(ageBandNamePassed))
            {
                AgeBand newAgeBand = (AgeBand)Enum.Parse(typeof(AgeBand), ageBandNamePassed);
                newAgeBandInfo = GetAgeBandFromEnum(newAgeBand);
            }
            else
            {
                newAgeBandInfo.Errors.Add(new ErrorBase());
            }

            return newAgeBandInfo;
        }