Beispiel #1
0
        public List <UserTable> GetAllUser()
        {
            var toReturn = new List <UserTable>();

            try
            {
                using (var db = new connectionsLinqDataContext())
                {
                    var temp = db.GetAllUser().ToList();
                    foreach (var v in temp)
                    {
                        UserTable toAdd             = ConvertToUser(v);
                        var       decryptedpassword = PasswordSecurity.Decrypt("securityPassword", toAdd.password, false);

                        toAdd.password = decryptedpassword;
                        toReturn.Add(toAdd);
                    }
                    return(toReturn);
                }
            }
            catch (Exception)
            {
                return(null);
            }
        }
Beispiel #2
0
 public void DeleteSystemLog(int logId)
 {
     try
     {
         using (connectionsLinqDataContext db = new connectionsLinqDataContext())
         {
             db.DeleteSystemLogById(logId);
         }
     }
     catch (Exception e)
     {
     }
 }
Beispiel #3
0
 public void AddGameToUserSpectetorGames(int userId, int roomId, int gameId)
 {
     try
     {
         using (var db = new connectionsLinqDataContext())
         {
             db.AddNewSpectetorGamesOfUser(userId, roomId, gameId);
         }
     }
     catch (Exception)
     {
         return;
     }
 }
Beispiel #4
0
 public void EditUserAvatar(int id, string newAvatar)
 {
     try
     {
         using (var db = new connectionsLinqDataContext())
         {
             db.EditAvatar(id, newAvatar);
         }
     }
     catch (Exception)
     {
         return;
     }
 }
Beispiel #5
0
 public void EditUserPoints(int id, int newPoints)
 {
     try
     {
         using (var db = new connectionsLinqDataContext())
         {
             db.EditUserPoints(id, newPoints);
         }
     }
     catch (Exception)
     {
         return;
     }
 }
Beispiel #6
0
 public void EditUserTotalProfit(int id, int newTotalProfit)
 {
     try
     {
         using (var db = new connectionsLinqDataContext())
         {
             db.EditUserTotalProfit(id, newTotalProfit);
         }
     }
     catch (Exception)
     {
         return;
     }
 }
Beispiel #7
0
 public void EditUserNumOfGamesPlayed(int id, int newEditUserNumOfGamesPlayed)
 {
     try
     {
         using (var db = new connectionsLinqDataContext())
         {
             db.EditUserNumOfGamesPlayed(id, newEditUserNumOfGamesPlayed);
         }
     }
     catch (Exception)
     {
         return;
     }
 }
Beispiel #8
0
 public void EditUserLeagueName(int id, LinqToSql.LeagueName newLeagueName)
 {
     try
     {
         using (var db = new connectionsLinqDataContext())
         {
             db.EditUserLeagueName(id, newLeagueName.League_Value);
         }
     }
     catch (Exception)
     {
         return;
     }
 }
Beispiel #9
0
 public void EditUserIsActive(int id, bool newIsActive)
 {
     try
     {
         using (var db = new connectionsLinqDataContext())
         {
             db.EditUserIsActive(id, newIsActive);
         }
     }
     catch (Exception)
     {
         return;
     }
 }
Beispiel #10
0
 public void EditUserHighestCashGainInGame(int Id, int newHighestCashGainInGame)
 {
     try
     {
         using (var db = new connectionsLinqDataContext())
         {
             db.EditUserHighestCashGainInGame(Id, newHighestCashGainInGame);
         }
     }
     catch (Exception)
     {
         return;
     }
 }
Beispiel #11
0
 public void EditEmail(int id, string newEmail)
 {
     try
     {
         using (var db = new connectionsLinqDataContext())
         {
             db.EditEmail(id, newEmail);
         }
     }
     catch (Exception)
     {
         return;
     }
 }
Beispiel #12
0
 public void EditUserName(int id, string newUserName)
 {
     try
     {
         using (var db = new connectionsLinqDataContext())
         {
             db.EditUsername(id, newUserName);
         }
     }
     catch (Exception)
     {
         return;
     }
 }
Beispiel #13
0
 public void EditUserId(int oldId, int newId)
 {
     try
     {
         using (var db = new connectionsLinqDataContext())
         {
             db.EditUserId(newId, oldId);
         }
     }
     catch (Exception)
     {
         return;
     }
 }
Beispiel #14
0
 public void DeleteUserByUsername(string username)
 {
     try
     {
         using (var db = new connectionsLinqDataContext())
         {
             db.DeleteUserByUserName(username);
         }
     }
     catch (Exception)
     {
         return;
     }
 }
Beispiel #15
0
 public void DeleteActiveGameOfUser(int userId, int roomId, int gameId)
 {
     try
     {
         using (var db = new connectionsLinqDataContext())
         {
             db.DeleteUserActiveGame(userId, roomId, gameId);
         }
     }
     catch (Exception)
     {
         return;
     }
 }
Beispiel #16
0
 public void DeleteUserById(int userId)
 {
     try
     {
         using (var db = new connectionsLinqDataContext())
         {
             db.DeleteUserById(userId);
         }
     }
     catch (Exception e)
     {
         return;
     }
 }
Beispiel #17
0
 public List <SystemLog> GetAllSystemLogs()
 {
     try
     {
         using (connectionsLinqDataContext db = new connectionsLinqDataContext())
         {
             return(db.SystemLogs.ToList());
         }
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Beispiel #18
0
 public List <TexasHoldem.Database.LinqToSql.Log> GetAllLogs()
 {
     try
     {
         using (connectionsLinqDataContext db = new connectionsLinqDataContext())
         {
             return(db.Logs.ToList());
         }
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Beispiel #19
0
 public int GetLeagueValByName(string name)
 {
     try
     {
         using (connectionsLinqDataContext db = new connectionsLinqDataContext())
         {
             var temp = db.GetLeageValByName(name);
             return(temp.First().League_Value);
         }
     }
     catch (Exception e)
     {
         return(-1);
     }
 }
Beispiel #20
0
 public int GetGameModeValByName(string v)
 {
     try
     {
         using (connectionsLinqDataContext db = new connectionsLinqDataContext())
         {
             var temp = db.GetGameModeValByName(v);
             return(temp.First().Game_mode_value);
         }
     }
     catch (Exception e)
     {
         return(-1);
     }
 }
Beispiel #21
0
 public bool DeleteGameRoomPref(int roomId)
 {
     try
     {
         using (connectionsLinqDataContext db = new connectionsLinqDataContext())
         {
             db.DeleteGameRoomPref(roomId);
             return(true);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Beispiel #22
0
 public bool UpdateGameRoomPotSize(int newPot, int roomId)
 {
     try
     {
         using (connectionsLinqDataContext db = new connectionsLinqDataContext())
         {
             db.UpdateGameRoomPotSize(newPot, roomId);
             return(true);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Beispiel #23
0
 public GetErrorLogByIdResult GetErrorLogById(int logId)
 {
     try
     {
         using (var db = new connectionsLinqDataContext())
         {
             var res = db.GetErrorLogById(logId).ToList().First();
             return(res);
         }
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Beispiel #24
0
        /*    public LinqToSql.GameRoomPreferance GetPrefByRoomId(int roomId)
         *  {
         *      LinqToSql.GameRoomPreferance toRet = new GameRoomPreferance();
         *      try
         *      {
         *          using (connectionsLinqDataContext db = new connectionsLinqDataContext())
         *          {
         *              var temp = db.getga(roomId).ToList();
         *              foreach (var v in temp)
         *              {
         *                  toRet.Game_Id = v.Game_Id;
         *                  toRet.Game_Mode = v.Game_Mode;
         *                  toRet.is_Spectetor = v.is_Spectetor;
         *                  toRet.League_name = v.League_name;
         *                  toRet.max_player_in_room = v.max_player_in_room;
         *                  toRet.Min_player_in_room = v.Min_player_in_room;
         *                  toRet.room_id = v.room_id;
         *                  toRet.Sb = v.Sb;
         *                  toRet.starting_chip = v.starting_chip;
         *                  toRet.enter_paying_money = v.enter_paying_money;
         *                  toRet.Bb = v.Bb;
         *              }
         *              return toRet;
         *          }
         *      }
         *      catch (Exception e)
         *      {
         *          return null;
         *      }
         *  }*/

        public bool InsertGameRoom(GameRoom toIns)
        {
            try
            {
                using (connectionsLinqDataContext db = new connectionsLinqDataContext())
                {
                    db.InsertGameRoomToDb(toIns.RoomId, toIns.GameId, toIns.Replay,
                                          toIns.GameXML, toIns.isActive);
                    return(true);
                }
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Beispiel #25
0
 public bool UpdateGameRoom(int roomId, int gameId, XElement newXML, bool newIsActive, string newRep)
 {
     try
     {
         using (connectionsLinqDataContext db = new connectionsLinqDataContext())
         {
             string oldRep = db.GetGameRoomReplyById(roomId).First().Replay;
             db.UpdateGameRoom(roomId, gameId, newXML, newIsActive, string.Concat(oldRep, newRep));
             return(true);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Beispiel #26
0
        public void EditPassword(int id, string newPassword)
        {
            try
            {
                using (var db = new connectionsLinqDataContext())
                {
                    var encryptedpassword = PasswordSecurity.Encrypt("securityPassword", newPassword, false);

                    db.EditPassword(id, encryptedpassword);
                }
            }
            catch (Exception)
            {
                return;
            }
        }
Beispiel #27
0
        public List <GetUserSpectetorsGameResult> GetUserSpectetorsGameResult(int userId)
        {
            List <GetUserSpectetorsGameResult> toReturn = new List <GetUserSpectetorsGameResult>();

            try
            {
                using (var db = new connectionsLinqDataContext())
                {
                    toReturn = db.GetUserSpectetorsGame(userId).ToList();
                    return(toReturn);
                }
            }
            catch (Exception)
            {
                return(toReturn);
            }
        }
Beispiel #28
0
 public bool InsertPref(GameRoomPreferance toAdd)
 {
     try
     {
         using (connectionsLinqDataContext db = new connectionsLinqDataContext())
         {
             db.InsertPrefToDb(toAdd.Roomid, toAdd.CanSpectate, toAdd.MinPlayers,
                               toAdd.MaxPlayers, toAdd.BuyInPolicy, toAdd.EnterGamePolicy,
                               toAdd.MinBet, toAdd.League, toAdd.GameMode, toAdd.GameId, toAdd.PotSize);
             return(true);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Beispiel #29
0
 public void AddNewUser(UserTable toAddUser)
 {
     try
     {
         using (connectionsLinqDataContext db = new connectionsLinqDataContext())
         {
             var encryptedpassword = PasswordSecurity.Encrypt("securityPassword", toAddUser.password, false);
             db.AddNewUser(toAddUser.userId, toAddUser.username, toAddUser.name, toAddUser.email, encryptedpassword, toAddUser.avatar, toAddUser.points, toAddUser.money, toAddUser.gamesPlayed, toAddUser.leagueName, toAddUser.winNum, toAddUser.HighestCashGainInGame, toAddUser.TotalProfit, toAddUser.inActive);
             //db.UserTables.InsertOnSubmit(toAddUser);
             //    db.SubmitChanges();
         }
     }
     catch (Exception e)
     {
         return;
     }
 }
Beispiel #30
0
 public GameRoomPreferance GetGameRoomPrefById(int roomid)
 {
     try
     {
         using (connectionsLinqDataContext db = new connectionsLinqDataContext())
         {
             var temp = db.GetGameRoomPrefById(roomid).ToList();
             if (temp.Capacity == 0)
             {
                 return(null);
             }
             return(ConvertGamePref(temp.First()));
         }
     }
     catch (Exception e)
     {
         return(null);
     }
 }