public void RunBeforeEachTest()
 {
     _DesiredTraits = new List<TraitVM>();
     _Bull = new SaleBull();
     _SystemUnderTest = new TraitMatcher();
     _DesiredValue = null;
 }
        public void OneInPercentile()
        {
            // arrange
            _Bull = new SaleBull { BW_EBV = 0M, WWD_EBV = 2501M };

            Act();

            // only 1 of the desired traits matched (BW_EBV)
            Assert.AreEqual(1, NumberOfMatches());
            Assert.AreEqual(BullSaleViewNameEnum.WWD_EBV, _BullTraits.First(x => x.Qualifies).Trait.BullSaleView);
            Assert.AreEqual(2501M.ToString(CultureInfo.InvariantCulture), _BullTraits.First(x => x.Qualifies).BullValue);
        }
        public void BothNotInPercentile()
        {
            // arrange
            _Bull = new SaleBull { BW_EBV = 38M, WWD_EBV = 2499.99M };

            Act();

            // assert
            Assert.AreEqual(0, NumberOfMatches());
        }
        public void BothOnPercentile()
        {
            // arrange
            _Bull = new SaleBull { BW_EBV = 39M, WWD_EBV = 2500M };

            Act();

            // assert
            Assert.AreEqual(2, NumberOfMatches());
        }
        public void BothInPercentile()
        {
            // arrange
            _Bull = new SaleBull { BW_EBV = 39.5M, WWD_EBV = 2500.001M};

            Act();

            // only 1 of the desired traits matched (BW_EBV)
            Assert.AreEqual(2, NumberOfMatches());
        }
        public void OnPercentile()
        {
            // arrange
            _Bull = new SaleBull {BW_EBV = 39M};

            Act();

            // assert
            Assert.AreEqual(1, NumberOfMatches());
        }
        public void Removes_least_desireable_trait()
        {
            var matchesAll = new SaleBull
                {
                    Calf_Id = "MatchesBWTWWTYWT",
                    BW_ADJ = (BWTMn + BWTMx)/2,
                    WW_ADJ = (WwtMn + WwtMx)/2,
                    YW_ADJ = (YwtMn + YwtMx)/2,
                    SEL_IDX = 1
                };

            var matchesTop2 = new SaleBull
                {
                    Calf_Id = "MatchesBWTWWT",
                    BW_ADJ = matchesAll.BW_ADJ + 1,
                    WW_ADJ = matchesAll.WW_ADJ + 1,
                    YW_ADJ = matchesAll.YW_ADJ + 1000,
                    SEL_IDX = 2
                };

            var matchesTop1 = new SaleBull
                {
                    Calf_Id = "MatchesBWT",
                    BW_ADJ = matchesAll.BW_ADJ + 1,
                    WW_ADJ = matchesAll.WW_ADJ + 1000,
                    YW_ADJ = matchesAll.YW_ADJ + 1000,
                    SEL_IDX = 3
                };

            var bullList = new List<SaleBull>
                {
                    matchesTop1,
                    matchesTop2,
                    matchesAll
                };

            var desiredTraits = new List<TraitVM>
                {
                    new TraitVM
                        {
                            Sequence = 1,
                            BullSaleView = BullSaleViewNameEnum.BW_ADJ,
                            RangeMinValue = BWTMn.ToString(CultureInfo.InvariantCulture),
                            RangeMaxValue = BWTMx.ToString(CultureInfo.InvariantCulture)
                        },
                    new TraitVM
                        {
                            Sequence = 2,
                            BullSaleView = BullSaleViewNameEnum.WW_ADJ,
                            RangeMinValue = WwtMn.ToString(CultureInfo.InvariantCulture),
                            RangeMaxValue = WwtMx.ToString(CultureInfo.InvariantCulture)
                        },
                    new TraitVM
                        {
                            Sequence = 3,
                            BullSaleView = BullSaleViewNameEnum.YW_ADJ,
                            RangeMinValue = YwtMn.ToString(CultureInfo.InvariantCulture),
                            RangeMaxValue = YwtMx.ToString(CultureInfo.InvariantCulture)
                        }
                };
            var search = new PredictabullServices.Search(bullList, desiredTraits, null);
            var results = search.QualifyBulls();
            Assert.AreEqual(3, results.Count);
            Assert.AreEqual(3, results.First().Bull.SEL_IDX);
            Assert.AreEqual(1, results.Last().Bull.SEL_IDX);
        }
        public IEnumerable<BullTrait> QualifyTraitSet(SaleBull bull, IEnumerable<TraitVM> traitSet,
                                                      IEnumerable<StrainPercentiles> percentiles)
        {
            _bullTraits.Clear();
            IList<StrainPercentiles> listOfPercentiles = (percentiles == null)
                                                             ? new List<StrainPercentiles>()
                                                             : percentiles.ToList();

            foreach (TraitVM trait in traitSet)
            {
                StrainPercentiles percentile = (trait.Percentile)
                                                   ? LookupStrainPercentile(listOfPercentiles, trait.BullSaleView)
                                                   : null;
                BullTrait bullTrait;
                switch (trait.BullSaleView)
                {
                    case BullSaleViewNameEnum.TagColour:
                        bullTrait = StringMatches(trait, bull.TagColour);                       
                        break;

                    case BullSaleViewNameEnum.HideColour_Code:
                        bullTrait = StringMatches(trait, bull.HideColour_Code);                       
                        break;

                        // Percentiles
                    case BullSaleViewNameEnum.SEL_IDX:
                        bullTrait = WithInPercentile(trait, percentile, bull.SEL_IDX);
                        break;

                    case BullSaleViewNameEnum.BW_EBV:
                        bullTrait = WithInPercentile(trait, percentile, bull.BW_EBV);
                        break;

                    case BullSaleViewNameEnum.WWD_EBV:
                        bullTrait = WithInPercentile(trait, percentile, bull.WWD_EBV);
                        break;

                    case BullSaleViewNameEnum.WWM_EBV:
                        bullTrait = WithInPercentile(trait, percentile, bull.WWM_EBV);
                        break;

                    case BullSaleViewNameEnum.YWT_EBV:
                        bullTrait = WithInPercentile(trait, percentile, bull.YWT_EBV);
                        break;

                    case BullSaleViewNameEnum.H18M_EBV:
                        bullTrait = WithInPercentile(trait, percentile, bull.H18M_EBV);
                        break;

                    case BullSaleViewNameEnum.SC_EBV:
                        bullTrait = WithInPercentile(trait, percentile, bull.SC_EBV);
                        break;

                    case BullSaleViewNameEnum.BF_EBV:
                        bullTrait = WithInPercentile(trait, percentile, bull.BF_EBV);
                        break;

                    case BullSaleViewNameEnum.MW_EBV:
                        bullTrait = WithInPercentile(trait, percentile, bull.MW_EBV);
                        break;

                        // Note: not calculating percentiles for RFI...
                    case BullSaleViewNameEnum.RFI_EBV:
                        bullTrait = WithInPercentile(trait, percentile, bull.RFI_EBV);
                        break;

                        // Adjusted
                    case BullSaleViewNameEnum.BW_ADJ:
                        bullTrait = InDecimalRange(trait, bull.BW_ADJ);
                        break;

                    case BullSaleViewNameEnum.WW_ADJ:
                        bullTrait = InDecimalRange(trait, bull.WW_ADJ);
                        break;


                    case BullSaleViewNameEnum.ADG_BW_ADJ:
                        bullTrait = InDecimalRange(trait, bull.ADG_BW_ADJ);
                        break;

                    case BullSaleViewNameEnum.YW_ADJ:
                        bullTrait = InDecimalRange(trait, bull.YW_ADJ);
                        break;

                    case BullSaleViewNameEnum.H18MW_ADJ:
                        bullTrait = InDecimalRange(trait, bull.H18MW_ADJ);
                        break;

                    case BullSaleViewNameEnum.BACKFAT_ADJ:
                        bullTrait = InDecimalRange(trait, bull.BACKFAT_ADJ);
                        break;

                    case BullSaleViewNameEnum.SCROTCIRC_ADJ:
                        bullTrait = InDecimalRange(trait, bull.SCROTCIRC_ADJ);
                        break;

                    case BullSaleViewNameEnum.Stn_ADG:
                        bullTrait = InDecimalRange(trait, bull.Stn_ADG);
                        break;

                        // Performance
                    case BullSaleViewNameEnum.Morph:
                        bullTrait = InDecimalRange(trait, bull.Morph);
                        break;

                    case BullSaleViewNameEnum.Motil:
                        bullTrait = InDecimalRange(trait, bull.Motil);
                        break;

                    case BullSaleViewNameEnum.Conc:
                        bullTrait = InDecimalRange(trait, bull.Conc);
                        break;

                    case BullSaleViewNameEnum.Disp:
                        bullTrait = InDecimalRange(trait, bull.Disp);
                        break;

                    case BullSaleViewNameEnum.FFHH:
                        bullTrait = FeetLegs(trait, bull.FF, bull.HF);
/*
                        string ff = InIntegerRange(trait, bull.FF);
                        string hf = InIntegerRange(trait, bull.HF);
                        if (!string.IsNullOrEmpty(ff) && !string.IsNullOrEmpty(hf))
                            bullValue = bull.FF.ToString(CultureInfo.InvariantCulture) + "/" +
                                        bull.HF.ToString(CultureInfo.InvariantCulture);
*/
                        break;

                    case BullSaleViewNameEnum.FLHL:
                        bullTrait = FeetLegs(trait, bull.FL, bull.HL);
/*
                        string fl = InIntegerRange(trait, bull.FL);
                        string hl = InIntegerRange(trait, bull.HL);
                        if (!string.IsNullOrEmpty(fl) && !string.IsNullOrEmpty(hl))
                            bullValue = bull.FL.ToString(CultureInfo.InvariantCulture) + "/" +
                                        bull.HL.ToString(CultureInfo.InvariantCulture);
*/
                        break;


                        // Dam
                    case BullSaleViewNameEnum.AgeOfDam:
                        bullTrait = InDecimalRange(trait, bull.AgeOfDam);
                        break;

                    case BullSaleViewNameEnum.Teat:
                        bullTrait = InDecimalRange(trait, bull.Teat);
                        break;

                    case BullSaleViewNameEnum.Udder:
                        bullTrait = InDecimalRange(trait, bull.Udder);
                        break;

                    case BullSaleViewNameEnum.Dam_Wt:
                        bullTrait = InDecimalRange(trait, bull.Dam_Wt);
                        break;

                    default:

                        throw new ArgumentException(
                            string.Format("Trait with BullSaleView = {0} was not found in bull {1}",
                                          trait.BullSaleView, bull.Calf_Id));
                }
                _bullTraits.Add(bullTrait);
            }
            return _bullTraits;
        }
        private IEnumerable<SaleBull> ReadData(SqlDataReader rdr)
        {
            var lst = new List<SaleBull>();

            int ordCalfSN = rdr.GetOrdinal("Calf_SN");
            int ordStrainCode = rdr.GetOrdinal("Strain_Code");
            int ordHerdCode = rdr.GetOrdinal("Herd_Code");
            int ordYrCode = rdr.GetOrdinal("Yr_Code");
            int ordTagNum = rdr.GetOrdinal("Tag_Num");
            int ordCalfId = rdr.GetOrdinal("Calf_Id");
            int ordBirthDate = rdr.GetOrdinal("Birth_Date");
            int ordCalfRawBirthWt = rdr.GetOrdinal("RawBirth_Wt");
            int ordFeedlotId = rdr.GetOrdinal("Feedlot_Id");
            int ordPen = rdr.GetOrdinal("Pen");
            int ordHideColourCode = rdr.GetOrdinal("HideColour_Code");
            int ordSireCalfId = rdr.GetOrdinal("SireCalf_Id");

            int ordDamId = rdr.GetOrdinal("Dam_Id");
            int ordAgeOfDam = rdr.GetOrdinal("AgeOfDam");
            int ordDamWt = rdr.GetOrdinal("Dam_Wt");
            int ordTeat = rdr.GetOrdinal("Teat");
            int ordUdder = rdr.GetOrdinal("Udder");
            int ordFf = rdr.GetOrdinal("FF");
            int ordFl = rdr.GetOrdinal("FL");
            int ordHf = rdr.GetOrdinal("HF");
            int ordHl = rdr.GetOrdinal("HL");
            int ordMorph = rdr.GetOrdinal("Morph");
            int ordMotil = rdr.GetOrdinal("Motil");
            int ordConc = rdr.GetOrdinal("Conc");
            int ordDisp = rdr.GetOrdinal("Disp");

            int ordBWAdj = rdr.GetOrdinal("BW_ADJ");
            int ordWwAdj = rdr.GetOrdinal("WW_ADJ");
            int ordYwAdj = rdr.GetOrdinal("YW_ADJ");
            int ordH18MwAdj = rdr.GetOrdinal("H18MW_ADJ");
            int ordADGBWAdj = rdr.GetOrdinal("ADG_BW_ADJ");
            int ordBackfatAdj = rdr.GetOrdinal("BACKFAT_ADJ");
            int ordScrotcircAdj = rdr.GetOrdinal("SCROTCIRC_ADJ");

            int ordBWEbv = rdr.GetOrdinal("BW_EBV");
            int ordWwdEbv = rdr.GetOrdinal("WWD_EBV");
            int ordYwtEbv = rdr.GetOrdinal("YWT_EBV");
            int ordScEbv = rdr.GetOrdinal("SC_EBV");
            int ordBfEbv = rdr.GetOrdinal("BF_EBV");
            int ordWwmEbv = rdr.GetOrdinal("WWM_EBV");
            int ordMwEbv = rdr.GetOrdinal("MW_EBV");
            int ordRfiEbv = rdr.GetOrdinal("RFI_EBV");
            int ordH18MEbv = rdr.GetOrdinal("H18M_EBV");

            int ordBWEbvRel = rdr.GetOrdinal("BW_EBV_REL");
            int ordWwdEbvRel = rdr.GetOrdinal("WWD_EBV_REL");
            int ordYwtEbvRel = rdr.GetOrdinal("YWT_EBV_REL");
            int ordScEbvRel = rdr.GetOrdinal("SC_EBV_REL");
            int ordBfEbvRel = rdr.GetOrdinal("BF_EBV_REL");
            int ordWwmEbvRel = rdr.GetOrdinal("WWM_EBV_REL");
            int ordMwEbvRel = rdr.GetOrdinal("MW_EBV_REL");
            int ordRfiEbvRel = rdr.GetOrdinal("RFI_EBV_REL");
            int ordH18MEbvRel = rdr.GetOrdinal("H18M_EBV_REL");

            int ordStnADG = rdr.GetOrdinal("Stn_ADG");
            int ordSelIdx = rdr.GetOrdinal("SEL_IDX");

            //int ordBreederDay = rdr.GetOrdinal("BreederDay");
            int ordSaleDate = rdr.GetOrdinal("SaleDate");
            int ordSelectionNum = rdr.GetOrdinal("SelectionNum");
            int ordAccountNo = rdr.GetOrdinal("AccountNo");
            int ordInvNum = rdr.GetOrdinal("InvNum");
            int ordTagColour = rdr.GetOrdinal("TagColour");
            int ordPriceCdn = rdr.GetOrdinal("Price_Cdn");


            if (rdr.HasRows)
            {
                while (rdr.Read())
                {
                    var saleBull = new SaleBull
                        {
                            Calf_SN = ((int)
                                       ParameterUtils.SafeGetValue(rdr.GetValue(ordCalfSN), typeof (int),
                                                                   Constants.InitializeInt)),
                            Strain_Code = ((string)
                                           ParameterUtils.SafeGetValue(rdr.GetValue(ordStrainCode), typeof (string),
                                                                       Constants.InitializeString)),
                            Herd_Code = ((string)
                                         ParameterUtils.SafeGetValue(rdr.GetValue(ordHerdCode), typeof (string),
                                                                     Constants.InitializeString)),
                            Yr_Code = ((string)
                                       ParameterUtils.SafeGetValue(rdr.GetValue(ordYrCode), typeof (string),
                                                                   Constants.InitializeString)),
                            Calf_Id = ((string)
                                       ParameterUtils.SafeGetValue(rdr.GetValue(ordCalfId), typeof (string),
                                                                   Constants.InitializeString)),
                            Birth_Date = ((DateTime)
                                          ParameterUtils.SafeGetValue(rdr.GetValue(ordBirthDate), typeof (DateTime),
                                                                      Constants.InitializeDateTime)),
                            RawBirth_Wt =
                                (Int16) ParameterUtils.SafeGetValue(rdr.GetValue(ordCalfRawBirthWt), typeof (Int16),
                                                                    Constants.InitializeShort),
                            Feedlot_Id = ((string)
                                          ParameterUtils.SafeGetValue(rdr.GetValue(ordFeedlotId), typeof (string),
                                                                      Constants.InitializeString)),
                            Pen = ((string)
                                   ParameterUtils.SafeGetValue(rdr.GetValue(ordPen), typeof (string),
                                                               Constants.InitializeString)),
                            HideColour_Code = ((string)
                                               ParameterUtils.SafeGetValue(rdr.GetValue(ordHideColourCode),
                                                                           typeof (string),
                                                                           Constants.InitializeString)),
                            Tag_Num = ((int)
                                       ParameterUtils.SafeGetValue(rdr.GetValue(ordTagNum), typeof (int),
                                                                   Constants.InitializeInt)),
                            SireCalf_Id = ((string)
                                           ParameterUtils.SafeGetValue(rdr.GetValue(ordSireCalfId), typeof (string),
                                                                       Constants.InitializeString)),
                            Dam_Id = ((string)
                                      ParameterUtils.SafeGetValue(rdr.GetValue(ordDamId), typeof (string),
                                                                  Constants.InitializeString)),
                            AgeOfDam = ((Int16)
                                        ParameterUtils.SafeGetValue(rdr.GetValue(ordAgeOfDam), typeof (Int16),
                                                                    Constants.InitializeShort)),
                            Dam_Wt = ((Int16)
                                      ParameterUtils.SafeGetValue(rdr.GetValue(ordDamWt), typeof (Int16),
                                                                  Constants.InitializeShort)),
                            Teat = ((byte)
                                    ParameterUtils.SafeGetValue(rdr.GetValue(ordTeat), typeof (byte),
                                                                Constants.InitializeByte)),
                            Udder = ((byte)
                                     ParameterUtils.SafeGetValue(rdr.GetValue(ordUdder), typeof (byte),
                                                                 Constants.InitializeByte)),
                            FF = ((byte)
                                  ParameterUtils.SafeGetValue(rdr.GetValue(ordFf), typeof (byte),
                                                              Constants.InitializeByte)),
                            FL = ((byte)
                                  ParameterUtils.SafeGetValue(rdr.GetValue(ordFl), typeof (byte),
                                                              Constants.InitializeByte)),
                            HF = ((byte)
                                  ParameterUtils.SafeGetValue(rdr.GetValue(ordHf), typeof (byte),
                                                              Constants.InitializeByte)),
                            HL = ((byte)
                                  ParameterUtils.SafeGetValue(rdr.GetValue(ordHl), typeof (byte),
                                                              Constants.InitializeByte)),
                            Morph = ((byte)
                                     ParameterUtils.SafeGetValue(rdr.GetValue(ordMorph), typeof (byte),
                                                                 Constants.InitializeByte)),
                            Motil = ((byte)
                                     ParameterUtils.SafeGetValue(rdr.GetValue(ordMotil), typeof (byte),
                                                                 Constants.InitializeByte)),
                            Conc = ((byte)
                                    ParameterUtils.SafeGetValue(rdr.GetValue(ordConc), typeof (byte),
                                                                Constants.InitializeByte)),
                            Disp = ((byte)
                                    ParameterUtils.SafeGetValue(rdr.GetValue(ordDisp), typeof (byte),
                                                                Constants.InitializeByte)),
                            BW_ADJ = ((Int16)
                                      ParameterUtils.SafeGetValue(rdr.GetValue(ordBWAdj), typeof (Int16),
                                                                  Constants.InitializeShort)),
                            WW_ADJ = ((Int16)
                                      ParameterUtils.SafeGetValue(rdr.GetValue(ordWwAdj), typeof (Int16),
                                                                  Constants.InitializeShort)),
                            YW_ADJ = ((Int16)
                                      ParameterUtils.SafeGetValue(rdr.GetValue(ordYwAdj), typeof (Int16),
                                                                  Constants.InitializeShort)),
                            H18MW_ADJ = ((Int16)
                                         ParameterUtils.SafeGetValue(rdr.GetValue(ordH18MwAdj), typeof (Int16),
                                                                     Constants.InitializeShort)),
                            ADG_BW_ADJ = ((decimal)
                                          ParameterUtils.SafeGetValue(rdr.GetValue(ordADGBWAdj), typeof (decimal),
                                                                      Constants.InitializeDecimal)),
                            BACKFAT_ADJ = ((Int16)
                                           ParameterUtils.SafeGetValue(rdr.GetValue(ordBackfatAdj), typeof (Int16),
                                                                       Constants.InitializeShort)),
                            SCROTCIRC_ADJ = ((decimal)
                                             ParameterUtils.SafeGetValue(rdr.GetValue(ordScrotcircAdj), typeof (decimal),
                                                                         Constants.InitializeDecimal)),
                            BW_EBV = ((decimal)
                                      ParameterUtils.SafeGetValue(rdr.GetValue(ordBWEbv), typeof (decimal),
                                                                  Constants.InitializeDecimal)),
                            WWD_EBV = ((decimal)
                                       ParameterUtils.SafeGetValue(rdr.GetValue(ordWwdEbv), typeof (decimal),
                                                                   Constants.InitializeDecimal)),
                            YWT_EBV = ((decimal)
                                       ParameterUtils.SafeGetValue(rdr.GetValue(ordYwtEbv), typeof (decimal),
                                                                   Constants.InitializeDecimal)),
                            SC_EBV = ((decimal)
                                      ParameterUtils.SafeGetValue(rdr.GetValue(ordScEbv), typeof (decimal),
                                                                  Constants.InitializeDecimal)),
                            BF_EBV = ((decimal)
                                      ParameterUtils.SafeGetValue(rdr.GetValue(ordBfEbv), typeof (decimal),
                                                                  Constants.InitializeDecimal)),
                            WWM_EBV = ((decimal)
                                       ParameterUtils.SafeGetValue(rdr.GetValue(ordWwmEbv), typeof (decimal),
                                                                   Constants.InitializeDecimal)),
                            MW_EBV = ((decimal)
                                      ParameterUtils.SafeGetValue(rdr.GetValue(ordMwEbv), typeof (decimal),
                                                                  Constants.InitializeDecimal)),
                            RFI_EBV = ((decimal)
                                       ParameterUtils.SafeGetValue(rdr.GetValue(ordRfiEbv), typeof (decimal),
                                                                   Constants.InitializeDecimal)),
                            H18M_EBV = ((decimal)
                                        ParameterUtils.SafeGetValue(rdr.GetValue(ordH18MEbv), typeof (decimal),
                                                                    Constants.InitializeDecimal)),
                            BW_EBV_REL = ((decimal)
                                          ParameterUtils.SafeGetValue(rdr.GetValue(ordBWEbvRel), typeof (decimal),
                                                                      Constants.InitializeDecimal)),
                            WWD_EBV_REL = ((decimal)
                                           ParameterUtils.SafeGetValue(rdr.GetValue(ordWwdEbvRel), typeof (decimal),
                                                                       Constants.InitializeDecimal)),
                            YWT_EBV_REL = ((decimal)
                                           ParameterUtils.SafeGetValue(rdr.GetValue(ordYwtEbvRel), typeof (decimal),
                                                                       Constants.InitializeDecimal)),
                            SC_EBV_REL = ((decimal)
                                          ParameterUtils.SafeGetValue(rdr.GetValue(ordScEbvRel), typeof (decimal),
                                                                      Constants.InitializeDecimal)),
                            BF_EBV_REL = ((decimal)
                                          ParameterUtils.SafeGetValue(rdr.GetValue(ordBfEbvRel), typeof (decimal),
                                                                      Constants.InitializeDecimal)),
                            WWM_EBV_REL = ((decimal)
                                           ParameterUtils.SafeGetValue(rdr.GetValue(ordWwmEbvRel), typeof (decimal),
                                                                       Constants.InitializeDecimal)),
                            MW_EBV_REL = ((decimal)
                                          ParameterUtils.SafeGetValue(rdr.GetValue(ordMwEbvRel), typeof (decimal),
                                                                      Constants.InitializeDecimal)),
                            RFI_EBV_REL = ((decimal)
                                           ParameterUtils.SafeGetValue(rdr.GetValue(ordRfiEbvRel), typeof (decimal),
                                                                       Constants.InitializeDecimal)),
                            H18M_EBV_REL = ((decimal)
                                            ParameterUtils.SafeGetValue(rdr.GetValue(ordH18MEbvRel), typeof (decimal),
                                                                        Constants.InitializeDecimal)),
                            Stn_ADG = ((decimal)
                                       ParameterUtils.SafeGetValue(rdr.GetValue(ordStnADG), typeof (decimal),
                                                                   Constants.InitializeDecimal)),
                            SEL_IDX = ((decimal)
                                       ParameterUtils.SafeGetValue(rdr.GetValue(ordSelIdx), typeof (decimal),
                                                                   Constants.InitializeDecimal)),
                            /*
                                                    BreederDay = ((bool)
                                                                  ParameterUtils.SafeGetValue(rdr.GetBoolean(ordBreederDay), typeof (bool), false)),
                        */

                            AccountNo = ((string)
                                         ParameterUtils.SafeGetValue(rdr.GetValue(ordAccountNo), typeof (string),
                                                                     Constants.InitializeString)),
                            InvNum = ((int)
                                      ParameterUtils.SafeGetValue(rdr.GetValue(ordInvNum), typeof (int),
                                                                  Constants.InitializeInt)),
                            Price_Cdn = ((decimal)
                                         ParameterUtils.SafeGetValue(rdr.GetValue(ordPriceCdn), typeof (decimal),
                                                                     Constants.InitializeDecimal)),
                            SaleDate = ((DateTime)
                                        ParameterUtils.SafeGetValue(rdr.GetValue(ordSaleDate), typeof (DateTime),
                                                                    Constants.InitializeDateTime)),
                            SelectionNum = ((int)
                                            ParameterUtils.SafeGetValue(rdr.GetValue(ordSelectionNum), typeof (int),
                                                                        Constants.InitializeInt)),
                            TagColour = ((string)
                                         ParameterUtils.SafeGetValue(rdr.GetValue(ordTagColour), typeof (string),
                                                                     Constants.InitializeString))
                        };

                    lst.Add(saleBull);
                }
            }
            return lst;
        }