Beispiel #1
0
 /// <summary>
 /// Convert a WCF user to User entity
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 private User WCFtoUser(UserWcf user)
 {
     User ret = new User();
     ret.ID = user.ID;
     ret.username = user.Username;
     ret.money = user.money;
     if (user.numOfGames != null)
         ret.numOfGames = (int)user.numOfGames;
     ret.isAdmin = user.isAdmin;
     return ret;
 }
Beispiel #2
0
 /// <summary>
 /// Add new Game using user object
 /// </summary>
 /// <param name="IP"></param>
 /// <param name="u"></param>
 public Game AddGame(string IP, User u)
 {
     return AddGame(IP, u.username);
 }
Beispiel #3
0
 /// <summary>
 /// Create a new User object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="username">Initial value of the username property.</param>
 /// <param name="password">Initial value of the password property.</param>
 /// <param name="money">Initial value of the money property.</param>
 /// <param name="isAdmin">Initial value of the isAdmin property.</param>
 public static User CreateUser(global::System.Int32 id, global::System.String username, global::System.String password, global::System.Int32 money, global::System.Boolean isAdmin)
 {
     User user = new User();
     user.ID = id;
     user.username = username;
     user.password = password;
     user.money = money;
     user.isAdmin = isAdmin;
     return user;
 }
Beispiel #4
0
 /// <summary>
 /// Get Game by the user that opened it
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public Game GetGame(User user)
 {
     using (BlackJackDataEntities ctx = new BlackJackDataEntities())
     {
         var ret =
                  from p in ctx.Game
                  where p.FirstUser == user.username
                  orderby p.ID descending
                  select p;
         if (ret.Count<Game>() != 0)
             return ret.First<Game>();
     }
     return null;
 }
Beispiel #5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the User EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUser(User user)
 {
     base.AddObject("User", user);
 }