private static bool ExchangeItem(int Usernum, int ExchangeID, out List <ExchangeItemInfo> exinfo) { exinfo = new List <ExchangeItemInfo>(); using (var con = new MySqlConnection(Conf.Connstr)) { con.Open(); using (var cmd = new MySqlCommand(string.Empty, con)) { cmd.Parameters.Clear(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "usp_exchangeSystem_Exchange"; cmd.Parameters.Add("userNum", MySqlDbType.Int32).Value = Usernum; cmd.Parameters.Add("exchangeID", MySqlDbType.Int32).Value = ExchangeID; using (MySqlDataReader reader = cmd.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { ExchangeItemInfo exi = new ExchangeItemInfo { type = Convert.ToInt32(reader["type"]), id = Convert.ToInt32(reader["id"]), count = Convert.ToInt32(reader["count"]) }; exinfo.Add(exi); } return(true); } } } } return(false); }
public bool IsSameKind(ExchangeItemInfo info) { if (null == info) { return false; } return requireItemNum == info.requireItemNum; }