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(); }
private void OnTimestampRemoved(Timestamp removedTimestamp) { }
private void OnTimestampAdded(Timestamp addedTimestamp) { }
public static void DeleteTimestamp( Timestamp timestamp ) { timestamp.Player.Timestamps.Remove( timestamp ); TablesDB.DataContext.Timestamps.DeleteOnSubmit( timestamp ); }
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 ); } } }