public bool IsExistPlayerName(string playerName) { try { string sql = "select * from GamePlayer where playerName ='" + playerName + "'"; GamePlayer gamePlayer = new GamePlayer(); conn = OracleBean.GetConnection(); conn.Open(); comm = new OracleCommand(sql, conn); rdr = comm.ExecuteReader(); if (rdr.Read()) { return(true); } } catch (OracleException ex) { //写入错误日志 } finally { OracleBean.Close(rdr, comm, conn); } return(false); }
public List <GameUser> GetAllGameUser() { try { string sql = "select * from gameUser"; List <GameUser> gameUsers = new List <GameUser>(); conn = OracleBean.GetConnection(); conn.Open(); comm = new OracleCommand(sql, conn); rdr = comm.ExecuteReader(); while (rdr.Read()) { GameUser gameUser = new GameUser(); gameUser.userId = rdr.GetString(0); gameUser.userPwd = rdr.GetString(1); gameUser.userName = rdr.GetString(2); gameUsers.Add(gameUser); gameUser = null; } sql = null; return(gameUsers); } catch (OracleException ex) { //写入错误日志 } finally { OracleBean.Close(rdr, comm, conn); } return(null); }
public GameUser GetAGameUser(string userId) { try { string sql = "select * from gameUser where userId ='" + userId + "'"; GameUser gameUser = new GameUser(); conn = OracleBean.GetConnection(); conn.Open(); comm = new OracleCommand(sql, conn); rdr = comm.ExecuteReader(); if (rdr.Read()) { gameUser.userId = rdr.GetString(0); gameUser.userPwd = rdr.GetString(1); gameUser.userName = rdr.GetString(2); } sql = null; return(gameUser); } catch (OracleException ex) { //写入错误日志 } finally { OracleBean.Close(rdr, comm, conn); } return(null); }
public bool UpdateGameUser(GameUser gameUser) { try { conn = OracleBean.GetConnection(); conn.Open(); string sql = "update GameUser set " + "userPwd ='" + gameUser.userPwd + "' " + "userName = '******'" + gameUser.userId + "'"; comm = new OracleCommand(sql, conn); sql = null; return(comm.ExecuteNonQuery() > 0); } catch (OracleException ex) { //写入错误日志 } finally { OracleBean.Close(rdr, comm, conn); } return(false); }
public bool InsertGameUser(GameUser gameUser) { try { conn = OracleBean.GetConnection(); conn.Open(); string sql = "insert into GameUser values( " + "'" + gameUser.userId + "'," + "'" + gameUser.userPwd + "'," + "'" + gameUser.userName + "')"; comm = new OracleCommand(sql, conn); sql = null; return(comm.ExecuteNonQuery() > 0); } catch (OracleException ex) { //写入错误日志 } finally { OracleBean.Close(rdr, comm, conn); } return(false); }
public List <GamePlayer> GetAllGamePlayer() { try { string sql = "select * from GamePlayer"; List <GamePlayer> gamePlayers = new List <GamePlayer>(); conn = OracleBean.GetConnection(); conn.Open(); comm = new OracleCommand(sql, conn); rdr = comm.ExecuteReader(); while (rdr.Read()) { GamePlayer gamePlayer = new GamePlayer(); gamePlayer.userId = rdr.GetString(0); gamePlayer.userServer = rdr.GetString(1); gamePlayer.playerId = rdr.GetString(2); gamePlayer.playerPrefabName = rdr.GetString(3); gamePlayer.playerName = rdr.GetString(4); gamePlayer.playerLevel = rdr.GetInt32(5); gamePlayer.playerNowExp = rdr.GetInt32(6); gamePlayer.playerUpExp = rdr.GetInt32(7); gamePlayer.playerNowHP = rdr.GetInt32(8); gamePlayer.playerNowMP = rdr.GetInt32(9); gamePlayer.playerMoveSpeed = rdr.GetFloat(10); gamePlayer.playerRunSpeed = rdr.GetFloat(11); gamePlayer.playerElement = rdr.GetString(12); gamePlayer.playerMaxHP = rdr.GetInt32(13); gamePlayer.playerMaxMP = rdr.GetInt32(14); gamePlayer.playerAttack = rdr.GetInt32(15); gamePlayer.playerElementHurt = rdr.GetInt32(16); gamePlayer.playerAttackHit = rdr.GetInt32(17); gamePlayer.playerAttackCrit = rdr.GetInt32(18); gamePlayer.playerCritHurt = rdr.GetFloat(19); gamePlayer.playerDefend = rdr.GetInt32(20); gamePlayer.playerAgility = rdr.GetInt32(21); gamePlayer.playerMagicDefend = rdr.GetInt32(22); gamePlayer.playerGCoins = rdr.GetInt32(23); gamePlayer.playerSCoins = rdr.GetInt32(24); gamePlayers.Add(gamePlayer); gamePlayer = null; } sql = null; return(gamePlayers); } catch (OracleException ex) { //写入错误日志 } finally { OracleBean.Close(rdr, comm, conn); } return(null); }
public List <GameGood> GetAllGamePlayerGameGood(string playerId) { try { string sql = "select * from GameGood where playerId ='" + playerId + "'"; List <GameGood> gameGoods = new List <GameGood>(); conn = OracleBean.GetConnection(); conn.Open(); comm = new OracleCommand(sql, conn); rdr = comm.ExecuteReader(); while (rdr.Read()) { GameGood gameGood = new GameGood(); gameGood.playerId = rdr.GetString(0); gameGood.goodId = rdr.GetInt32(1); gameGood.goodName = rdr.GetString(2); gameGood.goodDescrip = rdr.GetString(3); gameGood.goodBuyPrice = rdr.GetInt32(4); gameGood.goodSellPrice = rdr.GetInt32(5); gameGood.goodIconPath = rdr.GetString(6); gameGood.goodItemType = rdr.GetString(7); gameGood.goodCount = rdr.GetInt32(8); gameGood.goodType = rdr.GetString(9); gameGood.goodEquip = rdr.GetString(10); gameGood.ArmorBlood = rdr.GetInt32(11); gameGood.ArmorDefend = rdr.GetInt32(12); gameGood.ArmorAgility = rdr.GetInt32(13); gameGood.ConsumableBcakHP = rdr.GetInt32(14); gameGood.ConsumableBcakMP = rdr.GetInt32(15); gameGood.WeaponDamage = rdr.GetInt32(16); gameGood.WeaponMP = rdr.GetInt32(17); gameGoods.Add(gameGood); gameGood = null; } sql = null; return(gameGoods); } catch (OracleException ex) { //写入错误日志 } finally { OracleBean.Close(rdr, comm, conn); } return(null); }
public bool UpdateGamePlayer(GamePlayer gamePlayer) { try { conn = OracleBean.GetConnection(); conn.Open(); string sql = "update GamePlayer set " + "userId ='" + gamePlayer.userId + "', " + "userServer ='" + gamePlayer.userServer + "', " + "playerPrefab ='" + gamePlayer.playerPrefabName + "', " + "playerName ='" + gamePlayer.playerName + "', " + "playerLevel ='" + gamePlayer.playerLevel + "', " + "playerNowExp ='" + gamePlayer.playerNowExp + "', " + "playerUpExp ='" + gamePlayer.playerUpExp + "', " + "playerNowHP ='" + gamePlayer.playerNowHP + "', " + "playerNowMP ='" + gamePlayer.playerNowMP + "', " + "playerMoveSpeed ='" + gamePlayer.playerMoveSpeed + "', " + "playerRunSpeed ='" + gamePlayer.playerRunSpeed + "', " + "playerElement ='" + gamePlayer.playerElement + "', " + "playerMaxHP ='" + gamePlayer.playerMaxHP + "', " + "playerMaxMP ='" + gamePlayer.playerMaxMP + "', " + "playerAttack ='" + gamePlayer.playerAttack + "', " + "playerElementHurt ='" + gamePlayer.playerElementHurt + "', " + "playerAttackHit ='" + gamePlayer.playerAttackHit + "', " + "playerAttackCrit ='" + gamePlayer.playerAttackCrit + "', " + "playerCritHurt ='" + gamePlayer.playerCritHurt + "', " + "playerDefend ='" + gamePlayer.playerDefend + "', " + "playerAgility ='" + gamePlayer.playerAgility + "', " + "playerMagicDefend ='" + gamePlayer.playerMagicDefend + "' " + "playerGCoins ='" + gamePlayer.playerGCoins + "' " + "playerSCoins ='" + gamePlayer.playerSCoins + "' " + "where playerId ='" + gamePlayer.playerId + "'"; Console.WriteLine(sql); comm = new OracleCommand(sql, conn); sql = null; return(comm.ExecuteNonQuery() > 0); } catch (OracleException ex) { //写入错误日志 } finally { OracleBean.Close(rdr, comm, conn); } return(false); }
public bool InsertGamePlayer(GamePlayer gamePlayer) { try { conn = OracleBean.GetConnection(); conn.Open(); string sql = "insert into GamePlayer values(" + "'" + gamePlayer.userId + "'," + "'" + gamePlayer.userServer + "'," + "'" + gamePlayer.playerId + "'," + "'" + gamePlayer.playerPrefabName + "'," + "'" + gamePlayer.playerName + "'," + "'" + gamePlayer.playerLevel + "'," + "'" + gamePlayer.playerNowExp + "'," + "'" + gamePlayer.playerUpExp + "'," + "'" + gamePlayer.playerNowHP + "'," + "'" + gamePlayer.playerNowMP + "'," + "'" + gamePlayer.playerMoveSpeed + "'," + "'" + gamePlayer.playerRunSpeed + "'," + "'" + gamePlayer.playerElement + "'," + "'" + gamePlayer.playerMaxHP + "'," + "'" + gamePlayer.playerMaxMP + "'," + "'" + gamePlayer.playerAttack + "'," + "'" + gamePlayer.playerElementHurt + "'," + "'" + gamePlayer.playerAttackHit + "'," + "'" + gamePlayer.playerAttackCrit + "'," + "'" + gamePlayer.playerCritHurt + "'," + "'" + gamePlayer.playerDefend + "'," + "'" + gamePlayer.playerAgility + "'," + "'" + gamePlayer.playerMagicDefend + "'," + "'" + gamePlayer.playerGCoins + "'," + "'" + gamePlayer.playerSCoins + "')"; comm = new OracleCommand(sql, conn); sql = null; return(comm.ExecuteNonQuery() > 0); } catch (OracleException ex) { //写入错误日志 } finally { OracleBean.Close(rdr, comm, conn); } return(false); }
public bool InsertGameGood(GameGood gameGood) { try { conn = OracleBean.GetConnection(); conn.Open(); string sql = "insert into GameGood values(" + "'" + gameGood.playerId + "'," + "'" + gameGood.goodId + "'," + "'" + gameGood.goodName + "'," + "'" + gameGood.goodDescrip + "'," + "'" + gameGood.goodBuyPrice + "'," + "'" + gameGood.goodSellPrice + "'," + "'" + gameGood.goodIconPath + "'," + "'" + gameGood.goodItemType + "'," + "'" + gameGood.goodCount + "'," + "'" + gameGood.goodType + "'," + "'" + gameGood.goodEquip + "'," + "'" + gameGood.ArmorBlood + "'," + "'" + gameGood.ArmorDefend + "'," + "'" + gameGood.ArmorAgility + "'," + "'" + gameGood.ConsumableBcakHP + "'," + "'" + gameGood.ConsumableBcakMP + "'," + "'" + gameGood.WeaponDamage + "'," + "'" + gameGood.WeaponMP + "')"; comm = new OracleCommand(sql, conn); sql = null; return(comm.ExecuteNonQuery() > 0); } catch (OracleException ex) { //写入错误日志 } finally { OracleBean.Close(rdr, comm, conn); } return(false); }
public bool DeleteGameGood(string playerId, int goodId) { try { conn = OracleBean.GetConnection(); conn.Open(); string sql = "delete from GameGood where playerId ='" + playerId + "' and goodId =" + goodId; comm = new OracleCommand(sql, conn); sql = null; return(comm.ExecuteNonQuery() > 0); } catch (OracleException ex) { //写入错误日志 } finally { OracleBean.Close(rdr, comm, conn); } return(false); }
public bool UpdateGameGood(GameGood gameGood) { try { conn = OracleBean.GetConnection(); conn.Open(); string sql = "update GameGood set " + "goodName ='" + gameGood.goodName + "', " + "goodDescrip ='" + gameGood.goodDescrip + "', " + "goodBuyPrice ='" + gameGood.goodBuyPrice + "', " + "goodSellPrice ='" + gameGood.goodSellPrice + "', " + "goodIconPath ='" + gameGood.goodIconPath + "', " + "goodItemType ='" + gameGood.goodItemType + "', " + "goodCount ='" + gameGood.goodCount + "', " + "goodType ='" + gameGood.goodType + "', " + "goodEquip ='" + gameGood.goodEquip + "', " + "ArmorBlood ='" + gameGood.ArmorBlood + "', " + "ArmorDefend ='" + gameGood.ArmorDefend + "', " + "ArmorAgility ='" + gameGood.ArmorAgility + "', " + "ConsumableBcakHP ='" + gameGood.ConsumableBcakHP + "', " + "ConsumableBcakMP ='" + gameGood.ConsumableBcakMP + "', " + "WeaponDamage ='" + gameGood.WeaponDamage + "', " + "WeaponMP ='" + gameGood.WeaponMP + "', " + "where playerId = '" + gameGood.playerId + "' and goodId = " + gameGood.goodId; comm = new OracleCommand(sql, conn); sql = null; return(comm.ExecuteNonQuery() > 0); } catch (OracleException ex) { //写入错误日志 } finally { OracleBean.Close(rdr, comm, conn); } return(false); }