Пример #1
0
 private static void LoadFromDb()
 {
     _pool = new Dictionary<long, FactorStatistic>();
     var collection = new DataBaseCollection<FactorStatistic>();
     collection.Load(@"select BIT_MASK, FACTOR_NAME, NUMBER_OF_STARTERS, NUMBER_OF_WINNERS, ROI, IV from FACTOR_NAME");
     collection.ForEach(fs => _pool.Add(fs.BitMask, fs));
 }
Пример #2
0
        private void LoadAllRacesForTheDistance()
        {
            if (_skipLoading)
                return;

            try
            {
                Cursor = Cursors.WaitCursor;

                if (null == _currentRaceInfo)
                    return;

                _gridShowAllRacesForTheDistance.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;

                DateTime fd = _periodSelector.FromDate;
                DateTime td = _periodSelector.ToDate;

                string fromDate = string.Format("{0}{1:00}{2:00}", fd.Year, fd.Month, fd.Day);
                string toDate = string.Format("{0}{1:00}{2:00}", td.Year, td.Month, td.Day);
                string surf = _currentRaceInfo.Surface;
                string trackCode = _currentRaceInfo.TrackCode;
                string aboutFlag = _currentRaceInfo.AboutFlag.Trim();

                _tbDistance.Text = Utilities.ConvertYardsToMilesOrFurlongs((int) _currentRaceInfo.Distance);

                if (aboutFlag.Contains("A"))
                {
                    _tbDistance.Text = new string('*', 1) + _tbDistance.Text;
                }

                _tbSurface.Text = surf;
                var collection = new DataBaseCollection<RaceResults>();

                string sqlLoader = string.Format(_sqlLoadRacesForDistanceAndTrack, trackCode, _currentRaceInfo.Distance, surf, aboutFlag, fromDate, toDate);
                collection.Load(sqlLoader);

                RaceResults.InitializeGrid(_gridShowAllRacesForTheDistance, collection.Count);
                WinnerInfo thisRaceInfo = null;
                int rowIndex = 0;
                collection.ForEach(rr => rr.AddToGrid(_gridShowAllRacesForTheDistance, _currentRaceInfo.RaceId, rowIndex++));
                _gridShowAllRacesForTheDistance.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                _tbNumberOfRaces.Text = collection.Count.ToString();

            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }