private void butDelete_Click(object sender, RoutedEventArgs e)
        {
            if (dtgPlants.SelectedItems.Count <= 0) return;

            Plant plant = (Plant)dtgPlants.SelectedItem;

            if (_mCurrentPlant != null && plant.Id.ToString() == _mCurrentPlant.Id.ToString())
            {
                _mCurrentPlant = null;
                tcPlant.Visibility = Visibility.Hidden;
            }

            Plant.DeletePlantById(plant.Id);
            ReloadListView();
        }
        private void dtgPlants_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (dtgPlants.SelectedItems.Count > 0)
            {
                Plant maPlante = (Plant)dtgPlants.SelectedItem;

                //Afficher un message si les modifications n'ont pas ete enregistres.
                _mCurrentPlant = maPlante;

                Thread t;

                this.pbLoading.IsIndeterminate = true;
                t = new Thread(new ThreadStart(RefreshPlant));
                t.Start();

            }
            else
            {
                if (tcPlant.Visibility == Visibility.Hidden) return;

                tcPlant.Visibility = Visibility.Hidden;
            }
        }
        public static Plant[] GetAllPlantByNameContains(string searchString)
        {
            DataTable dtPlants = Db.Query("SELECT * FROM Plants");

            List<Plant> dtgPlants = new List<Plant>();

            for (int i = 0; i < dtPlants.Rows.Count; i++)
            {
                DataRow row = dtPlants.Rows[i];
                Plant plant = new Plant(Convert.ToInt32(row["PlantID"]));

                if (plant.Name.ToUpper().Contains(searchString.ToUpper()))
                {
                    dtgPlants.Add(plant);
                }
            }

            return dtgPlants.ToArray();
        }