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()); } }