///<summary> ///Author: Sara Nanke ///Gets plant regions ///Date: 4/7/16 ///</summary> public bool?[] GetPlantRegions(Plant plant) { try { return(PlantAccessor.RetrievePlantRegions(plant)); } catch (Exception) { throw; } }
///<summary> ///Author: Stenner Kvindlog ///EditPLant sends new and old plant to database to be edited //calling to the plant accessor ///Date: 3/4/16 ///</summary> public bool EditPlant(Plant newPlant, Plant oldPlant) { try { bool myBool = PlantAccessor.EditPlant(newPlant, oldPlant); return(myBool); } catch (Exception) { throw; } }
///<summary> ///Author: Stenner Kvindlog ///AddPlant creates a plant //calling to the plant accessor ///Date: 3/4/16 ///</summary> public int AddPlant(Plant newPlant) { try { //bool myBool = PlantAccessor.AddPlant(newPlant); return(PlantAccessor.CreatePlant(newPlant)); } catch (Exception) { throw; } }
///<summary> ///Author: Stenner Kvindlog ///fetchPlantList gets a list of all the plants //calling to the plant accessor ///Date: 3/4/16 ///</summary> public List <Plant> GetPlantList(Active active) { try { List <Plant> plants = PlantAccessor.RetrievePlantList(active); foreach (Plant plant in plants) { plant.RegionIDs = PlantAccessor.RetrievePlantRegions(plant); } return(plants); //return AddTestPlants(false); } catch (Exception ex) { throw ex; } }
///<summary> ///Author: Sara Nanke ///Sets plant regions ///Date: 4/7/16 ///</summary> public bool AddPlantRegions(Plant plant, bool?[] regions) { List <int> regionIds = new List <int>(); for (int i = 0; i < regions.Length; i++) { if (regions[i] == true) { regionIds.Add(i + 1); } } try { return(PlantAccessor.CreatePlantRegions(plant, regionIds)); } catch (Exception) { throw; } }
///<summary> ///Author: Stenner Kvindlog ///fetchPlant gets a plant by plantId //calling to the plant accessor ///Date: 3/4/16 ///</summary> public Plant GetPlant(int plantId) { return(PlantAccessor.RetrievePlant(plantId)); }