示例#1
0
 private void SaveSerieToDb(DartsSerie serie)
 {
     try
     {
         foreach (var t in serie.Throws)
         {
             _connectionDb.ConnectionContext.GameLines.Add(
                 new GameLine
             {
                 GameHeader = _gameHeader,
                 Factor     = t.Score.Factor,
                 Sector     = t.Score.Sector,
                 ThrowNum   = t.Number,
                 IsBust     = t.Score.IsBust,
                 Team       = _gameFlow.CurrentTeam,
                 User       = _gameFlow.CurrentUser
             }
                 );
         }
         _connectionDb.ConnectionContext.SaveChanges();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#2
0
 private void AddSerie(User user, DartsSerie serie)
 {
     if (_userSeries.ContainsKey(user))
     {
         if (_userSeries[user] == null)
         {
             _userSeries[user] = new List <DartsSerie>();
         }
         _userSeries[user].Add(serie);
     }
     else
     {
         _userSeries.Add(user, new List <DartsSerie>(new[] { serie }));
     }
 }
示例#3
0
        private void AddGridRow(DartsSerie serie)
        {
            var grid = GetCurrentGrid();

            if (grid != null)
            {
                if (grid.Rows.Count < _gameFlow.CurrentSerieNum)
                {
                    var row = grid.Rows.AddNew();
                    row.Cells[_gameFlow.CurrentUser.Id.ToString(CultureInfo.InvariantCulture)].Value = serie.GetSum();
                }
                else
                {
                    grid.Rows[_gameFlow.CurrentSerieNum - 1].Cells[_gameFlow.CurrentUser.Id.ToString(CultureInfo.InvariantCulture)].Value =
                        serie.GetSum();
                }
            }
        }