private void _gridPP_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex >= 0) { if (e.ColumnIndex == _gridPP.Columns["TrackVariant"].Index) { string trackCode = _gridPP["TrackCode", e.RowIndex].Value.ToString(); int distanceInYards = (int)_gridPP["DistanceInYards", e.RowIndex].Value; string surface = _gridPP["SURFACE", e.RowIndex].Value.ToString(); var pp = (SippPastPerformance)_gridPP.Rows[e.RowIndex].DataBoundItem; var form = new CynthiaParsForm(trackCode, distanceInYards, pp); form.ShowDialog(); } else if (e.ColumnIndex == _gridPP.Columns["TrackCode"].Index || e.ColumnIndex == _gridPP.Columns["RaceReplay"].Index) { int row = e.RowIndex; var trackCode = _gridPP.Rows[row].Cells["TrackCode"].Value; var date = _gridPP.Rows[row].Cells["RacingDate"].Value; int raceNumber = (int)_gridPP.Rows[row].Cells["RaceNumber"].Value; var form = new BrowserForm(trackCode.ToString(), (DateTime)date, raceNumber); form.ShowDialog(); } else if (e.ColumnIndex == _gridPP.Columns["RunAgainstIcon"].Index) { var pp = (SippPastPerformance)_gridPP.Rows[e.RowIndex].DataBoundItem; if(pp.RunAgainst.Count > 0) { var form = new RunAgainstForm((SippPastPerformance)_gridPP.Rows[e.RowIndex].DataBoundItem); form.ShowDialog(); } } else if (e.ColumnIndex == _gridPP.Columns["PostPosition"].Index) { var pp = (SippPastPerformance)_gridPP.Rows[e.RowIndex].DataBoundItem; string trackCode = pp.TrackCode; string surface = pp.Surface.ToUpper(); string aboutDistanceFlag = pp.AboutDistanceFlag ? "A" : ""; double distance = pp.DistanceInYards; if(surface == "IT") { surface = "t"; } if (surface == "ID") { surface = "d"; } var form = new PostPositionStatsForm(trackCode, surface, aboutDistanceFlag, distance); form.ShowDialog(); } } } catch (Exception exception) { Console.WriteLine(exception); } }
void ShowBreedingForHorse(string name) { try { if (null != _selectedHorse) { name = name.Trim(); if (name.Length <= 0) return; int pos = name.IndexOf("("); name = name.Substring(0, pos - 1); var form = new BrowserForm(name); form.ShowDialog(); } } catch (Exception exception) { Console.WriteLine(exception); } }