Esempio n. 1
0
        internal BrisHorse(ParsableText pt)
        {
            _parent = null;
            _parsableText = pt;

            string s;
            s = _parsableText.Tokens[FieldIndex.NUMBER_OF_DAYS_SINCE_LAST_RACE_FOR_TODAYS_RACE].ToString().Trim();
            _daysSinceLastRace = s.Length > 0 ? Convert.ToInt32(s) : 0;

            s = _parsableText.Tokens[FieldIndex.CLAIMING_PRICE_OF_HORSE].ToString().Trim();
            _claimingPriceOfTheHorseAsDouble = s.Length > 0 ? Convert.ToDouble(s) : 0.0;

            s = _parsableText.Tokens[FieldIndex.CLAIMING_PRICE_OF_RACE].ToString().Trim();
            _claimingPriceOfTheRaceAsDouble = s.Length > 0 ? Convert.ToDouble(s) : 0.0;

            _brisLateAvg = CalcBrisLateAvg();
            _brisCompositeLastThree = CalcBrisCompositeLastThree();
            _bestRating = CalcBestRating();
            _medication = GetMedication();
            _isFirstTimeLasix = Medication.Trim().CompareTo("FL") == 0;
            _brisRunStyle = _parsableText.Tokens[FieldIndex.BRIS_RUN_STYLE].ToString();
            _quirinSpeedPoints = CalcQuirinSpeedPoints();
            _primePowerRating = CalcPrimePowerRating();
            if (_parsableText.Tokens[FieldIndex.EQUIPMENT_CHANGE].Length > 0)
            {
                _equipment = Convert.ToInt32(_parsableText.Tokens[FieldIndex.EQUIPMENT_CHANGE].ToString());
            }
            _currentYearEarnings = GetCurrentYearEarnings();
            _todaysTrackEarnings = GetTodaysTrackEarnings();

            if (_parsableText.Tokens[FieldIndex.WEIGHT].Length > 0)
            {
                _weight = Convert.ToInt32(_parsableText.Tokens[FieldIndex.WEIGHT].ToString());
            }
            _todaysRaceIsARoute = GetTodaysRaceIsARoute();
            _todaysRaceIsInTurf = GetTodaysRaceIsInTurf();
            _isSynthetic = GetTodaysRaceIsSynthetic();
            _age = GetAge();

            string postTimeStr = _parsableText.Tokens[FieldIndex.POST_TIME].ToString();

            _postTime = ConvertPacificMilitaryTimeToEastern(_parsableText.Tokens[FieldIndex.POST_TIME].ToString());
        }
Esempio n. 2
0
 public RaceExoticBetPayoff(ParsableText pt)
 {
     _pt = pt;
 }
Esempio n. 3
0
 public RaceDescriptiveData(ParsableText pt, RaceResultsInsertToDb.ProcessStatusMessageDelegate SendMessage)
 {
     _pt = pt;
     _sendMessage = SendMessage;
 }
Esempio n. 4
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;
        }
Esempio n. 5
0
        public BrisWorkouts(ParsableText parsableText)
        {
            _parsableText = parsableText;

            PopulateWorkouts();
        }
Esempio n. 6
0
        public static Workout Make(ParsableText parsableText, int index)
        {
            var w = new Workout();

            w._date = parsableText.Tokens[FieldIndex.DATE + index].ToString().Trim();
            w._time = parsableText.Tokens[FieldIndex.TIME + index].ToString().Trim();
            w._track = parsableText.Tokens[FieldIndex.TRACK + index].ToString().Trim();
            w._distance = parsableText.Tokens[FieldIndex.DISTANCE + index].ToString().Trim();
            w._trackCondition = parsableText.Tokens[FieldIndex.TRACK_CONDITION + index].ToString().Trim();
            w._description = parsableText.Tokens[FieldIndex.DESCRIPTION + index].ToString().Trim();
            w._mainOrInnerTrackIndicator = parsableText.Tokens[FieldIndex.TRACK_INDICATOR + index].ToString().Trim();
            w._numberOfWorkoutsThatDayOnDistance = parsableText.Tokens[FieldIndex.NUMBER_OF_WORKOUTS + index].ToString().Trim();
            w._rankOfWorkout = parsableText.Tokens[FieldIndex.RANK + index].ToString().Trim();

            return (w._date.Length > 0 && w._distance.Length > 0) ? w : null;
        }
Esempio n. 7
0
 public RaceStraightBetPayoff(ParsableText pt)
 {
     _pt = pt;
 }
Esempio n. 8
0
 public RaceFootNotes(ParsableText pt)
 {
     _pt = pt;
 }