Пример #1
0
        public void ConvertRaces(XDocument xdTrackmaster)
        {
            DataTable dtRaces = DAL.Trackmaster.RaceCardDAL.GetRaces(xdTrackmaster);

            LK.Course            = new Course();
            LK.Course.CourseCode = dtRaces.Rows[0].ItemArray[dtRaces.Columns.IndexOf("Track")].ToString().ToUpper();
            LK.RaceDate          = DateTime.ParseExact(dtRaces.Rows[0].ItemArray[dtRaces.Columns.IndexOf("RaceDate")].ToString(), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
            LK.Race = new Race[dtRaces.Rows.Count];
            int cnt = 0;

            foreach (DataRow drRace in dtRaces.Rows)
            {
                Latekick.BOL.Latekick.Race latekickrace = new Latekick.BOL.Latekick.Race();
                latekickrace.RaceDate         = LK.RaceDate;
                latekickrace.RaceInfo         = new RaceInfo();
                latekickrace.RaceInfo.Surface = dtRaces.Rows[cnt].ItemArray[dtRaces.Columns.IndexOf("Surface")].ToString().ToUpper();
                if (dtRaces.Rows[cnt].ItemArray[dtRaces.Columns.IndexOf("DistUnit")].ToString().ToUpper() == "Y")
                {
                    latekickrace.RaceInfo.DistanceFurlongs = Math.Round(Double.Parse(dtRaces.Rows[cnt].ItemArray[dtRaces.Columns.IndexOf("Distance")].ToString()) / 220, 1);
                    latekickrace.RaceInfo.DistanceYards    = Double.Parse(dtRaces.Rows[cnt].ItemArray[dtRaces.Columns.IndexOf("Distance")].ToString());
                }
                else if (dtRaces.Rows[cnt].ItemArray[dtRaces.Columns.IndexOf("DistUnit")].ToString().ToUpper() == "F")
                {
                    latekickrace.RaceInfo.DistanceFurlongs = Double.Parse(dtRaces.Rows[cnt].ItemArray[dtRaces.Columns.IndexOf("Distance")].ToString()) / 100;
                    latekickrace.RaceInfo.DistanceYards    = latekickrace.RaceInfo.DistanceFurlongs * 220;
                }
                latekickrace.RaceNumber                  = dtRaces.Rows[cnt].ItemArray[dtRaces.Columns.IndexOf("RaceNr")].ToString();
                latekickrace.RaceInfo.PostTime           = dtRaces.Rows[cnt].ItemArray[dtRaces.Columns.IndexOf("PostTime")].ToString();
                latekickrace.RaceInfo.RaceNumber         = Int32.Parse(dtRaces.Rows[cnt].ItemArray[dtRaces.Columns.IndexOf("RaceNr")].ToString());
                latekickrace.RaceInfo.AgeSexRestrictions = dtRaces.Rows[cnt].ItemArray[dtRaces.Columns.IndexOf("AgeRestr")].ToString();
                latekickrace.RaceInfo.RaceDescription    = dtRaces.Rows[cnt].ItemArray[dtRaces.Columns.IndexOf("RaceText")].ToString();
                latekickrace.RaceInfo.RaceType           = dtRaces.Rows[cnt].ItemArray[dtRaces.Columns.IndexOf("StkOrClm")].ToString();
                latekickrace.RaceInfo.Purse              = Int32.Parse(dtRaces.Rows[cnt].ItemArray[dtRaces.Columns.IndexOf("Purse")].ToString());


                latekickrace.RaceInfo.CD_Profile = new CD_Profile();

                LK.Race[cnt] = latekickrace;
                cnt++;
            }
            LK.NumberOfRaces = cnt.ToString();
        }
Пример #2
0
        public void ConvertRaces(List <Latekick.BOL.Brisnet.Bris_Race> races)
        {
            LK.Course            = new Course();
            LK.Course.CourseCode = races[0].Track.Trim();
            LK.RaceDate          = races[0].RaceDate;

            LK.Race = new Race[races.Count];
            int cnt = 0;

            for (int r = 0; r < races.Count; r++)
            {
                Latekick.BOL.Brisnet.Bris_Race brisrace     = races[r];
                Latekick.BOL.Latekick.Race     latekickrace = new Latekick.BOL.Latekick.Race();
                latekickrace.RaceDate                  = LK.RaceDate;
                latekickrace.RaceInfo                  = new RaceInfo();
                latekickrace.RaceInfo.Surface          = brisrace.Surface.ToUpper();
                latekickrace.RaceInfo.DistanceFurlongs = Math.Round((double)brisrace.DistanceYards / 220, 1);
                latekickrace.RaceInfo.DistanceYards    = brisrace.DistanceYards;
                latekickrace.RaceNumber                = brisrace.RaceNumber.ToString();
                string pt2 = brisrace.PostTimes.ToString();
                string pt  = pt2.Replace("\"", "");
                latekickrace.RaceInfo.PostTime           = pt.Substring(pt.IndexOf("("), pt.IndexOf(")") - pt.IndexOf("(") + 1).Replace("(", "").Replace(")", "");
                latekickrace.RaceInfo.RaceNumber         = brisrace.RaceNumber;
                latekickrace.RaceInfo.AgeSexRestrictions = ParseAgeSexCode(brisrace.Restrictions);
                latekickrace.RaceInfo.RaceDescription    = brisrace.Conditions;
                latekickrace.RaceInfo.RaceType           = ParseRaceType(brisrace.RaceType);
                latekickrace.RaceInfo.Purse = brisrace.Purse;


                latekickrace.RaceInfo.CD_Profile = new CD_Profile();

                LK.Race[r] = latekickrace;
                cnt++;
            }
            LK.NumberOfRaces = cnt.ToString();
        }
Пример #3
0
        public void ConvertHorses(Latekick.BOL.Latekick.Race race, XElement xeHorses)
        {
            DataTable dtEntries = RaceDAL.GetEntries(xeHorses);

            race.RaceInfo.NumberOfHorses = dtEntries.Rows.Count;
            race.Entry = new Entry[race.RaceInfo.NumberOfHorses];

            int e = 0;

            #region entry + stats
            foreach (DataRow dr in dtEntries.Rows)
            {
                Latekick.BOL.Latekick.Entry entry = new Latekick.BOL.Latekick.Entry();
                entry.HorseName = dr.ItemArray[dtEntries.Columns.IndexOf("HorseName")].ToString();
                try { entry.Draw = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Draw")].ToString()); }
                catch { }
                entry.SaddleClothNo = dr.ItemArray[dtEntries.Columns.IndexOf("SaddleClothNo")].ToString();
                entry.JockeyName    = dr.ItemArray[dtEntries.Columns.IndexOf("JockeyName")].ToString();
                entry.TrainerName   = dr.ItemArray[dtEntries.Columns.IndexOf("TrainerName")].ToString();
                entry.OwnerName     = dr.ItemArray[dtEntries.Columns.IndexOf("OwnerName")].ToString();
                try { entry.Weight = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Weight")].ToString()); }
                catch { }
                //entry.ApprenticeAllowance = -1;
                entry.Equipment  = dr.ItemArray[dtEntries.Columns.IndexOf("Equipment")].ToString();
                entry.Medication = dr.ItemArray[dtEntries.Columns.IndexOf("Medication")].ToString();
                entry.Sire       = dr.ItemArray[dtEntries.Columns.IndexOf("Sire")].ToString();
                entry.Dam        = dr.ItemArray[dtEntries.Columns.IndexOf("Dam")].ToString();
                entry.DamSire    = dr.ItemArray[dtEntries.Columns.IndexOf("DamSire")].ToString();
                entry.Gender     = dr.ItemArray[dtEntries.Columns.IndexOf("Gender")].ToString();
                //entry.Age = race.RaceDate.Year - (brisentry.YearOfBirth + (brisentry.YearOfBirth > 90 ? 1900 : 2000));
                try { entry.ML = double.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("ML")].ToString()); }
                catch { }
                entry.ProjectedRatings = new ProjectedRatings();
                entry.RunningStyle     = new RunningStyle();

                entry.Stats = new Stats();

                try { entry.Stats.LifeTime_Runs = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Lifetime_Runs")].ToString()); }
                catch { }
                try { entry.Stats.LifeTime_Win = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Lifetime_Win")].ToString()); }
                catch { }
                try { entry.Stats.LifeTime_Place = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Lifetime_Place")].ToString()); }
                catch { }
                try { entry.Stats.LifeTime_Show = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Lifetime_Show")].ToString()); }
                catch { }

                try { entry.Stats.ThisYear_Runs = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_ThisYear_Runs")].ToString()); }
                catch { }
                try { entry.Stats.ThisYear_Win = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_ThisYear_Win")].ToString()); }
                catch { }
                try { entry.Stats.ThisYear_Place = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_ThisYear_Place")].ToString()); }
                catch { }
                try { entry.Stats.ThisYear_Show = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_ThisYear_Show")].ToString()); }
                catch { }

                try { entry.Stats.LastYear_Runs = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_LastYear_Runs")].ToString()); }
                catch { }
                try { entry.Stats.LastYear_Win = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_LastYear_Win")].ToString()); }
                catch { }
                try { entry.Stats.LastYear_Place = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_LastYear_Place")].ToString()); }
                catch { }
                try { entry.Stats.LastYear_Show = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_LastYear_Show")].ToString()); }
                catch { }

                try { entry.Stats.Course_Runs = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Course_Runs")].ToString()); }
                catch { }
                try { entry.Stats.Course_Win = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Course_Win")].ToString()); }
                catch { }
                try { entry.Stats.Course_Place = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Course_Place")].ToString()); }
                catch { }
                try { entry.Stats.Course_Show = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Course_Show")].ToString()); }
                catch { }

                try { entry.Stats.Dirt_Runs = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Dirt_Runs")].ToString()); }
                catch { }
                try { entry.Stats.Dirt_Win = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Dirt_Win")].ToString()); }
                catch { }
                try { entry.Stats.Dirt_Place = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Dirt_Place")].ToString()); }
                catch { }
                try { entry.Stats.Dirt_Show = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Dirt_Show")].ToString()); }
                catch { }

                try { entry.Stats.Turf_Runs = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Turf_Runs")].ToString()); }
                catch { }
                try { entry.Stats.Turf_Win = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Turf_Win")].ToString()); }
                catch { }
                try { entry.Stats.Turf_Place = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Turf_Place")].ToString()); }
                catch { }
                try { entry.Stats.Turf_Show = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Turf_Show")].ToString()); }
                catch { }

                try { entry.Stats.AW_Runs = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_AW_Runs")].ToString()); }
                catch { }
                try { entry.Stats.AW_Win = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_AW_Win")].ToString()); }
                catch { }
                try { entry.Stats.AW_Place = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_AW_Place")].ToString()); }
                catch { }
                try { entry.Stats.AW_Show = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_AW_Show")].ToString()); }
                catch { }

                try { entry.Stats.Wet_Runs = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Mud_Runs")].ToString()) + int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Soft_Runs")].ToString()); }
                catch { }
                try { entry.Stats.Wet_Win = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Mud_Win")].ToString()) + int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Soft_Win")].ToString()); }
                catch { }
                try { entry.Stats.Wet_Place = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Mud_Place")].ToString()) + int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Soft_Place")].ToString()); }
                catch { }
                try { entry.Stats.Wet_Show = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Mud_Show")].ToString()) + int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Soft_Show")].ToString()); }
                catch { }

                try { entry.Stats.Distance_Runs = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_DistanceDirt_Runs")].ToString()) + int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_DistanceTurf_Runs")].ToString()); }
                catch { }
                try { entry.Stats.Distance_Win = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_DistanceDirt_Win")].ToString()) + int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_DistanceTurf_Win")].ToString()); }
                catch { }
                try { entry.Stats.Distance_Place = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_DistanceDirt_Place")].ToString()) + int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_DistanceTurf_Place")].ToString()); }
                catch { }
                try { entry.Stats.Distance_Show = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_DistanceDirt_Show")].ToString()) + int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_DistanceTurf_Show")].ToString()); }
                catch { }

                try { entry.Stats.Jockey_30d_Runs = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Jockey_30d_Runs")].ToString()); }
                catch { }
                try { entry.Stats.Jockey_30d_Win = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Jockey_30d_Win")].ToString()); }
                catch { }
                try { entry.Stats.Jockey_30d_Place = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Jockey_30d_Place")].ToString()); }
                catch { }
                try { entry.Stats.Jockey_30d_Show = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Jockey_30d_Show")].ToString()); }
                catch { }

                try { entry.Stats.Trainer_30d_Runs = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Trainer_30d_Runs")].ToString()); }
                catch { }
                try { entry.Stats.Trainer_30d_Win = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Trainer_30d_Win")].ToString()); }
                catch { }
                try { entry.Stats.Trainer_30d_Place = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Trainer_30d_Place")].ToString()); }
                catch { }
                try { entry.Stats.Trainer_30d_Show = int.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Trainer_30d_Show")].ToString()); }
                catch { }

                entry.Earnings = new Earnings();
                try { entry.Earnings.EarningsLifeTime = (int)double.Parse(dr.ItemArray[dtEntries.Columns.IndexOf("Stats_Lifetime_Earnings")].ToString()); }
                catch { }

                race.Entry[e] = entry;
                e++;
            }
            #endregion
        }