private void ChargerMauvaisPayeur(List <int> lstIdCentre, DateTime?Datedebut, DateTime?Datefin) { try { prgBar.Visibility = System.Windows.Visibility.Visible; RecouvrementServiceClient proxy = new RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement")); proxy.ListeDesMoratoiresEmisAsync(lstIdCentre, Datedebut, Datefin, true); proxy.ListeDesMoratoiresEmisCompleted += (ssn, results) => { try { this.btn_Rechercher.IsEnabled = true; prgBar.Visibility = System.Windows.Visibility.Collapsed; if (results.Cancelled || results.Error != null) { string error = results.Error.Message; Message.ShowError("Erreur d'invocation du service. Réessayer svp !", Galatee.Silverlight.Resources.Langue.errorTitle); return; } if (results.Result == null || results.Result.Count == 0) { Message.ShowError("Aucune donnée retournée!", Galatee.Silverlight.Resources.Langue.errorTitle); return; } dataTable = Shared.ClasseMEthodeGenerique.RetourneListCopy <CsDetailMoratoire>(results.Result); List <CsDetailMoratoire> lstMoratoir = dataTable; if (this.Rdb_Echu.IsChecked == true) { lstMoratoir = lstMoratoir.Where(t => t.EXIGIBILITE.Value.Date < System.DateTime.Today.Date).ToList(); } foreach (var item in lstMoratoir) { item.REFERENCE = item.CENTRE + " " + item.CLIENT + " " + item.ORDRE; item.NATURE = (item.EXIGIBILITE.Value.Date < System.DateTime.Today.Date) ? "ECHU" : string.Empty; CsDetailMoratoire le = new CsDetailMoratoire(); le = item; if (lstSource.FirstOrDefault(t => t.REFERENCE == le.REFERENCE) != null) { le.REFERENCE = string.Empty; le.NOMABON = string.Empty; } lstSource.Add(le); } lvwResultat.ItemsSource = null; lvwResultat.ItemsSource = lstSource; } catch (Exception ex) { this.btn_Rechercher.IsEnabled = true; Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle); } }; } catch (Exception ex) { throw ex; } }