public void Store(Distillery distillery)
 {
     if (!distilleryStore.Contains(distillery))
     {
         distilleryStore.Add(distillery);
     }
 }
        public List <Whisky> FindByDistillery(Distillery distillery)
        {
            var whiskies = (from w in whiskyStore
                            where
                            w.DistilleryId == distillery.Id
                            select w);

            return(whiskies.ToList());
        }
예제 #3
0
    public override bool CheckForNeighbouringBuildings()
    {
        Debug.Log("Checks for mill");
        List <Mill> chainBuildings = GetNeighbouringBuildings <Mill>();

        if (nextInChain == null && chainBuildings.Count >= 1)
        {
            Debug.Log(">= 1");
            nextInChain = chainBuildings[0];
            AssignCarrierDestination();
        }

        Debug.Log("Checks for distillery");
        List <Distillery> chainBuildings2 = GetNeighbouringBuildings <Distillery>();

        if (alternativeChain == null && chainBuildings2.Count >= 1)
        {
            Debug.Log(">= 1");
            alternativeChain = chainBuildings2[0];
            AssignCarrierAlternativeDestination();
        }

        return((nextInChain == null && chainBuildings.Count >= 1) || (alternativeChain == null && chainBuildings2.Count >= 1));
    }
예제 #4
0
        public void LoadDistilleries()
        {
            var distilleryFileContent = File.ReadAllLines(DistilleryFilePath);

            foreach (var distilleryLine in distilleryFileContent)
            {
                var distilleryData = distilleryLine.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries);

                if (distilleryData.Length == 2)
                {
                    var distilleryName = distilleryData[0];
                    var regionName     = distilleryData[1];

                    var distillery = new Distillery
                    {
                        Id     = Guid.NewGuid(),
                        Name   = distilleryName,
                        Region = (Region)Enum.Parse(typeof(Region), regionName)
                    };

                    distilleryRepository.Store(distillery);
                }
            }
        }