private void OnPrintClicked(object sender, FactureEventArgs <Machine> args)
        {
            Facture facture = args.Facture;

            facture.Type = "Facture Avoir";
            facture.UpdateId();

            if (service.Save(facture))
            {
                foreach (Machine machine in args.Collection)
                {
                    machine.State       = "Rendu en Stock";
                    machine.IdFacture   = facture.IdFacture;
                    machine.TypeFacture = facture.Type;
                    serviceMachine.UpdateMachine(machine);
                }

                MessageBox.Show("Facture Annulée!\n id : " + facture.IdFacture);
                PrintPreview printWindow = new PrintPreview(facture, args.Collection);
                printWindow.Show();
            }
            else
            {
                MessageBox.Show("Annulation impossible !\n id : " + facture.IdFacture + "\n Error : " + service.getMessage());
            }
        }
        private void ImprimerButton_Click(object sender, RoutedEventArgs e)
        {
            IList dgr = facturesDataGrid.SelectedItems;

            foreach (DataRowView row in dgr)
            {
                Facture facture = this.FillFactureFromRow(row);

                PrintPreview printWindow;

                ObservableCollection <Machine> machineCollection = service.GetFactureMachineList(facture);

                if (machineCollection.Count == 0)
                {
                    ObservableCollection <Tache> tacheCollection = service.GetFactureTacheList(facture);
                    printWindow = new PrintPreview(facture, tacheCollection);
                }
                else
                {
                    printWindow = new PrintPreview(facture, machineCollection);
                }

                printWindow.Show();
            }
            this.FillDataGrid();
        }