public void RetourneEtatClient(CsClient leClient) { try { this.DialogResult = true; CaisseServiceClient srv = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse")); srv.RetourneEtatClientAsync(leClient.PK_ID); srv.RetourneEtatClientCompleted += (factor, es) => { if (es.Error != null || es.Cancelled) { Message.ShowError("L'insertion des encaissements a retournée une erreur. Réessayer svp! :" + es.Error.Message, "Erreur"); return; } if (es.Result == null) { Message.ShowError("L'insertion des encaissements a retournée une erreur. Réessayer svp!", "Erreur"); return; } decimal? MontantExigible = es.Result.Where(t => t.EXIGIBILITE < System.DateTime.Today.Date).Sum(y => y.MONTANT); decimal? MontantNonExigible = es.Result.Where(t => t.EXIGIBILITE > System.DateTime.Today.Date).Sum(y => y.MONTANT); decimal? Solde = MontantExigible + MontantNonExigible; List <CsLclient> lstFactureDuClient = _ListeDesReglementDuRecu.Where(t => t.FK_IDCLIENT == leClient.PK_ID).ToList(); foreach (CsLclient item in lstFactureDuClient) { item.MONTANTEXIGIBLE = MontantExigible; item.MONTANTNONEXIGIBLE = MontantNonExigible; item.SOLDECLIENT = Solde; } List <CsReglementRecu> _ListeDesRecu = Galatee.Silverlight.Caisse.EditionRecu.ReorganiserReglement(lstFactureDuClient, SessionObject.Enumere.ActionRecuDuplicat); int nbreDeCopie = 2; for (int i = 1; i <= nbreDeCopie; i++) { string key = Utility.getKey(); Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("pTypeRecu", "RECU D'ANNULATION D'ENCAISSEMENT"); LanceImpression(key, param, _ListeDesRecu, false); } }; } catch (Exception) { throw; } }