Exemple #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            int i = 0;


            foreach (MedecinModel medecin in viewModel.LstMedecin)
            {
                if (medecin.IsSelected)
                {
                    i++;
                }
            }

            if (i == 0)
            {
                MessageBox.Show("Veuillez selectionner les medecins a supprimer");
            }
            else
            {
                MessageBoxResult messageBoxResult = MessageBox.Show("Are you sure? you want to delete " + i + " Rows ?", "Delete Confirmation", MessageBoxButton.YesNo);

                if (messageBoxResult == MessageBoxResult.Yes)
                {
                    using (SQLiteOperation sQLiteOperation = new SQLiteOperation(".\\AquaDB.db"))
                    {
                        foreach (MedecinModel medecin in viewModel.LstMedecin)
                        {
                            if (medecin.IsSelected)
                            {
                                Medecin medecinRow = new Medecin
                                {
                                    IdMedecin = medecin.IdMedecin
                                };

                                sQLiteOperation.Delete <Medecin>(medecinRow);
                                DataContext = new MedecinDetailsViewModel();
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
 public UserControl_Medecin()
 {
     InitializeComponent();
     viewModel   = new MedecinDetailsViewModel();
     DataContext = viewModel;
 }