コード例 #1
0
        internal BrisPastPerformance(DataRow dr, int index, BrisHorse parent)
        {
            _dr = dr;
            _index = index;
            _parent = parent;

            {
                string s = Utilities.GetFieldAsString(_dr, 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;
                    }
                }
            }

            _fraction[FractionCall.Level.First] = FractionCall.Make(_dr, FirstFractionInYards, FieldIndex.FIRST_CALL_POSITION + _index, FieldIndex.FIRST_FRACTION + _index, FieldIndex.FIRST_CALL_LENGTHS + _index);
            _fraction[FractionCall.Level.Second] = FractionCall.Make(_dr, SecondFractionInYards, FieldIndex.START_CALL_POSITION + _index, FieldIndex.SECOND_FRACTION + _index, FieldIndex.SECOND_CALL_LENGTHS + _index);
            _fraction[FractionCall.Level.Stretch] = FractionCall.Make(_dr, ThirdFractionInYards, FieldIndex.STRETCH_POSITION + _index, FieldIndex.THIRD_FRACTION + _index, FieldIndex.STRETCH_LENGTHS + _index);
            _fraction[FractionCall.Level.Final] = FractionCall.Make(_dr, DistanceInYards, FieldIndex.FINISH_POSITION + _index, FieldIndex.FINAL_TIME + _index, FieldIndex.FINISH_LENGTHS + _index);
        }
コード例 #2
0
ファイル: BrisRace.cs プロジェクト: jpazarzis/hogar
 private bool IsHorseScratched(BrisHorse brisHorse, Race myrace)
 {
     Horse myHorse = myrace.GetHorseByProgramNumber(brisHorse.ProgramNumber);
     return null != myHorse ? myHorse.Scratched : true;
 }
コード例 #3
0
ファイル: BrisRace.cs プロジェクト: jpazarzis/hogar
        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;
            }
        }
コード例 #4
0
ファイル: BrisRace.cs プロジェクト: jpazarzis/hogar
        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;
            }
        }
コード例 #5
0
ファイル: BrisRace.cs プロジェクト: jpazarzis/hogar
 public void Add(BrisHorse horse)
 {
     if (!horse.WasScratched)
     {
         _horse.Add(horse);
     }
 }
コード例 #6
0
ファイル: BrisDailyCard.cs プロジェクト: jpazarzis/hogar
        public void Load(string filename)
        {
            DataTable dt = Utilities.Parser(filename);
            BrisRace currentRace = null;
            _race.Clear();

            foreach (DataRow dr in dt.Rows)
            {
                var horse = new BrisHorse(dr);

                // The following if ensures that when a new race is comming
                // we create a new race object and start populating it
                if ((currentRace == null) || (horse.RaceNumber != currentRace.RaceNumber))
                {
                    currentRace = new BrisRace(horse.RaceNumber, this);
                    _race.Add(currentRace);
                }

                Debug.Assert(null != currentRace);
                Debug.Assert(null != horse);

                horse.Parent = currentRace;
                currentRace.Add(horse);

            }
        }
コード例 #7
0
ファイル: BrisHorse.cs プロジェクト: jpazarzis/hogar
        // 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("BrisRaceShapeFirstCall", typeof (string));
            hiddenColumns.Add("BrisRaceShapeFirstCall");
            dataTable.Columns.Add("BrisRaceShapeSecondCall", typeof (string));
            hiddenColumns.Add("BrisRaceShapeSecondCall");
            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("TrackVariant", 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++] = pp.BrisRaceShapeFirstCall;
                v[index++] = pp.BrisRaceShapeSecondCall;
                v[index++] = ConvertSpeedToFigure(pp.SpeedDuringFirstFraction);
                v[index++] = ConvertSpeedToFigure(pp.SpeedDuringSecondFraction);
                v[index++] = ConvertSpeedToFigure(pp.SpeedDuringThirdFraction);
                v[index++] = ConvertSpeedToFigure(pp.SpeedDuringFinalFraction);
                v[index++] = Utilities.FormatCondition(pp.RaceClassification, pp.IsStateBredRestrictedRace, pp.AgeSexRestrictions);
                v[index++] = pp.BrisRaceRating >= 0 ? pp.BrisRaceRating.ToString() : "N/A";
                v[index++] = pp.BrisClassRating >= 0 ? pp.BrisClassRating.ToString() : "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);
                }
                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++] = pp.TrackVariant;
                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;
        }