Esempio n. 1
0
 private static void ShowRaceChart(BrisPastPerformance pp)
 {
     string trackCode = pp.TrackCode;
     string raceNumber = pp.RaceNumber;
     int year = pp.Date.Year;
     int month = pp.Date.Month;
     int day = pp.Date.Day;
     DailyCard dc = DailyCard.Load(trackCode, year, month, day);
     if (null != dc && dc.ExistsInDb)
     {
         var f = new RaceChartForm(dc.GetRaceFromRaceNumber(Convert.ToInt32(raceNumber)).RaceID);
         f.ShowDialog();
     }
     else
     {
         var f = new FirstSecondAndThridInfoForm(pp);
         f.ShowDialog();
     }
 }
Esempio n. 2
0
        private void OnCellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex >= 0)
                {
                    if (e.ColumnIndex == _grid.Columns["TrackVariant"].Index)
                    {
                        string trackCode = _grid["ID_INFO_TRACK_CODE", e.RowIndex].Value.ToString();
                        int distanceInYards = (int) _grid["ID_INFO_DISTANCE_IN_YARDS", e.RowIndex].Value;
                        string surface = _grid["SURFACE", e.RowIndex].Value.ToString();
                        var pp = (BrisPastPerformance) _grid["ID_PP_OBJECT", e.RowIndex].Value;

                        var form = new CynthiaParsForm(trackCode, distanceInYards, pp);
                        form.ShowDialog();
                    }
                    else
                    {
                        var date = (string) _grid["ID_INFO_DATE", e.RowIndex].Value;
                        var trackCode = (string) _grid["ID_INFO_TRACK_CODE", e.RowIndex].Value;
                        var raceNumber = (string) _grid["ID_INFO_RACE_NUMBER", e.RowIndex].Value;
                        int year = Convert.ToInt32(date.Substring(0, 4));
                        int month = Convert.ToInt32(date.Substring(4, 2));
                        int day = Convert.ToInt32(date.Substring(6, 2));
                        int raceid = GetRaceIdFromDb(trackCode, year, month, day, Convert.ToInt32(raceNumber));
                        if (raceid > 0)
                        {
                            var f = new RaceChartForm(raceid);
                            f.ShowDialog();
                        }
                        else
                        {
                            BrisPastPerformance pp = _myHorse.CorrespondingBrisHorse.PastPerformances[e.RowIndex];
                            var f = new FirstSecondAndThridInfoForm(pp);
                            f.ShowDialog();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }