Beispiel #1
0
        private bool TopBrisRating(BrisRace race, BrisHorse horse, Horse myhorse)
        {
            if (myhorse.Scratched || horse.IsFirstTimeOut || horse.BestRating <= 0)
            {
                return false;
            }

            List<BrisHorse> list = new List<BrisHorse>();

            foreach (BrisHorse brisHorse in race.Horses)
            {
                Horse h = myhorse.Parent.GetHorseByProgramNumber(brisHorse.ProgramNumber);

                if ((null != h) && (!h.Scratched) && (brisHorse.BestRating > 0))
                {
                    list.Add(brisHorse);
                }
            }

            list.Sort(CompareBestRating);

            if (list.Count <= 2)
            {
                return false;
            }
            else
            {
                return list[0] == horse;
            }
        }
Beispiel #2
0
        public double GetBestPrimePower(BrisHorse brisHorse)
        {
            return (double)brisHorse.PrimePowerRating;
            //return (double)brisHorse.BestRating;

               // return (double)brisHorse.DeltaLoverFigure;
        }
        static int Compare(BrisHorse h1, BrisHorse h2)
        {
            double f1 = h1.BrisAvgClassRatingLastThree;
            double f2 = h2.BrisAvgClassRatingLastThree;

            if (f1 > f2)
            {
                return -1;
            }
            else if (f1 < f2)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }
        static int Compare(BrisHorse h1, BrisHorse h2)
        {
            int f1 = h1.BrisCompositeLastThree;
            int f2 = h2.BrisCompositeLastThree;

            if (f1 > f2)
            {
                return -1;
            }
            else if (f1 < f2)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }
Beispiel #5
0
        static int ComparePowerRating(BrisHorse h1, BrisHorse h2)
        {
            int f1 = h1.PrimePowerRating;
            int f2 = h2.PrimePowerRating;

            if (f1 > f2)
            {
                return -1;
            }
            else if (f1 < f2)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }
Beispiel #6
0
        static int CompareBestRating(BrisHorse h1, BrisHorse h2)
        {
            int f1 = h1.BestRating;
            int f2 = h2.BestRating;

            if (f1 > f2)
            {
                return -1;
            }
            else if (f1 < f2)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }
Beispiel #7
0
        static int Compare(BrisHorse h1, BrisHorse h2)
        {
            int f1 = h1.BrisLateAvg;
            int f2 = h2.BrisLateAvg;

            if (f1 > f2)
            {
                return -1;
            }
            else if (f1 < f2)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }
        public void BindHorse(BrisHorse brisHorse)
        {
            _grid.Columns.Clear();
            _grid.Columns.Add("Date", "Date");
            _grid.Columns.Add("Track", "Track");
            _grid.Columns.Add("ProgramNumber", "PN");
            _grid.Columns.Add("Name", "Name");
            _grid.Columns.Add("Position", "Pos");

            foreach (BrisPastPerformance h in brisHorse.RunTogethers)
            {
                int index = _grid.Rows.Add();

                _grid["Date", index].Value = h.DateAsString;
                _grid["Track", index].Value = h.RaceNumber+h.TrackCode;
                _grid["ProgramNumber", index].Value = h.Parent.ProgramNumber;
                _grid["Name", index].Value = h.Parent.Name;
                _grid["Position", index].Value = h.FinalPosition;

                BrisPastPerformance pp = brisHorse.GetPastPerformance(h.TrackCode, h.Date, h.RaceNumber);

                if (null != pp)
                {
                    if (Convert.ToInt32(pp.FinalPosition) > Convert.ToInt32(h.FinalPosition))
                    {
                        _grid.Rows[index].DefaultCellStyle.BackColor = Color.Beige;
                        _grid.Rows[index].DefaultCellStyle.SelectionBackColor = Color.Beige;
                        _grid.Rows[index].DefaultCellStyle.SelectionForeColor = Color.Black;
                    }
                    else
                    {
                        _grid.Rows[index].DefaultCellStyle.BackColor = Color.LightGreen;
                        _grid.Rows[index].DefaultCellStyle.SelectionBackColor = Color.LightGreen;
                        _grid.Rows[index].DefaultCellStyle.SelectionForeColor = Color.Black;
                    }
                }
            }
        }
 public HorseFractionsComponent(Horse myHorse, BrisHorse.TimingType timingType)
 {
     _myHorse = myHorse;
     _timingType = timingType;
     InitializeComponent();
 }
 public double GetBestRating(BrisHorse brisHorse)
 {
     return brisHorse.BestRating;
     ////return brisHorse.DeltaLoverFigure;
 }
Beispiel #11
0
        private int ComparePrimeRatings(BrisHorse h1, BrisHorse h2)
        {
            int r1 = h1.PrimePowerRating;
            int r2 = h2.PrimePowerRating;

            if (r1 > r2)
            {
                return -1;
            }
            else if (r1 < r2)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }
Beispiel #12
0
 private bool IsHorseScratched(BrisHorse brisHorse, Race myrace)
 {
     Horse myHorse = myrace.GetHorseByProgramNumber(brisHorse.ProgramNumber);
     return null != myHorse ? myHorse.Scratched : true;
 }
Beispiel #13
0
 public void Add(BrisHorse horse)
 {
     if (!horse.WasScratched)
     {
         _horse.Add(horse);
     }
 }
Beispiel #14
0
        private int CompareBrisRating(BrisHorse h1, BrisHorse h2)
        {
            int r1 = h1.BestRating;
            int r2 = h2.BestRating;

            if (r1 > r2)
            {
                return -1;
            }
            else if (r1 < r2)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }
Beispiel #15
0
        internal BrisPastPerformance(Tokenizer tokenizer, int index, BrisHorse parent)
        {
            _pt = null;
            _index = index;
            _parent = parent;
            _tokenizer = tokenizer;

            {
                string d = GetToken(FieldIndex.DATE + _index);

                if (d.Length <= 0)
                {
                    _dateAsString = "";
                    _isValid = false;
                    return;
                }
                else
                {
                    int year = Convert.ToInt32(d.Substring(0, 4));
                    int month = Convert.ToInt32(d.Substring(4, 2));
                    int day = Convert.ToInt32(d.Substring(6, 2));

                    if (day < 10)
                    {
                        _dateAsString = " " + day.ToString() + Utilities.GetMonthName(month) + year.ToString().Substring(2, 2);
                    }
                    else
                    {
                        _dateAsString = day.ToString() + Utilities.GetMonthName(month) + year.ToString().Substring(2, 2);
                    }
                }
            }

            _brisRaceShapeFirstCall = GetToken(FieldIndex.BRIS_RACE_SHAPE_FIRST_CALL + _index).Trim();
            _brisRaceShapeSecondCall = GetToken(FieldIndex.BRIS_RACE_SHAPE_SECOND_CALL + _index).Trim();
            _thirdFractionInYards = GetFractionInYardsUsingItsTiming(GetToken(FieldIndex.THIRD_FRACTION + _index).Trim());
            _secondFractionInYards = GetFractionInYardsUsingItsTiming(GetToken(FieldIndex.SECOND_FRACTION + _index).Trim());
            _firstFractionInYards = GetFractionInYardsUsingItsTiming(GetToken(FieldIndex.FIRST_FRACTION + _index).Trim());
            _firstCallPosition = ConvertNonNumericPositionToZero(GetToken(FieldIndex.FIRST_CALL_POSITION + _index));
            _firstCallDistanceFromLeader = ConvertToDistanceFraction(GetToken(FieldIndex.FIRST_CALL_LENGTHS + _index));
            _secondCallPosition = ConvertNonNumericPositionToZero(GetToken(FieldIndex.SECOND_CALL_POSITION + _index));
            _secondCallDistanceFromLeader = ConvertToDistanceFraction(GetToken(FieldIndex.SECOND_CALL_LENGTHS + _index));
            _stretchCallPosition = ConvertNonNumericPositionToZero(GetToken(FieldIndex.STRETCH_POSITION + _index));
            _stretchCallDistanceFromLeader = ConvertToDistanceFraction(GetToken(FieldIndex.STRETCH_LENGTHS + _index));

            {
                string s = GetToken(FieldIndex.DAYS_SINCE_LAST + _index);

                if (s.Length <= 0)
                {
                    _daysSinceLastRace = 0;
                }
                else
                {
                    _daysSinceLastRace = Convert.ToInt32(s);
                }
            }

            try
            {
                int fieldIndex = IsASprint ? FieldIndex.BRIS_2_FURLONG_PACE_FIGURE : FieldIndex.BRIS_4_FURLONG_PACE_FIGURE;
                string s = GetToken(fieldIndex + _index).Trim();
                _brisEarlyPace = s.Length > 0 ? Convert.ToInt32(s) : 0;
            }
            catch
            {
                _brisEarlyPace = 0;
            }

            try
            {
                string s = GetToken(FieldIndex.BRIS_LATE_PACE_FIGURE + _index).Trim();
                _brisLatePace = s.Length > 0 ? Convert.ToInt32(s) + BrisSpeedRatingAsInteger : 0;
            }
            catch
            {
                _brisLatePace = 0;
            }

            {
                string s = GetToken(FieldIndex.BRIS_RACE_RATING + _index).Trim();
                _brisRaceRating = s.Length > 0 ? Convert.ToDouble(s) : -1.0;
            }

            {
                string s = GetToken(FieldIndex.BRIS_CLASS_RATING + _index).Trim();
                _brisClassRating = s.Length > 0 ? Convert.ToDouble(s) : -1.0;
            }

            {
                string s = GetToken(FieldIndex.BRIS_SPEED_RATING + _index).Trim();
                _brisSpeedRatingAsInteger = s.Length > 0 ? Convert.ToInt32(s) : 0;
            }

            _brisSpeedRating = GetToken(FieldIndex.BRIS_SPEED_RATING + _index);
            _finalPosition = ConvertNonNumericPositionToZero(GetToken(FieldIndex.FINISH_POSITION + _index));

            {
                string s = GetToken(FieldIndex.FINISH_LENGTHS + _index).Trim();
                _rawFinalCallDistanceFromLeader = s.Length > 0 ? Convert.ToDouble(s) : 0;
            }

            _finalCallDistanceFromLeader = ConvertToDistanceFraction(GetToken(FieldIndex.FINISH_LENGTHS + _index));
            _trackCondition = GetToken(FieldIndex.TRACK_CONDITION + _index).ToLower();
            _numberOfEntrants = GetToken(FieldIndex.NUMBER_OF_ENTRANTS + _index);
            _postPosition = GetToken(FieldIndex.POST_POSITION + _index);
            _startCallPosition = ConvertNonNumericPositionToZero(GetToken(FieldIndex.START_CALL_POSITION + _index));
            _jockey = Utilities.CapitalizeOnlyFirstLetter((GetToken(FieldIndex.JOCKEY + _index)));
            _raceType = Utilities.CapitalizeOnlyFirstLetter((GetToken(FieldIndex.RACE_TYPE + _index)));
            _ageSexRestrictions = (GetToken(FieldIndex.AGE_SEX_RESTRICTIONS + _index));
            _ageSexRestrictions += "    ";
            {
                string s = GetToken(FieldIndex.FAVORITE_INDICATOR + _index);
                s = s.Trim();
                _wasTheFavorite = s.Length > 0 ? s[0] == '1' : false;
            }

            {
                string s = GetToken(FieldIndex.STATE_BRED_FLAG + _index);
                s = s.Trim().ToUpper();
                _stateBredRestrictedRace = s.Length > 0 ? s[0] == 'S' : false;
            }

            if (WasTheFavorite)
            {
                _odds = "*" + GetToken(FieldIndex.ODDS + _index);
            }
            else
            {
                _odds = GetToken(FieldIndex.ODDS + _index);
            }

            {
                double od = 0;
                double.TryParse(GetToken(FieldIndex.ODDS + _index), out od);
                OddsAsDouble = od;
            }

            _equipment = GetToken(FieldIndex.EQUIPMENT + _index);

            if (null == GetToken(FieldIndex.MEDICATION + _index))
            {
                _medication = "";
            }
            else
            {
                string s = GetToken(FieldIndex.MEDICATION + _index).Trim();
                if (s.Length <= 0)
                {
                    _medication = "";
                }
                else
                {
                    switch (Convert.ToInt32(GetToken(FieldIndex.MEDICATION + _index)))
                    {
                        case 1:
                            _medication = "L";
                            break;
                        case 2:
                            _medication = "B";
                            break;
                        case 3:
                            _medication = "BL";
                            break;
                        default:
                            _medication = "";
                            break;
                    }
                }
            }

            _tripComment = GetToken(FieldIndex.TRIP_COMMENT + _index);
            _weight = GetToken(FieldIndex.WEIGHT + _index);

            _raceClassification = GetToken(FieldIndex.RACE_CLASSIFICATION + _index).ToLower();
            _raceClassification = _raceClassification.Replace("clm", "Clm").Replace("alw", "Alw").Replace("hcp", "Hcp").Replace("md", "Md").Replace("Mdspwt", "MdSpWt").Replace("oc", "OC");
            {
                string p = GetToken(FieldIndex.CLAIMING_PRICE + _index).Trim();
                _claimingPrice = p.Length > 0 ? Convert.ToDouble(p) : 0.0;
            }

            {
                string p = GetToken(FieldIndex.MAX_CLAIMING_PRICE_OF_THE_RACE + _index).Trim();
                _maxClaimingPriceOfTheRace = p.Length > 0 ? Convert.ToDouble(p) : 0.0;
            }

            if (RaceClassification.ToUpper().IndexOf("MDSPWT") >= 0)
            {
                _isMSW = true;
            }
            else if (RaceClassification.ToUpper().IndexOf("MD SP WT") >= 0)
            {
                _isMSW = true;
            }
            else if (RaceClassification.ToUpper().IndexOf("MSW") >= 0)
            {
                _isMSW = true;
            }
            else
            {
                _isMSW = false;
            }

            if (RaceClassification.ToUpper().IndexOf("MDSPWT") >= 0)
            {
                _isMCL = false;
            }
            else if (RaceClassification.ToUpper().IndexOf("MD SP WT") >= 0)
            {
                _isMCL = false;
            }
            else if (RaceClassification.ToUpper().IndexOf("MD") >= 0)
            {
                _isMCL = true;
            }
            else if (RaceClassification.ToUpper().IndexOf("MCL") >= 0)
            {
                _isMCL = true;
            }
            else
            {
                _isMCL = false;
            }

            {
                string s = GetToken(FieldIndex.SURFACE + _index);
                if (s.Length <= 0)
                {
                    _surface = "";
                }
                else if (s[0] == 'D')
                {
                    _surface = "";
                }
                else if (s[0] == 'T')
                {
                    _surface = "T";
                }
                else if (s[0] == 'd')
                {
                    _surface = "id";
                }
                else if (s[0] == 't')
                {
                    _surface = "iT";
                }
                else if (s[0] == 's')
                {
                    _surface = "s";
                }
                else if (s[0] == 'h')
                {
                    _surface = "h";
                }
                else
                {
                    _surface = "";
                }
            }

            {
                string rn = GetToken(FieldIndex.RACE_NUMBER + _index);
                _raceNumber = rn.Length <= 1 ? " " + rn : rn;
            }

            try
            {
                string d = GetToken(FieldIndex.DATE + _index).Trim();

                int year = Convert.ToInt32(d.Substring(0, 4));
                int month = Convert.ToInt32(d.Substring(4, 2));
                int day = Convert.ToInt32(d.Substring(6, 2));
                _date = new DateTime(year, month, day);
            }
            catch
            {
                _date = DateTime.Now;
            }

            {
                string rt = GetToken(FieldIndex.RACE_TRACK + _index);
                if (rt.Length <= 2)
                {
                    _raceTrack = rt + " ";
                }
                else
                {
                    _raceTrack = Utilities.CapitalizeOnlyFirstLetter(GetToken(FieldIndex.RACE_TRACK + _index));
                }
            }

            {
                string s = GetToken(FieldIndex.DISTANCE + _index);
                _aboutDistanceFlag = false;

                if (s.Length <= 0)
                {
                    _distanceAbreviation = "Invalid";
                }
                else
                {
                    int yards = Convert.ToInt32(GetToken(FieldIndex.DISTANCE + _index));
                    if (yards < 0)
                    {
                        _aboutDistanceFlag = true;
                        yards = (-1)*yards;
                    }

                    _distanceAbreviation = Utilities.ConvertYardsToMilesOrFurlongsAbreviation(yards);
                }
            }

            {
                string s = GetToken(FieldIndex.SURFACE + _index);
                if (s.Length <= 0)
                {
                    _isATurfRace = false;
                }
                else if (s[0] == 'T' || s[0] == 't')
                {
                    _isATurfRace = true;
                }
                else
                {
                    _isATurfRace = false;
                }

                _surfaceType = SurfaceType.Dirt;

                if (s.Length > 0)
                {
                    if (s[0] == 'T')
                    {
                        _surfaceType = SurfaceType.Turf;
                    }
                    else if (s[0] == 't')
                    {
                        _surfaceType = SurfaceType.InnerTurf;
                    }
                    else if (s[0] == 'd')
                    {
                        _surfaceType = SurfaceType.InnerDirt;
                    }
                    else
                    {
                        _surfaceType = SurfaceType.Dirt;
                    }
                }
            }

            {
                string s = GetToken(FieldIndex.SURFACE + _index);
                if (s.Length <= 0)
                {
                    _isSynthetic = false;
                }
                else if (s[0] == 'S' || s[0] == 's')
                {
                    _isSynthetic = true;
                }
                else
                {
                    _isSynthetic = false;
                }
            }

            {
                string s = GetToken(FieldIndex.MONEY_POSITION + _index);
                try
                {
                    int p = Convert.ToInt32(s.Trim());
                    _wasTheWinner = (p == 1);
                }
                catch
                {
                    _wasTheWinner = false;
                }
            }

            {
                string s = GetToken(FieldIndex.DISTANCE + _index).Trim();
                _distanceInYards = s.Length > 0 ? Convert.ToInt32(s) : 0;

                if (_distanceInYards < 0)
                    _distanceInYards = (-1)*_distanceInYards;
            }

            _isARoute = ((double) DistanceInYards) >= Hogar.Utilities.MIN_DISTANCE_FOR_ROUTE;
            _isASprint = ((double) DistanceInYards) < Hogar.Utilities.MIN_DISTANCE_FOR_ROUTE;

            {
                if (GetToken(FieldIndex.DISTANCE + _index).Trim().Length > 0)
                {
                    _distance = Utilities.ConvertYardsToMilesOrFurlongs(_distanceInYards);
                }
                else
                {
                    _distance = "";
                }
            }

            _leadersFirstCall = Utilities.ConvertTimeToMMSSFifth(GetToken(FieldIndex.FIRST_FRACTION + _index));
            _leadersSecondCall = Utilities.ConvertTimeToMMSSFifth(GetToken(FieldIndex.SECOND_FRACTION + _index));
            _leadersThirdCall = Utilities.ConvertTimeToMMSSFifth(GetToken(FieldIndex.THIRD_FRACTION + _index));
            _leadersFinalCall = Utilities.ConvertTimeToMMSSFifth(GetToken(FieldIndex.FINAL_TIME + _index));

            _fraction[FractionCall.Level.First] = FractionCall.Make(tokenizer, _firstFractionInYards, FieldIndex.FIRST_CALL_POSITION + _index, FieldIndex.FIRST_FRACTION + _index, FieldIndex.FIRST_CALL_LENGTHS + _index);
            _fraction[FractionCall.Level.Second] = FractionCall.Make(tokenizer, _secondFractionInYards, FieldIndex.START_CALL_POSITION + _index, FieldIndex.SECOND_FRACTION + _index, FieldIndex.SECOND_CALL_LENGTHS + _index);
            _fraction[FractionCall.Level.Stretch] = FractionCall.Make(tokenizer, _thirdFractionInYards, FieldIndex.STRETCH_POSITION + _index, FieldIndex.THIRD_FRACTION + _index, FieldIndex.STRETCH_LENGTHS + _index);
            _fraction[FractionCall.Level.Final] = FractionCall.Make(tokenizer, _distanceInYards, FieldIndex.FINISH_POSITION + _index, FieldIndex.FINAL_TIME + _index, FieldIndex.FINISH_LENGTHS + _index);

            _isValid = true;
        }
Beispiel #16
0
        // showThisHorseTime: true to display this horse time false to display leaders time
        public DataSet GetFractionsAsDataTable(BrisHorse.TimingType timingType, List<string> hiddenColumns)
        {
            hiddenColumns.Clear();
            var dataSet = new DataSet();

            DataTable dataTable = dataSet.Tables.Add();
            dataTable.Columns.Add("SELECTED_AS_RUNNING_LINE", typeof (string));
            dataTable.Columns.Add("NumberOfDaysSinceLastRace", typeof (int));
            dataTable.Columns.Add("NumberOfDaysSinceThatRace", typeof (int));
            dataTable.Columns.Add("Date", typeof (string));
            dataTable.Columns.Add("Race&Track", typeof (string));
            dataTable.Columns.Add("Condition", typeof (string));
            dataTable.Columns.Add("Distance", typeof (string));
            dataTable.Columns.Add("Surface", typeof (string));
            dataTable.Columns.Add("First", typeof (string));
            hiddenColumns.Add("First");
            dataTable.Columns.Add("Second", typeof (string));
            hiddenColumns.Add("Second");
            dataTable.Columns.Add("Third", typeof (string));
            hiddenColumns.Add("Third");
            dataTable.Columns.Add("Final", typeof (string));
            hiddenColumns.Add("Final");
            dataTable.Columns.Add("Race Class", typeof (string));
            dataTable.Columns.Add("BrisRaceRating", typeof (string));
            hiddenColumns.Add("BrisRaceRating");
            dataTable.Columns.Add("BrisClassRating", typeof (string));
            hiddenColumns.Add("BrisClassRating");
            dataTable.Columns.Add("FirstFraction", typeof (string));
            dataTable.Columns.Add("SecondFraction", typeof (string));
            dataTable.Columns.Add("ThirdFraction", typeof (string));
            dataTable.Columns.Add("FinalFraction", typeof (string));
            dataTable.Columns.Add("PostPosition", typeof (string));
            dataTable.Columns.Add("FirstCallPosition", typeof (string));
            dataTable.Columns.Add("FirstCallDistanceFromLeader", typeof (string));
            dataTable.Columns.Add("SecondCallPosition", typeof (string));
            dataTable.Columns.Add("SecondCallDistanceFromLeader", typeof (string));
            dataTable.Columns.Add("StretchCallPosition", typeof (string));
            dataTable.Columns.Add("StretchCallDistanceFromLeader", typeof (string));
            dataTable.Columns.Add("FinalCallPosition", typeof (string));
            dataTable.Columns.Add("FinalCallDistanceFromLeader", typeof (string));
            //dataTable.Columns.Add("GoldenPaceFigureForThisHorse", typeof(int));
            //dataTable.Columns.Add("GoldenPaceFigure", typeof(int));
            //dataTable.Columns.Add("GoldenFigure", typeof(int));
            //dataTable.Columns.Add("GoldenFigureForWinnerOfRace", typeof(int));
            //dataTable.Columns.Add("GoldenTrackVariant", typeof(int));
            dataTable.Columns.Add("TrackVariant", typeof (int));
            dataTable.Columns.Add("BrisRaceShapeFirstCall", typeof(string));
            dataTable.Columns.Add("BrisRaceShapeSecondCall", typeof(string));
            dataTable.Columns.Add("BrisSpeedRating", typeof (int));
            dataTable.Columns.Add("Jockey", typeof (string));
            dataTable.Columns.Add("MedicationWeightEquipment", typeof (string));
            dataTable.Columns.Add("Odds", typeof (string));
            dataTable.Columns.Add("TripComment", typeof (string));
            dataTable.Columns.Add("NumberOfEntrants", typeof (string));

            dataTable.Columns.Add("WinnersName", typeof (string));
            dataTable.Columns.Add("SecondHorseName", typeof (string));
            dataTable.Columns.Add("ThirdHorseName", typeof (string));

            dataTable.Columns.Add("ExtraCommentLine", typeof (string));

            // The following columns will be hidden in the front end and are used to easily get the race info
            dataTable.Columns.Add("ID_INFO_DATE", typeof (string));
            hiddenColumns.Add("ID_INFO_DATE");
            dataTable.Columns.Add("ID_INFO_TRACK_CODE", typeof (string));
            hiddenColumns.Add("ID_INFO_TRACK_CODE");
            dataTable.Columns.Add("ID_INFO_RACE_NUMBER", typeof (string));
            hiddenColumns.Add("ID_INFO_RACE_NUMBER");
            dataTable.Columns.Add("ID_INFO_DISTANCE_IN_YARDS", typeof (int));
            hiddenColumns.Add("ID_INFO_DISTANCE_IN_YARDS");
            dataTable.Columns.Add("ID_PP_OBJECT", typeof (BrisPastPerformance));
            hiddenColumns.Add("ID_PP_OBJECT");

            List<BrisPastPerformance> pps = PastPerformances;
            foreach (BrisPastPerformance pp in pps)
            {
                if (!pp.IsValid)
                {
                    continue;
                }

                object[] v = new object[dataTable.Columns.Count];
                int index = 0;
                v[index++] = "";
                v[index++] = pp.DaysSinceLastRace;
                v[index++] = pp.DaysSinceThatRace;
                v[index++] = pp.DateAsString;
                v[index++] = pp.RaceNumber + pp.TrackCode;
                v[index++] = pp.TrackCondition;
                v[index++] = pp.DistanceAbreviation;
                v[index++] = pp.Surface;
                v[index++] = ConvertSpeedToFigure(pp.SpeedDuringFirstFraction);
                v[index++] = ConvertSpeedToFigure(pp.SpeedDuringSecondFraction);
                v[index++] = ConvertSpeedToFigure(pp.SpeedDuringThirdFraction);
                v[index++] = ConvertSpeedToFigure(pp.SpeedDuringFinalFraction);

                //v[index++] = pp.RaceClassification;

                v[index++] = Utilities.FormatCondition(pp.RaceClassification, pp.IsStateBredRestrictedRace, pp.AgeSexRestrictions);

                if (pp.BrisRaceRating >= 0)
                {
                    v[index++] = pp.BrisRaceRating.ToString();
                }
                else
                {
                    v[index++] = "N/A";
                }

                if (pp.BrisClassRating >= 0)
                {
                    v[index++] = pp.BrisClassRating.ToString();
                }
                else
                {
                    v[index++] = "N/A";
                }

                if (timingType == TimingType.ThisHorse)
                {
                    v[index++] = pp.GetFraction(FractionCall.Level.First).FormatedTime;
                    v[index++] = pp.GetFraction(FractionCall.Level.Second).FormatedTime;
                    v[index++] = pp.GetFraction(FractionCall.Level.Stretch).FormatedTime;
                    v[index++] = pp.GetFraction(FractionCall.Level.Final).FormatedTime;
                }
                else if (timingType == TimingType.LeadersHorse)
                {
                    v[index++] = pp.LeadersFirstCall;
                    v[index++] = pp.LeadersSecondCall;
                    v[index++] = pp.LeadersThirdCall;
                    v[index++] = pp.LeadersFinalCall;
                }
                else if (timingType == TimingType.ThisHorseCynthiaFractions)
                {
                    v[index++] = "";
                    v[index++] = Utilities.ConvertTimeToMMSSFifth(pp.AdjustedFirstCall);
                    v[index++] = Utilities.ConvertTimeToMMSSFifth(pp.AdjustedSecondCall);
                    v[index++] = Utilities.ConvertTimeToMMSSFifth(pp.AdjustedFinalCall);
                }
                else if (timingType == TimingType.PaceFigures)
                {
                    v[index++] = "";

                    if (pp.PaceFigure.Figure1ForTheHorse < -500)
                    {
                        v[index++] = "";
                        v[index++] = "";
                        v[index++] = "";
                    }
                    else
                    {

                        v[index++] = string.Format("{0,5:####}/{1,5:####}", pp.PaceFigure.Figure1ForTheHorse, pp.PaceFigure.Figure1ForTheRace);
                        v[index++] = string.Format("{0,5:####}/{1,5:####}", pp.PaceFigure.Figure2ForTheHorse, pp.PaceFigure.Figure2ForTheRace);
                        v[index++] = string.Format("{0,5:####}/{1,5:####}", pp.PaceFigure.FinalFigureForTheHorse, pp.PaceFigure.FinalFigureForTheRace);
                    }

                }
                v[index++] = pp.PostPosition;
                v[index++] = pp.FirstCallPosition;
                v[index++] = pp.FirstCallDistanceFromLeader;
                v[index++] = pp.SecondCallPosition;
                v[index++] = pp.SecondCallDistanceFromLeader;
                v[index++] = pp.StretchCallPosition;
                v[index++] = pp.StretchCallDistanceFromLeader;
                v[index++] = pp.FinalPosition;
                v[index++] = pp.FinalCallDistanceFromLeader;
                //v[index++] = (int) pp.GoldenPaceFigureForThisHorse;
                //v[index++] = (int)pp.GoldenPaceFigureForTheRace;
                //v[index++] = (int) pp.GoldenFigureForThisHorse;
                //v[index++] = (int)pp.GoldenFigureForTheWinner;
                //v[index++] = pp.GoldenTrackVariant;
                v[index++] = pp.TrackVariant;
                v[index++] = pp.BrisRaceShapeFirstCall;
                v[index++] = pp.BrisRaceShapeSecondCall;
                v[index++] = pp.BrisSpeedRating;
                v[index++] = pp.Jockey.Length < 16 ? pp.Jockey : pp.Jockey.Substring(0, 15);
                v[index++] = pp.Medication + pp.Weight + pp.Equipment;
                v[index++] = pp.Odds;
                v[index++] = pp.TripComment;
                v[index++] = pp.NumberOfEntrants;

                v[index++] = Utilities.CapitalizeOnlyFirstLetter(pp.WinnersName);
                v[index++] = Utilities.CapitalizeOnlyFirstLetter(pp.SecondPlaceFinisherName);
                v[index++] = Utilities.CapitalizeOnlyFirstLetter(pp.ThirdPlaceFinisherName);

                v[index++] = pp.ExtraCommentLine;

                v[index++] = pp.Date.Year + string.Format("{0:00}", pp.Date.Month) + string.Format("{0:00}", pp.Date.Day);
                v[index++] = pp.TrackCode;
                v[index++] = pp.RaceNumber;
                v[index++] = pp.DistanceInYards;
                v[index++] = pp;

                dataTable.Rows.Add(v);
            }

            return dataSet;
        }
Beispiel #17
0
 public HorseDetailsForm(Horse horse)
 {
     _horse = horse;
     _brisHorse = horse.CorrespondingBrisHorse;
     InitializeComponent();
 }
Beispiel #18
0
 public double GetBestRating(BrisHorse brisHorse)
 {
     return brisHorse.BestRating;
 }
 public double GetBestPrimePower(BrisHorse brisHorse)
 {
     return (double)brisHorse.PrimePowerRating;
 }