Пример #1
0
 public void GetResult(string itemName)
 {
     InventoryList.Clear();
     Task.Factory.StartNew(() =>
     {
         return(InventoryService.FindItemByName(itemName));
     }).ContinueWith(task =>
     {
         foreach (Inventory result in task.Result)
         {
             var quantityOnEbay     = InventoryService.FindEBayListingQuantity(result.ItemId);
             bool potentialOversold = false;
             if ((result.ExternalQuantity == 0 && result.AmazonQuantity > 0) || (result.ExternalQuantity == 0 && quantityOnEbay > 0))
             {
                 potentialOversold = true;
             }
             var resultDTO = new InventoryDTO
             {
                 ItemID            = result.ItemId,
                 SKU               = result.Sku,
                 Title             = result.Title,
                 Quantity          = result.ExternalQuantity,
                 Price             = result.FixedPrice,
                 QuantityOnEbay    = quantityOnEbay,
                 QuantityOnAmazon  = result.AmazonQuantity,
                 PotentialOversold = potentialOversold
             };
             InventoryList.Add(resultDTO);
         }
     },
                     System.Threading.CancellationToken.None,
                     TaskContinuationOptions.None,
                     TaskScheduler.FromCurrentSynchronizationContext());
 }
        /// <summary>
        /// Retrieves list of Inventory objects from SqlCommand, after database query
        /// number of rows retrieved and returned depends upon the rows field value
        /// </summary>
        /// <param name="cmd">The command object to use for query</param>
        /// <param name="rows">Number of rows to process</param>
        /// <returns>A list of Inventory objects</returns>
        private InventoryList GetList(SqlCommand cmd, long rows)
        {
            // Select multiple records
            SqlDataReader reader;
            long          result = SelectRecords(cmd, out reader);

            //Inventory list
            InventoryList list = new InventoryList();

            using ( reader )
            {
                // Read rows until end of result or number of rows specified is reached
                while (reader.Read() && rows-- != 0)
                {
                    Inventory inventoryObject = new Inventory();
                    FillObject(inventoryObject, reader);

                    list.Add(inventoryObject);
                }

                // Close the reader in order to receive output parameters
                // Output parameters are not available until reader is closed.
                reader.Close();
            }

            return(list);
        }
Пример #3
0
 public void Put(IItem item, int quantity = 1)
 {
     _cubeList.Add(item, quantity);
     if (item.Quantity == 0)
     {
         InventoryService.Remove(item);
     }
 }
Пример #4
0
        private void btnAddCar_Click(object sender, RoutedEventArgs e)
        {
            var maxCount = _cars?.Max(x => x.CarId) ?? 0;

            _cars?.Add(new Inventory {
                CarId = ++maxCount, Color = "Yellow", Make = "VW", PetName = "Birdie", IsChanged = false
            });
        }
Пример #5
0
 public void RefreshSellingItems(Level level)
 {
     _sellingItems.Clear();
     foreach (var shopItem in ShopItems)
     {
         if (level.Normal < shopItem.MinLevel)
         {
             continue;
         }
         for (int i = 0; i < SellingItemsRounds; i++)
         {
             if (Dice.TryGetChance(shopItem.SellChance))
             {
                 _sellingItems.Add(shopItem.ItemFactory.Build(level.Normal));
             }
         }
     }
 }
    public static InventoryList <EquipItemInfo, EquipItem> CreateList(List <EquipItem> recv_list)
    {
        InventoryList <EquipItemInfo, EquipItem> list = new InventoryList <EquipItemInfo, EquipItem>();

        recv_list.ForEach(delegate(EquipItem o)
        {
            list.Add(o);
        });
        return(list);
    }
    public static InventoryList <T, RECV_DATA> CreateList(List <RECV_DATA> recv_list)
    {
        InventoryList <T, RECV_DATA> list = new InventoryList <T, RECV_DATA>();

        recv_list.ForEach(delegate(RECV_DATA o)
        {
            list.Add(o);
        });
        return(list);
    }
Пример #8
0
    public static InventoryList <QuestItemInfo, QuestItem> CreateList(List <QuestItem> recv_list)
    {
        InventoryList <QuestItemInfo, QuestItem> list = new InventoryList <QuestItemInfo, QuestItem>();

        recv_list.ForEach(delegate(QuestItem o)
        {
            if (o.num > 0)
            {
                list.Add(o);
            }
        });
        return(list);
    }
Пример #9
0
        private void AddInventory(Ingredient ingredient)
        {
            InventoryList.Add(new Ingredient(ingredient.Name, ingredient.Weight, ingredient.Price));
            var match = TotalInv.Where(i => i.Name == ingredient.Name).Count();

            if (match == 0)
            {
                TotalInv.Add(new Ingredient(ingredient.Name, ingredient.Weight, ingredient.Price));
            }
            else
            {
                AdjustTotalInventory(ingredient);
            }
        }
Пример #10
0
 public void Add(IItem item)
 {
     if (item as SoulShot != null)
     {
         if (Inventory.SoulShot == null)
         {
             Inventory.SoulShot = (SoulShot)item;
         }
         else
         {
             Inventory.SoulShot.Quantity += item.Quantity;
             item.Quantity = 0;
         }
         return;
     }
     _bag.Add(item);
 }
Пример #11
0
    public static InventoryList <SkillItemInfo, SkillItem> CreateListFromItemInventory(InventoryList <ItemInfo, Item> itemInventory)
    {
        InventoryList <SkillItemInfo, SkillItem> inventoryList = new InventoryList <SkillItemInfo, SkillItem>();

        for (LinkedListNode <ItemInfo> linkedListNode = itemInventory.GetFirstNode(); linkedListNode != null; linkedListNode = linkedListNode.Next)
        {
            ItemInfo value = linkedListNode.Value;
            if (value.tableData.type == ITEM_TYPE.MATERIAL_MAGI && value.GetNum() > 0)
            {
                SkillItem skillItem = new SkillItem();
                skillItem.uniqId      = value.uniqueID.ToString();
                skillItem.skillItemId = (int)value.tableData.id;
                skillItem.level       = 1;
                inventoryList.Add(skillItem);
                inventoryList.GetLastNode().Value.num = value.GetNum();
                inventoryList.GetLastNode().Value.itemId = value.tableData.id;
            }
        }
        return(inventoryList);
    }
Пример #12
0
    public static InventoryList <SkillItemInfo, SkillItem> CreateListFromItem(List <Item> recv_list)
    {
        InventoryList <SkillItemInfo, SkillItem> list = new InventoryList <SkillItemInfo, SkillItem>();

        recv_list.ForEach(delegate(Item o)
        {
            ItemTable.ItemData itemData = Singleton <ItemTable> .I.GetItemData((uint)o.itemId);
            if (itemData.type == ITEM_TYPE.MATERIAL_MAGI && o.num > 0)
            {
                SkillItem item = new SkillItem
                {
                    uniqId      = o.uniqId,
                    skillItemId = o.itemId,
                    level       = (XorInt)1
                };
                list.Add(item);
                list.GetLastNode().Value.num    = o.num;
                list.GetLastNode().Value.itemId = (uint)o.itemId;
            }
        });
        return(list);
    }
Пример #13
0
        public override async void OnNavigatedTo(INavigationParameters parameters)
        {
            try
            {
                if (_dataviewColumnList == null)
                {
                    _dataviewColumnList = await _restClient.GetDataviewAtributeList(Settings.WorkgroupInventoryThumbnailDataview);

                    if (_dataviewColumnList != null)
                    {
                        if (_dataviewColumnList.Count > 1)
                        {
                            Header1 = _dataviewColumnList[1].title;
                        }
                        if (_dataviewColumnList.Count > 2)
                        {
                            Header2 = _dataviewColumnList[2].title;
                        }
                        if (_dataviewColumnList.Count > 3)
                        {
                            Header3 = _dataviewColumnList[3].title;
                        }
                        if (_dataviewColumnList.Count > 4)
                        {
                            Header4 = _dataviewColumnList[4].title;
                        }
                        if (_dataviewColumnList.Count > 5)
                        {
                            Header5 = _dataviewColumnList[5].title;
                        }
                        if (_dataviewColumnList.Count > 6)
                        {
                            Header6 = _dataviewColumnList[6].title;
                        }
                        if (_dataviewColumnList.Count > 7)
                        {
                            Header7 = _dataviewColumnList[7].title;
                        }
                    }
                }

                if (parameters.ContainsKey("inventory")) //Update UI
                {
                    InventoryThumbnail tempInventory = (InventoryThumbnail)parameters["inventory"];
                    WrappedSelection <InventoryThumbnail> inventoryThumbnailItem = _inventoryList.FirstOrDefault(item => item.Item.inventory_id == tempInventory.inventory_id);
                    if (inventoryThumbnailItem == null)
                    {
                        InventoryList.Add(new WrappedSelection <InventoryThumbnail> {
                            Item = tempInventory, IsSelected = false
                        });
                    }
                    else
                    {
                        inventoryThumbnailItem.Item = tempInventory;

                        /*
                         * int index = InventoryList.IndexOf(inventoryThumbnailItem);
                         * InventoryList.Remove(inventoryThumbnailItem);
                         * InventoryList.Insert(index, new WrappedSelection<InventoryThumbnail> { Item = tempInventory, IsSelected = false });
                         */
                    }
                }

                if (parameters.ContainsKey("InventoryThumbnail"))
                {
                    InventoryThumbnail tempInventory = (InventoryThumbnail)parameters["InventoryThumbnail"];
                    WrappedSelection <InventoryThumbnail> inventoryThumbnailItem = _inventoryList.FirstOrDefault(item => item.Item.inventory_id == tempInventory.inventory_id);
                    if (inventoryThumbnailItem == null)
                    {
                        InventoryList.Add(new WrappedSelection <InventoryThumbnail> {
                            Item = tempInventory, IsSelected = false
                        });
                    }
                    else
                    {
                        inventoryThumbnailItem.Item = tempInventory;
                    }

                    AccessionCount = InventoryList.Select(i => i.Item.AccessionNumber).Distinct().Count();
                    TotalQuantity  = _inventoryList.Select(i => i.Item.quantity_on_hand).Sum();
                }

                if (parameters.ContainsKey("InventoryThumbnailList"))
                {
                    List <InventoryThumbnail> inventoryList = (List <InventoryThumbnail>)parameters["InventoryThumbnailList"];

                    foreach (var inventoryThumbnail in inventoryList)
                    {
                        var wrappedInventory = InventoryList.FirstOrDefault(x => x.Item.inventory_id == inventoryThumbnail.inventory_id);
                        if (wrappedInventory == null)
                        {
                            WrappedSelection <InventoryThumbnail> temp = new WrappedSelection <InventoryThumbnail>()
                            {
                                Item = inventoryThumbnail, IsSelected = false
                            };
                            InventoryList.Add(temp);
                        }
                        else
                        {
                            wrappedInventory.Item = inventoryThumbnail;

                            /*int index = _inventoryList.IndexOf(wrappedInventory);
                             * InventoryList.Remove(wrappedInventory);
                             * InventoryList.Insert(index, new WrappedSelection<InventoryThumbnail> { Item = inventoryThumbnail, IsSelected = wrappedInventory.IsSelected });*/
                        }
                    }

                    AccessionCount = InventoryList.Select(i => i.Item.AccessionNumber).Distinct().Count();
                    TotalQuantity  = _inventoryList.Select(i => i.Item.quantity_on_hand).Sum();
                }
            }
            catch (Exception ex)
            {
                await PageDialogService.DisplayAlertAsync("Error", ex.Message, "OK");
            }
        }
Пример #14
0
 private void InventoryAddEventHandler(object sender, InventoryAddEventArgs args)
 {
     InventoryList.Add(args.Inventory);
 }
        public override async void OnNavigatedTo(INavigationParameters parameters)
        {
            try
            {
                if (parameters.ContainsKey("inventoryList"))
                {
                    List <InventoryThumbnail> inventoryList = (List <InventoryThumbnail>)parameters["inventoryList"];

                    foreach (var inventoryThumbnail in inventoryList)
                    {
                        var wrappedInventory = InventoryList.FirstOrDefault(x => x.Item.inventory_id == inventoryThumbnail.inventory_id);
                        if (wrappedInventory == null)
                        {
                            WrappedSelection <InventoryThumbnail> temp = new WrappedSelection <InventoryThumbnail>()
                            {
                                Item = inventoryThumbnail, IsSelected = false
                            };
                            InventoryList.Add(temp);
                        }
                        else
                        {
                            int index = _inventoryList.IndexOf(wrappedInventory);
                            InventoryList.Remove(wrappedInventory);
                            InventoryList.Insert(index, new WrappedSelection <InventoryThumbnail> {
                                Item = inventoryThumbnail, IsSelected = wrappedInventory.IsSelected
                            });
                        }
                    }

                    AccessionCount = InventoryList.Select(i => i.Item.accession_id).Distinct().Count();
                }
                if (parameters.ContainsKey("InventoryThumbnail"))
                {
                    InventoryThumbnail inventoryThumbnail = (InventoryThumbnail)parameters["InventoryThumbnail"];

                    WrappedSelection <InventoryThumbnail> inventoryThumbnailItem = _inventoryList.FirstOrDefault(item => item.Item.inventory_id == inventoryThumbnail.inventory_id);
                    if (inventoryThumbnailItem == null)
                    {
                        InventoryList.Add(new WrappedSelection <InventoryThumbnail> {
                            Item = inventoryThumbnail, IsSelected = false
                        });
                    }
                    else
                    {
                        int index = InventoryList.IndexOf(inventoryThumbnailItem);
                        InventoryList.Remove(inventoryThumbnailItem);
                        InventoryList.Insert(index, new WrappedSelection <InventoryThumbnail> {
                            Item = inventoryThumbnail, IsSelected = false
                        });
                    }
                }
                if (parameters.ContainsKey("message"))
                {
                    await _pageDialogService.DisplayAlertAsync("Message", (string)parameters["message"], "OK");
                }
            }
            catch (Exception ex)
            {
                await _pageDialogService.DisplayAlertAsync("Error", ex.Message, "OK");
            }
        }