Пример #1
0
        public static MyPlants GetPlantBed()
        {
            int      width    = GetInt("Please Enter in the Width");
            int      length   = GetInt("Please Enter in the Length");
            MyPlants plantBox = new MyPlants(length, width);

            return(plantBox);
        }
Пример #2
0
        public static int GetPlantChoice(MyPlants plantBox)
        {
            int i = 0;

            foreach (Plant myPlant in plantBox.GetAllPlants())
            {
                Console.WriteLine($"[{i++}]{myPlant.PlantName}");
            }
            return(GetInt("Please Enter the ID of the Plant"));
        }
Пример #3
0
        static void Main(string[] args)
        {
            SqlConnection gardenDB = new SqlConnection(@"Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=C:\USERS\RINZLER\DOCUMENTS\ACADEMY\CODE\GARDENBOX\GARDENBOX.MDF;Integrated Security=True");

            gardenDB.Open();
            MyPlants    plantbed  = GetPlantBed();
            GardenBoxDB plantDATA = new GardenBoxDB(gardenDB);

            plantbed.AddPlantsToGardenBox(plantDATA.GetPlantList()); //add db to plantbed
            int plantchoice = GetPlantChoice(plantbed);

            Console.WriteLine($"You can plant {plantbed.CalculatePlanting(plantchoice)} {plantbed.GetAllPlants()[plantchoice]}");


            Console.ReadLine();
            gardenDB.Close();
        }