Exemplo n.º 1
0
    public Rewards Find(int Id)
    {
        Rewards found    = null;
        string  sqlQuery = "SELECT " + lootColumns + " FROM Reward WHERE Id = @Id ";

        DBParameter        pId        = new DBParameter("@Id", Id);
        List <DBParameter> parameters = new List <DBParameter>();

        parameters.Add(pId);

        DBResults results = ExecuteReader(sqlQuery, parameters);

        List <Rewards> list = GetList(results);

        if (list.Count != 0)
        {
            found = list[0];
        }

        results.Close();

        return(found);
    }
Exemplo n.º 2
0
    private List <Rewards> GetList(DBResults results)
    {
        Rewards        found = null;
        List <Rewards> ret   = new List <Rewards>();

        while (results.reader.Read())
        {
            int    Id         = results.reader.GetInt32(0);
            string RewardName = null;
            if (!results.reader.IsDBNull(1))
            {
                RewardName = results.reader.GetString(1);
            }
            string RewardImagePath = null;
            if (!results.reader.IsDBNull(2))
            {
                RewardImagePath = results.reader.GetString(2);
            }
            int RewardTimer        = results.reader.GetInt32(3);
            int HPChange           = results.reader.GetInt32(4);
            int EnergyChange       = results.reader.GetInt32(5);
            int ShieldChange       = results.reader.GetInt32(6);
            int ShipResourcesFound = results.reader.GetInt32(7);
            int SkillFound         = results.reader.GetInt32(8);
            int CharacterUnlocked  = results.reader.GetInt32(9);
            int LootTableValue     = results.reader.GetInt32(10);
            int EventType          = results.reader.GetInt32(11);

            found = new Rewards(Id, RewardName, RewardImagePath, RewardTimer, HPChange, EnergyChange, ShieldChange, ShipResourcesFound, SkillFound, CharacterUnlocked, LootTableValue, EventType);

            ret.Add(found);
            Debug.Log("id= " + Id + "  rewardName =" + RewardName);
        }
        results.Close();
        return(ret);
    }