Exemple #1
0
 public PlantFamily GetFamily()
 {
     if (family == null)
     {
         family = GardenData.LoadedData.GetFamily(FamilyID);
     }
     return(family);
 }
 /// <summary>
 /// Removes a plant family from the family collection and removes all references to plants and varieties in this family
 /// </summary>
 public void RemoveFamily(PlantFamily family)
 {
     RemoveFamily(family.ID);
     foreach (Garden garden in Gardens.Values)
     {
         foreach (Planting planting in garden.Plantings.Values)
         {
             planting.RemoveFamily(family);
         }
     }
 }
        public Plant GetPlant(string familyID, string plantID)
        {
            PlantFamily family = GetFamily(familyID);
            Plant       plant;

            if (family.TryGetPlant(plantID, out plant))
            {
                return(plant);
            }
            else
            {
                throw new GardenDataException("plantID not found: " + plantID);
            }
        }
Exemple #4
0
 /// <summary>
 /// Removes all references to the family
 /// </summary>
 public void RemoveFamily(PlantFamily family) =>
 RemoveById((arg) => arg.FamilyKey.Equals(family.ID));
        public static int GetLastYear() => 2030;  //TODO

        public void AddFamily(string key, PlantFamily family)
        {
            Families.Add(key, family);
            family.ID = key;
        }