public bool IsCanPrize(int gameId, int userid) { System.Data.Common.DbCommand storedProcCommand = this._db.GetStoredProcCommand("cp_IsCanPrize"); this._db.AddInParameter(storedProcCommand, "@GameId", System.Data.DbType.Int32, gameId); this._db.AddInParameter(storedProcCommand, "@UserId", System.Data.DbType.Int32, userid); this._db.AddOutParameter(storedProcCommand, "@Result", System.Data.DbType.Int32, 4); this._db.ExecuteNonQuery(storedProcCommand); object value = storedProcCommand.Parameters["@Result"].Value; bool result; if (value != null && !string.IsNullOrEmpty(value.ToString())) { CanPrizeError canPrizeError = (CanPrizeError)int.Parse(value.ToString()); if (canPrizeError != CanPrizeError.可以玩) { throw new Exception(canPrizeError.ToString()); } result = true; } else { result = false; } return(result); }
public bool IsCanPrize(int gameId, int userid) { DbCommand storedProcCommand = this._db.GetStoredProcCommand("cp_IsCanPrize"); this._db.AddInParameter(storedProcCommand, "@GameId", DbType.Int32, gameId); this._db.AddInParameter(storedProcCommand, "@UserId", DbType.Int32, userid); this._db.AddOutParameter(storedProcCommand, "@Result", DbType.Int32, 4); this._db.ExecuteNonQuery(storedProcCommand); object obj2 = storedProcCommand.Parameters["@Result"].Value; if ((obj2 != null) && !string.IsNullOrEmpty(obj2.ToString())) { CanPrizeError error = (CanPrizeError)int.Parse(obj2.ToString()); if (error != CanPrizeError.可以玩) { throw new Exception(error.ToString()); } return(true); } return(false); }