Пример #1
0
        public static void AddPlayer(int tableNum, string name, DateTime startTime)
        {
            PoolTable table = TableDataService.GetTable(tableNum);
            Player newPlayer = new Player(tableNum, name, startTime);
            table.Players.Add(newPlayer);
            TablesDB.DataContext.Players.InsertOnSubmit(newPlayer);
            TablesDB.DataContext.SubmitChanges();

            Timestamp newTimestamp = new Timestamp(newPlayer.ID, tableNum, startTime);
            newPlayer.Timestamps.Add(newTimestamp);
            TablesDB.DataContext.Timestamps.InsertOnSubmit(newTimestamp);
            TablesDB.DataContext.SubmitChanges();
        }
Пример #2
0
        private void OnTimestampRemoved(Timestamp removedTimestamp)
        {

        }
Пример #3
0
        private void OnTimestampAdded(Timestamp addedTimestamp)
        {

        }
 public static void DeleteTimestamp( Timestamp timestamp )
 {
     timestamp.Player.Timestamps.Remove( timestamp );
     TablesDB.DataContext.Timestamps.DeleteOnSubmit( timestamp );
 }
Пример #5
0
        public static void UpdateTimestamps( PoolTable table, DateTime timestamp)
        {
            if ( table.Players.Count > 0 )
            {
                int numPlayers = table.Players.Count;

                foreach ( Player player in table.Players )
                {
                    Timestamp newTimestamp = new Timestamp(
                        player.ID, table.TableNum, numPlayers, timestamp );

                    player.Timestamps.Add( newTimestamp );

                    TablesDB.DataContext.Timestamps.InsertOnSubmit( newTimestamp );
                }
            }
        }