private void Btn_start_batch_Click(object sender, RoutedEventArgs e)
        {
            if (cb_Phase.SelectedItem != null && cb_PlantType.SelectedItem != null)
            {
                string chosenType   = cb_PlantType.SelectedItem.ToString();
                int    chosen_phase = int.Parse(cb_Phase.SelectedItem.ToString().Substring(8, 2));
                int    phase        = cb_Phase.SelectedIndex + 1;
                int    plantId      = 0;

                for (int i = 0; i < plants.Count; i++)
                {
                    if (chosenType == plants.GetPlantType(i))
                    {
                        plantId = plants.GetPlantId(i);
                    }
                }

                DateTime start = DateTime.Now;
                DateTime end   = DateTime.Now.Date.AddDays(chosen_phase);

                con.NewBatch(phase, start, end, plantId);
                mainWindow.Visibility = Visibility.Visible;
                this.Close();
            }
            else
            {
                MessageBox.Show("vælg en blomst OG en fase");
            }
        }
Beispiel #2
0
        public void PlantTypeRepo_Can_Get_Properties_From_Item_Using_Methods()
        {
            PlantTypeRepo p = new PlantTypeRepo();

            p.AddItem(new PlantType(1, "Rose", "15", "20", "25", "20"));

            Assert.AreEqual(1, p.GetPlantId(0));
            Assert.AreEqual("Rose", p.GetPlantType(0));
            Assert.AreEqual("15", p.GetPlantPhaseOne(0));
            Assert.AreEqual("20", p.GetPlantPhaseTwo(0));
            Assert.AreEqual("25", p.GetPlantPhaseThree(0));
            Assert.AreEqual("20", p.GetPlantPhaseFour(0));
        }