private void GetData() { try { prgBar.Visibility = System.Windows.Visibility.Visible; this.btnValider.IsEnabled = false; /* List<CsLclient> Factures = LireFichierReglement(); * * * * if (Factures == null || Factures.Count == 0) * throw new Exception("Ce fichier ne contient aucune ligne de règlement."); * * if (Factures.Count != this.totalFactureAnnonce) * throw new Exception("Le nombre de ligne annonné dans le recapitulatif est différent du nombre réel de ligne du fichier."); * * * if (Factures.Sum(a => a.MONTANT) != this.totalMontantAnnonce) * throw new Exception("Le montant total des règlements annonné dans le recapitulatif est différent de la somme des règlements du fichier."); * * this.txtNombre.Text = this.totalFactureAnnonce.ToString(); * this.txtMontant.Text = this.totalMontantAnnonce.Value.ToString(SessionObject.FormatMontant); * * affichage.Clear(); * affichage.AddRange(Factures); * dtgrdParametre.ItemsSource = null; * dtgrdParametre.ItemsSource = affichage; */ AdministrationServiceClient client = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration")); client.SelectSoldeFactureCompleted += (ssender, args) => { prgBar.Visibility = System.Windows.Visibility.Collapsed; if (args.Cancelled || args.Error != null) { string error = args.Error.Message; Message.ShowError(error, "Liste règlements"); return; } if (args.Result == null || args.Result.Count == 0) { Message.ShowError("Aucune donnée correspondante dans le système", "Liste règlements"); return; } affichage = args.Result; dtgrdParametre.ItemsSource = null; dtgrdParametre.ItemsSource = affichage; if (affichage.Count != affichage.FirstOrDefault().IDLOT) { Message.ShowWarning("Le nombre de ligne annonné dans le recapitulatif est différent du nombre réel de ligne du fichier.", "Liste règlements"); return; } if (affichage.Sum(a => a.MONTANT) != affichage.FirstOrDefault().MONTANTEXIGIBLE) { Message.ShowWarning("Le montant total des règlements annonné dans le recapitulatif est différent de la somme des règlements du fichier.", "Liste règlements"); return; } this.txtNombre.Text = affichage.FirstOrDefault().IDLOT.ToString(); this.txtMontant.Text = affichage.FirstOrDefault().MONTANTEXIGIBLE.Value.ToString(SessionObject.FormatMontant); this.btnValider.IsEnabled = true; }; //client.SelectSoldeFactureAsync(Factures); client.SelectSoldeFactureAsync(SessionObject.LePosteCourant.NOMPOSTE); } catch (Exception ex) { throw ex; } }