Exemplo n.º 1
0
        /// <summary>
        /// Update multiple items
        /// </summary>
        /// <remarks>
        /// All other forms of update should call this one. ItemRepo provides an
        /// event (OnItemUpdate) to be used when an item is updated that
        /// allows subscribers to save their own attribute properties
        /// </remarks>
        /// <param name="ids">List of unique item identifiers</param>
        /// <returns>List of items updated</returns>
        override public List <Item> Update(List <Item> items)
        {
            // Create child items that are new
            void UpdateItems(List <Item> childrenItems)
            {
                childrenItems?.ForEach(child =>
                {
                    try
                    {
                        base.Update(new List <Item>()
                        {
                            child
                        });
                        OnItemUpdate?.Invoke(child);
                        UpdateItems(child.Children);
                    }
                    catch (Exception e)
                    {
                        throw new BotDatabaseException($"Unable to update item {child.Id}", e);
                    }
                });
            }

            UpdateItems(items);
            return(items);
        }
Exemplo n.º 2
0
        public async Task UpdateItem(TodoItem item)
        {
            await CreateConnection();

            await connection.UpdateAsync(item);

            OnItemUpdate?.Invoke(this, item);
        }
Exemplo n.º 3
0
    protected override bool ReleaseItem <T>(int quantity, T itemType, bool mustBeClean, out List <ItemTransferrable> items)
    {
        bool released = base.ReleaseItem(quantity, itemType, mustBeClean, out items);

        if (released)
        {
            OnItemUpdate?.Invoke();
        }

        return(released);
    }
Exemplo n.º 4
0
    public override bool ReceiveItem(ItemTransferrable[] items)
    {
        bool received = base.ReceiveItem(items);

        if (received)
        {
            OnItemUpdate?.Invoke();
        }

        return(received);
    }