Exemplo n.º 1
0
        public void GetDataTest()
        {
            Dictionary <ItemType, ItemInfo> infoList = ReadItemData.GetData();

            TestItemInfo(infoList[ItemType.Player], name: "Player", itemType: ItemType.Player, character: '@', description: "The Player");
            TestItemInfo(infoList[ItemType.Rat], name: "Rat", itemType: ItemType.Rat, character: 'r', description: "A vile little sewer rat. These rodents seem to be everywhere!");
        }
Exemplo n.º 2
0
        public CartInfo GetCartInfo(string items)
        {
            IGetItem readObject = new ReadItemData();
            CartInfo r          = new CartInfo();

            var split = items.Split(',');

            //SubTotal
            double subtotal = 0.0;

            foreach (var item in split)
            {
                //Change this to parse
                var data = readObject.GetItem(Convert.ToInt32(item));
                r.Items.Add(data);
                subtotal += data.ItemPrice;
            }
            r.Subtotal = subtotal;

            //Discount
            //if(user.rewards >= 5)
            //{
            var newTotal = (r.Subtotal * (1 - 0.1));

            //}

            //Tax
            r.Tax = Math.Round((subtotal * 0.1), 2);

            //Rewards
            r.Rewards = (int)((r.Subtotal - (r.Subtotal % 10)) / 10);

            return(r);
        }
        public Item GetItem(int id)
        {
            //System.Console.WriteLine("Returned an id of: " + id);
            IGetItem getItem = new ReadItemData();

            return(getItem.GetAnItem(id));
        }
Exemplo n.º 4
0
        public Item Get(int id)
        {
            IGetItem readObject = new ReadItemData();

            return(readObject.GetItem(id));
        }
Exemplo n.º 5
0
        public List <Item> ReadItems()
        {
            IGetAllItems readObject = new ReadItemData();

            return(readObject.GetAllItems());
        }
        public List <Item> GetAllItems()
        {
            IGetAllItems allItems = new ReadItemData();

            return(allItems.GetAllItems());
        }