static void Main(string[] args) { DAL conn = new DAL(); Console.WriteLine("starting tests:"); //testConn(conn); //conn.AddUser("john2", "pass", 1000); //conn.AddUser("john", "pass", 1000); //testConn(conn); Game g = conn.GetGame("153"); User u = conn.GetUser("john"); u.money = 5000; Console.WriteLine("lucky users is ID:" + u.ID + " username:"******" password:"******" money:" + u.money); //conn.UpdateDB(u); testConn(conn); Console.WriteLine("delete tests"); //conn.deleteAllUsers(); //conn.deleteAllGames(); Console.WriteLine("end"); }
/// <summary> /// Remove game of a user /// </summary> /// <param name="user"></param> /// <returns></returns> public bool RemoveGameByUser(UserWcf user) { DAL dal = new DAL(); User dbUser = dal.GetUser(user.ID); if (dbUser != null) { Game game = dal.GetGame(dbUser); if(game != null) { dal.removeGame(game); return true; } } return false; }
/// <summary> /// remove game specified by IP /// </summary> /// <param name="IP"></param> public void RemoveGameByIP(String IP) { DAL dal = new DAL(); Game game = dal.GetGame(IP); if(game != null) { dal.removeGame(game); WcfServiceCallback update = OperationContext.Current.GetCallbackChannel<WcfServiceCallback>(); update.updateGames("remove", gameToWCF(game)); // this should notify the cients that the lsit has been updatd } }