コード例 #1
0
ファイル: Hand.cs プロジェクト: jerometerry/PokerHandHistory
        public bool Save(SQLite.DataStore store, System.Data.SQLite.SQLiteConnection connection)
        {
            if (this.Saved == true)
            {
                return false;
            }

            if (connection.State != ConnectionState.Open)
            {
                connection.Open();
            }

            Hand existing = store.GetHand(this.SiteId, this.HandNumber);
            if (existing == null)
            {
                this.Id = store.InsertHand(this.SiteId, this.HandNumber, connection);

                foreach (HandPlayer player in this.HandPlayers)
                {
                    player.HandId = this.Id;
                    if (player.Saved == false)
                    {
                        player.Save(store, connection);
                    }
                }
            }
            else
            {
                Logger.Error("Hand {0} already imported", this.HandNumber);
            }

            this.Saved = true;
            return true;
        }