Example #1
0
        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);
            }
        }
Example #2
0
        private void _txtboxPostPosition_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                string trackCode = _selectedHorse.Parent.Parent.TrackCode;
                string surface = _selectedHorse.Parent.Surface;
                string aboutDistanceFlag = "";
                double distance = _selectedHorse.Parent.DistanceInYeards;

                var form = new PostPositionStatsForm(trackCode, surface, aboutDistanceFlag, distance);

                form.ShowDialog();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }