public static void LoadCupomFlags() { try { using (NpgsqlConnection connection = SQLjec.getInstance().conn()) { NpgsqlCommand command = connection.CreateCommand(); connection.Open(); command.CommandText = "SELECT * FROM info_cupons_flags"; command.CommandType = CommandType.Text; NpgsqlDataReader data = command.ExecuteReader(); while (data.Read()) { CupomFlag cupom = new CupomFlag { ItemId = data.GetInt32(0), EffectFlag = (CupomEffects)data.GetInt64(1) }; Effects.Add(cupom); } command.Dispose(); data.Close(); connection.Dispose(); connection.Close(); } } catch (Exception ex) { SaveLog.fatal(ex.ToString()); Printf.b_danger("[CumpomEffectMananger] Fatal Error!"); } }
public static CupomFlag getCupomEffect(int id) { for (int i = 0; i < Effects.Count; i++) { CupomFlag flag = Effects[i]; if (flag.ItemId == id) { return(flag); } } return(null); }