Compare commits
No commits in common. "8e2e38e9b5cae300fb2b99f69ec07858582e09f4" and "4ae6ea799f1e7223c05a1e613368d37535c0b9d3" have entirely different histories.
8e2e38e9b5
...
4ae6ea799f
@ -63,7 +63,7 @@ namespace CarpentryWorkshopView
|
||||
DataGridView.Rows.Clear();
|
||||
foreach (var wood in _shopWoods)
|
||||
{
|
||||
DataGridView.Rows.Add(new object[] { wood.Key, wood.Value.Item1.WoodName, wood.Value.Item1.Price,wood.Value.Item2 });
|
||||
DataGridView.Rows.Add(new object[] { wood.Key, wood.Value.Item1.WoodName, wood.Value.Item2 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,11 +79,7 @@ namespace CarpentryWorkshopFileImplement.Implements
|
||||
|
||||
public bool CheckAvailability(int woodId, int count)
|
||||
{
|
||||
int minus = source.Shops
|
||||
.SelectMany(shop => shop.ShopWoods
|
||||
.Where(wood => wood.Value.Item1.Id == woodId)
|
||||
.Select(wood => wood.Value.Item2))
|
||||
.Sum();
|
||||
int minus = source.Shops.Select(x => x.ShopWoods.Select(y => (y.Value.Item1.Id == woodId ? y.Value.Item2 : 0)).Sum()).Sum();
|
||||
count -= minus;
|
||||
return count <= 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user