Exemplo n.º 1
0
        public void AddSupplierToCategory(long supplier, Guid category)
        {
            if (Suppliers.ContainsKey(supplier))
            {
                var categoryId = Suppliers[supplier];
                if (CategoriesById.ContainsKey(categoryId))
                {
                    var c = GetCategoryByCategoryId(categoryId);
                    c.Suppliers.Remove(supplier);
                }

                Suppliers[supplier] = category;
            }
            else
            {
                Suppliers.Add(supplier, category);
            }

            if (CategoriesById.ContainsKey(category))
            {
                GetCategoryByCategoryId(category).Suppliers.Add(supplier);
            }

            OnCategoryUpdated(GetCategoryByCategoryId(category), supplier);
        }
Exemplo n.º 2
0
        public static Guid GetCategoryBySupplier(long supplierId)
        {
            if (Suppliers.ContainsKey(supplierId))
            {
                return(Suppliers[supplierId]);
            }

            return(Guid.Empty);
        }