예제 #1
0
파일: Bl.cs 프로젝트: samuelarbibe/taki
        public void BlRemoveCard(Message m)
        {
            PlayerCardDb db = new PlayerCardDb();

            PlayerCardConnection temp = db.GetConnectionByPlayerIdAndCardId(m.Target, m.Card);

            db.Delete(temp);
        }
예제 #2
0
        protected override BaseEntity CreateModel(BaseEntity entity)
        {
            PlayerDb playerDb = new PlayerDb();
            CardDb   cardDb   = new CardDb();

            PlayerCardConnection con = entity as PlayerCardConnection;

            con.Id     = (int)Reader["ID"];
            con.Player = playerDb.GetPlayerById((int)Reader["player_id"]);
            con.Card   = cardDb.SelectById((int)Reader["card_id"]);
            return(con);
        }
예제 #3
0
파일: Bl.cs 프로젝트: samuelarbibe/taki
        public void BlAddCard(Message m)
        {
            PlayerCardDb db = new PlayerCardDb();

            PlayerCardConnection c = new PlayerCardConnection()
            {
                Player = m.Target,
                Card   = m.Card
            };

            db.Insert(c);
        }
예제 #4
0
        public override void CreateDeleteSql(BaseEntity entity, OleDbCommand command)
        {
            PlayerCardConnection con = entity as PlayerCardConnection;

            command.CommandText = "DELETE FROM Player_Card_Table WHERE [ID] = @id ";

            //parameters

            command.Parameters.Add(new OleDbParameter("@id", con.Id));

            Console.WriteLine("PlayerCardConnection between player [" + con.Player.Id + "] and card [" + con.Card.Id +
                              "] DELETED");
        }
예제 #5
0
        public override void CreateInsertSql(BaseEntity entity, OleDbCommand command)
        {
            PlayerCardConnection con = entity as PlayerCardConnection;

            command.CommandText = "INSERT INTO Player_Card_Table (player_id, card_id) VALUES (@player_id, @card_id)";

            //parameters

            command.Parameters.Add(new OleDbParameter("@player_id", con.Player.Id));
            command.Parameters.Add(new OleDbParameter("@card_id", con.Card.Id));

            Console.WriteLine("PlayerCardConnection between player [" + con.Player.Id + "] and card [" + con.Card.Id +
                              "] INSERTED");
        }