Ejemplo n.º 1
0
    public int GetGoodQt(Good.TYPE _type)
    {
        foreach (Good _good in _goods)
        {
            if (_good.Type == _type)
            {
                return(_good.Quantity);
            }
        }

        return(0);
    }
Ejemplo n.º 2
0
    public void AddGood(Good.TYPE _type, int _quantity)
    {
        bool isPresent = false;

        foreach (Good gd in _goods)
        {
            if (gd.Type == _type)
            {
                isPresent = true;
                gd.Add(_quantity);
                break;
            }
        }
        if (!isPresent)
        {
            _goods.Add(new Good(_type, _quantity));
        }
    }