public bool Delete()
        {
            if (dgvMain.SelectedRows.Count > 0 &&
                MessageBox.Show(this, "Delete selected statistic(s)?", "Confirm", MessageBoxButtons.OKCancel,
                                MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.OK)
            {
                foreach (DataGridViewRow row in dgvMain.SelectedRows)
                {
                    IStatsData stats = GetStatsFromGridRow(row);
                    DataSourceAdapter.DeleteStats(stats.StatID);
                }
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        void m_statsReader_NewStastics(object sender, NewStatisticsEventArgs e)
        {
            if (e.Statistics != null && m_currentPlayFile != null && m_currentPlayFile.GameFileID.HasValue)
            {
                e.Statistics.MapName      = e.Statistics.MapName.ToUpper();
                e.Statistics.GameFileID   = m_currentPlayFile.GameFileID.Value;
                e.Statistics.SourcePortID = m_currentPlayForm.SelectedSourcePort.SourcePortID;

                if (e.Update)
                {
                    IStatsData stats = DataSourceAdapter.GetStats(e.Statistics.GameFileID).LastOrDefault(x => x.MapName == e.Statistics.MapName);
                    if (stats != null)
                    {
                        DataSourceAdapter.DeleteStats(stats.StatID);
                    }
                }

                DataSourceAdapter.InsertStats(e.Statistics);
            }
        }