Beispiel #1
0
        public eshShoppingListInvType UpdateMarketItemEnShoppingList(int listID, int itemID, int units)
        {
            eshShoppingListInvType slit = SelectMarketItemEnShoppingListPorID(listID, itemID);

            if (slit == null)
            {
                CreateMarketItemEnShoppingList(listID, itemID, units);
            }
            else
            {
                invType it = Contexto.invTypes.Where(it2 => it2.typeID == itemID).FirstOrDefault();
                if (it == null)
                {
                    throw new ApplicationException(Messages.err_itemNoExiste);
                }
                slit.units = units;
                if (slit.units < 0)
                {
                    slit.units = 0;
                }


                RepositorioItems repoItems = new RepositorioItems(this.Contexto);
                slit.volume = slit.units * RepositorioItems.GetVolume(it);
            }
            Contexto.SaveChanges();
            return(slit);
        }
Beispiel #2
0
        internal void DeleteItemFromShoppingList(int id, int itemID, EveShoppingContext contexto = null)
        {
            RepositorioShoppingLists repo = new RepositorioShoppingLists(contexto);
            eshShoppingListInvType   item = repo.SelectMarketItemEnShoppingListPorID(id, itemID);

            contexto.eshShoppingListInvTypes.Remove(item);
            repo.ShoppingListUpdated(id, contexto);
            contexto.SaveChanges();
        }
Beispiel #3
0
        public void UpdateMarketItemToShoppingList(string publicID, int itemID, int units)
        {
            RepositorioShoppingLists repo = new RepositorioShoppingLists();
            eshShoppingList          list = repo.SelectShopingListPorPublicID(publicID);

            if (units < 1)
            {
                units = 1;
            }
            eshShoppingListInvType slit = repo.UpdateMarketItemEnShoppingList(list.shoppingListID, itemID, units);

            repo.ShoppingListUpdated(list.shoppingListID);
        }
Beispiel #4
0
        public eshShoppingListInvType CreateMarketItemEnShoppingList(int listID, int itemID, int units)
        {
            eshShoppingListInvType slit = new eshShoppingListInvType();

            slit.typeID         = itemID;
            slit.shoppingListID = listID;
            slit.units          = units;

            invType it = Contexto.invTypes.Where(it2 => it2.typeID == itemID).FirstOrDefault();

            if (it == null)
            {
                throw new ApplicationException(Messages.err_itemNoExiste);
            }
            RepositorioItems repoItems = new RepositorioItems();

            slit.volume = units * RepositorioItems.GetVolume(it);
            Contexto.eshShoppingListInvTypes.Add(slit);
            Contexto.SaveChanges();
            return(slit);
        }