private void DefacturationLot(List <CsLotri> ListLotSelect, bool isDestructionLot) { prgBar.Visibility = System.Windows.Visibility.Visible; try { CsStatFacturation _laStat = new CsStatFacturation(); FacturationServiceClient service = new FacturationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Facturation")); service.DefacturerLotCompleted += (s, args) => { if (args != null && args.Cancelled) { return; } _laStat = args.Result; if (_laStat != null) { if (!isDestructionLot) { Message.Show("Nombre de client :" + _laStat.NombreCalcule + "\r\n Montant défacturé : " + decimal.Parse(_laStat.Montant.ToString()).ToString("N2"), "Statistique"); this.OKButton.IsEnabled = true; } else { Action = SessionObject.Enumere.Normal; UcTypeFacturation _ctrlDateExige = new UcTypeFacturation(); _ctrlDateExige.Closed += new EventHandler(galatee_OkClickedClient); _ctrlDateExige.Show(); } } prgBar.Visibility = System.Windows.Visibility.Collapsed; }; service.DefacturerLotAsync(ListLotSelect, Action); service.CloseAsync(); } catch (Exception ex) { prgBar.Visibility = System.Windows.Visibility.Collapsed; throw ex; } }
private void OKButton_Click(object sender, RoutedEventArgs e) { this.OKButton.IsEnabled = false; ListSelectionnee = new List <CsLotri>(); ListSelectionnee = RetourneLotriSelectionner(_ListeLotriObs); if (ListSelectionnee != null && ListSelectionnee.Count != 0) { if (!IsDefacturation && !IsDestructionSimulation) { UcTypeFacturation _ctrlDateExige = new UcTypeFacturation(); _ctrlDateExige.Closed += new EventHandler(galatee_OkClickedClient); _ctrlDateExige.Show(); } else { string leMsg = string.Empty; if (IsDefacturation) { leMsg = Langue.msgDefacturation; } else { leMsg = Langue.msgSuppressionSimulation; } var w = new MessageBoxControl.MessageBoxChildWindow(Langue.LibelleModule, leMsg, MessageBoxControl.MessageBoxButtons.YesNo, MessageBoxControl.MessageBoxIcon.Information); w.OnMessageBoxClosed += (_, result) => { if (w.Result == MessageBoxResult.OK) { DefacturationLot(ListSelectionnee); } }; w.Show(); } } }