private void OnCellClicked(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex >= 0)
                {
                    if(_grid.Columns[e.ColumnIndex].Name == "Chart")
                    {
                        int raceid = (int)_grid["RACE_ID", e.RowIndex].Value;
                        RaceChartForm form = new RaceChartForm(raceid);
                        form.ShowDialog();
                    }
                    else if (_grid.Columns[e.ColumnIndex].Name == "PP")
                    {
                        string date = _grid["DateInYYYYMMDD", e.RowIndex].Value.ToString();

                        string trackCode = _grid["TC", e.RowIndex].Value.ToString();
                        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 raceNumber = (int)_grid["RN", e.RowIndex].Value;
                        string programNumber = _grid["PROGRAM_NUMBER", e.RowIndex].Value.ToString();

                        IndividualHorsePastPerformancesForm form = new IndividualHorsePastPerformancesForm(trackCode, year, month, day, raceNumber, programNumber);
                        form.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 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();
     }
 }
        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);
            }
        }
Exemple #4
0
        private void OnCellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {

                if (e.RowIndex >= 0)
                {
                    string trackCode = _grid["TC", e.RowIndex].Value.ToString();
                    string date = _grid["DATE2", e.RowIndex].Value.ToString();
                    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 raceNumber = (int)_grid["RN", e.RowIndex].Value;
                    int raceID = (int)_grid["RACE_ID", e.RowIndex].Value;
                    string programNumber = _grid["PN", e.RowIndex].Value.ToString();
                    string trainer = _grid["Trainer", e.RowIndex].Value.ToString();

                    Form form = null;

                    if (e.ColumnIndex == _grid.Columns["Horse Name"].Index)
                    {
                        form = new IndividualHorsePastPerformancesForm(trackCode, year, month, day, raceNumber, programNumber);
                    }
                    else if (e.ColumnIndex == _grid.Columns["Trainer"].Index)
                    {
                        form = new IndividualTrainerStatsForm(trainer);
                    }
                    else if (e.ColumnIndex == _grid.Columns["Class"].Index)
                    {
                        form = new RaceChartForm(raceID);
                    }

                    if (null != form)
                    {
                        form.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }