Example #1
0
        public override void Delete(BaseEntity entity)
        {
            Game         game = entity as Game;
            PlayerGameDb pGdb = new PlayerGameDb(); //delete all connections related to this game

            ConnectionList pg = pGdb.SelectByGame(game);


            if (pg != null)
            {
                foreach (PlayerGameConnection c in pg
                         ) //delete all player-games connections to this Game id using PlayerGameDB.CreateDeleteSql
                {
                    Updated.Add(new ChangeEntity(pGdb.CreateDeleteSql, c));
                }

                Updated.Add(new ChangeEntity(CreateDeleteSql, entity)); //delete the player itself
            }
        }
Example #2
0
        public override void Delete(BaseEntity entity)
        {
            Player       p    = entity as Player;
            PlayerCardDb pCdb = new PlayerCardDb();
            PlayerGameDb pGdb = new PlayerGameDb();

            ConnectionList pc = pCdb.SelectByPlayer(p);
            ConnectionList pg = pGdb.SelectByPlayer(p);

            if (p != null)
            {
                foreach (PlayerCardConnection c in pc) //delete all cards connections to this player using PlayerCardDB
                {
                    Updated.Add(new ChangeEntity(pCdb.CreateDeleteSql, c));
                }

                foreach (PlayerGameConnection c in pg) //delete all games connections to this player using PlayerGameDB
                {
                    Updated.Add(new ChangeEntity(pGdb.CreateDeleteSql, c));
                }

                Updated.Add(new ChangeEntity(CreateDeleteSql, entity)); //delete the player itself
            }
        }