private void MiseAJoureMoratoire(List <CsDetailMoratoire> lstDetailMoratoire, List <CsDetailMoratoire> lstMoratoirePayer)
        {
            try
            {
                List <CsDetailMoratoire> lstNonRegle = new List <CsDetailMoratoire>();
                if (lstMoratoirePayer != null && lstMoratoirePayer.Count != 0)
                {
                    lstNonRegle = lstDetailMoratoire.Where(p => !lstMoratoirePayer.Any(o => o.NDOC == p.NDOC && o.REFEM == p.REFEM)).ToList();
                }
                else
                {
                    lstNonRegle = lstDetailMoratoire;
                }

                RecouvrementServiceClient clients = new RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement"));
                clients.MiseAJourMoratoireAsync(int.Parse(idmoratoireselected));
                clients.MiseAJourMoratoireCompleted += (send, res) =>
                {
                    try
                    {
                        if (res.Cancelled || res.Error != null)
                        {
                            Message.ShowError("Erreur survenue lors de l'appel serveur.", "Erreur");
                            CleanIHM();
                            return;
                        }

                        if (res.Result == null)
                        {
                            Message.ShowError("Erreur survenue lors de la suppression du moratoire.Réessayer svp!", Galatee.Silverlight.Resources.Langue.errorTitle);
                            CleanIHM();
                            return;
                        }
                        List <CsDetailMoratoire> lstDistinctFactureDuMoratoire = lstNonRegle.Where(t => t.IDMORATOIRE == int.Parse(idmoratoireselected)).ToList();
                        nombreEchaeance = (lstDistinctFactureDuMoratoire.Count() - 1).ToString();
                        amountselected  = (lstDistinctFactureDuMoratoire.Where(o => !string.IsNullOrEmpty(o.CRET)).Sum(o => o.MONTANT)).Value.ToString(SessionObject.FormatMontant);

                        Dictionary <string, string> param = new Dictionary <string, string>();
                        param.Add("pCentre", centre);
                        param.Add("pClient", client);
                        param.Add("pOrdre", ordre);
                        param.Add("pNombreEcheance", nombreEchaeance);
                        param.Add("pMontantGlobal", amountselected);
                        param.Add("pName", txtClientName.Text);
                        param.Add("pNombreFacture", lstDistinctFactureDuMoratoire.First().REFERENCE.ToString());
                        param.Add("pReferencefacture", lstDistinctFactureDuMoratoire.First().REFEMNDOC.ToString());
                        param.Add("pOperationMor", "ANNULATION MORATOIRE");

                        foreach (CsDetailMoratoire item in lstDistinctFactureDuMoratoire)
                        {
                            if (item.EXIGIBILITE != null)
                            {
                                item.DC = System.DateTime.Today.Date.ToShortDateString();
                            }
                        }
                        param.Add("pExigibilite", System.DateTime.Today.Date.ToShortDateString());
                        Utility.ActionDirectOrientation <ServicePrintings.CsLclient, ServiceRecouvrement.CsLclient>(RetourneCsLclientFromCsMoratoire(lstDistinctFactureDuMoratoire), param, SessionObject.CheminImpression, "moratoire", "Recouvrement", true);
                        CleanIHM();
                    }
                    catch (Exception ex)
                    {
                        Message.ShowError(ex, "Erreur");
                    }
                };
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }