Exemple #1
0
    public string returnItem(string name, int id)
    {
        Transaction t = dataBase.getTransaction(id);

        if (t != null)
        {
            if (t.Rebate == false)
            {
                if (t.Items.ContainsKey(name))
                {
                    Item i = t.Items[name];
                    i.Returned = true;
                    if (i.Amount > 1)
                    {
                        i.Amount--;
                        i.RAmount++;
                    }
                    else if (i.Amount == 1)
                    {
                        i.Amount = 0;
                        i.RAmount++;
                    }
                    else
                    {
                        return("Max number of items returned.");
                    }

                    return("Item returned.");
                }
                return("Item not found.");
            }
            return("Rebate Entered, return not valid.");
        }
        return("Transaction not found.");
    }
Exemple #2
0
    public void enterRebate(int id, DateTime date)
    {
        bool valid = false;

        if (date.CompareTo(deadline) != 1)
        {
            Transaction user = dataBase.getTransaction(id);
            if (user != null)
            {
                valid = true;
                float percentage = (float)11 / 100;
                rebate.RebateAmount = user.Total * percentage;
                rebate.TransID      = id;
                dataBase.addRebate(rebate);
                user.Rebate = true;
            }
        }
        updateRebateOutput(valid);
    }