public void LoadUser() { if (mapHistoryUser == null) { mapHistoryUser = new Dictionary <int, UserRank>(); } else { mapHistoryUser.Clear(); } string strConn = BaseConfig.ConnStr; SqlConnection sqlConn = new SqlConnection(strConn.Trim()); SqlCommand sqlCmd = new SqlCommand(@"SELECT p.PlayId, g.GameId, a.AreaId, u.* FROM EMTradePlay.dbo.UserList" + BaseConfig.PlayId + @" u, EMTradePlay.dbo.Play p, EMTradePlay.dbo.Game g, EMTradePlay.dbo.Area a WHERE u.AreaId = a.AreaId AND a.GameId=g.GameId AND g.PlayId = p.PlayId AND u.Validity = 1 AND u.TradeFlag = 1 AND p.PlayId = @PlayId", sqlConn); sqlCmd.Parameters.Add("@PlayId", SqlDbType.Int).Value = BaseConfig.PlayId; SqlDataReader sqlReader = sqlCmd.ExecuteReader(); while (sqlReader.Read()) { int nUserid = Convert.ToInt32(sqlReader["userId"]); UserRank uRank = new UserRank(); uRank.Initialize(); uRank.UserId = Convert.ToInt32(sqlReader["userId"]); uRank.AreaId = Convert.ToInt32(sqlReader["areaId"]); uRank.UserName = sqlReader["userName"].ToString(); uRank.UserDataBase = sqlReader["UserDataBase"].ToString(); mapHistoryUser[nUserid] = uRank; } }
public void LoadUser() { if (mapHistoryUser == null) mapHistoryUser = new Dictionary<int, UserRank>(); else mapHistoryUser.Clear(); string strConn = BaseConfig.ConnStr; SqlConnection sqlConn = new SqlConnection(strConn.Trim()); SqlCommand sqlCmd = new SqlCommand(@"SELECT p.PlayId, g.GameId, a.AreaId, u.* FROM EMTradePlay.dbo.UserList" + BaseConfig.PlayId + @" u, EMTradePlay.dbo.Play p, EMTradePlay.dbo.Game g, EMTradePlay.dbo.Area a WHERE u.AreaId = a.AreaId AND a.GameId=g.GameId AND g.PlayId = p.PlayId AND u.Validity = 1 AND u.TradeFlag = 1 AND p.PlayId = @PlayId", sqlConn); sqlCmd.Parameters.Add("@PlayId", SqlDbType.Int).Value = BaseConfig.PlayId; SqlDataReader sqlReader = sqlCmd.ExecuteReader(); while (sqlReader.Read()) { int nUserid = Convert.ToInt32(sqlReader["userId"]); UserRank uRank = new UserRank(); uRank.Initialize(); uRank.UserId = Convert.ToInt32(sqlReader["userId"]); uRank.AreaId = Convert.ToInt32(sqlReader["areaId"]); uRank.UserName = sqlReader["userName"].ToString(); uRank.UserDataBase = sqlReader["UserDataBase"].ToString(); mapHistoryUser[nUserid] = uRank; } }