private static void CreateProductTypeFromEveType(int typeId, EveType type) { var item = new ProductType(); item.TypeId = typeId; item.TypeName = type.name.en; var group = _groups.FirstOrDefault(p => p.Id == type.groupID); if (group != null) item.CategoryId = _categories.FirstOrDefault(p => group.CategoryId == p.Id).Id; var metaType = _metaTypes.FirstOrDefault(p => p.typeID == item.TypeId); if (metaType == null || metaType.metaGroupID == 0) { _productTypes.Add(item); return; } var metaGroup = _metaGroups.First(p => p.metaGroupID == metaType.metaGroupID); item.MetaGroup = metaGroup.metaGroupID; item.MetaParent = metaType.parentTypeID; _productTypes.Add(item); }
private static List<ProductType> NeedToProductType(IList<Need> need) { var list = new List<ProductType>(); foreach (var n in need) { var type = _productTypes.FirstOrDefault(p => p.TypeId.Equals(n.typeID)); if (type == null) continue; var prod = new ProductType(); prod.TypeId = type.TypeId; prod.TypeName = type.TypeName; prod.CategoryId = type.CategoryId; prod.Quantity = n.quantity; prod.Probability = n.probability; prod.Level = n.level; prod.MetaGroup = type.MetaGroup; prod.MetaParent = type.MetaParent; list.Add(prod); } return list; }
public async Task<bool> PreManufacturingValidation(ProductType product) { var toSell = await _todoRepository.GetList<ToMarket>(); if (toSell.Any(p => p.TypeId.Equals(product.TypeId))) return false; // todo: settingify this var allowedCategories = new List<int> { 6, 7, 8, 18 }; if (!allowedCategories.Contains(product.CategoryId)) return false; return true; }