private void   OKButton_Click(object sender, RoutedEventArgs e)
        {
            string IdCoupure = string.Empty;

            try
            {
                CsAvisCoupureEdition avisCoupure = new CsAvisCoupureEdition();
                bntPrinting.IsEnabled = false;
                aCampagne      Campagne = new aCampagne();
                aDisconnection dis      = new aDisconnection();

                avisCoupure.Matricule            = UserConnecte.matricule;
                avisCoupure.AgentPia             = UserConnecte.matricule;
                avisCoupure.referenceClientDebut = string.IsNullOrEmpty(this.Txt_Client.Text) ? string.Empty : this.Txt_Client.Text;
                avisCoupure.OrdreTourneDebut     = string.IsNullOrEmpty(this.Txt_Ordre.Text) ? string.Empty : this.Txt_Ordre.Text;
                string DueDate = (string.IsNullOrEmpty(this.dtpDate.Text)) ? null : dtpDate.Text;
                if (this.Cbo_Regcli.Tag != null)
                {
                    avisCoupure.ListeRegroupement = (List <ServiceRecouvrement.CsRegCli>) this.Cbo_Regcli.Tag;
                }

                avisCoupure.MontantRelancable = string.IsNullOrEmpty(this.Txt_MontantExigible.Text) ? 0 : Convert.ToDecimal(this.Txt_MontantExigible.Text);
                avisCoupure.Exigible          = this.dtpDate.SelectedDate;
                if (this.Txt_LibelleCentre.Tag != null)
                {
                    List <CsCentre> lstCentreCampage = new List <CsCentre>();
                    List <string>   lstCodeCentre    = (List <string>) this.Txt_LibelleCentre.Tag;
                    foreach (var item in lstCodeCentre)
                    {
                        lstCentreCampage.Add(new CsCentre {
                            CODE = item
                        });
                    }
                    avisCoupure.Centre_Campagne = lstCentreCampage;
                }
                if (string.IsNullOrEmpty(avisCoupure.MatriculeDebut) && !string.IsNullOrEmpty(avisCoupure.MatriculeFin))
                {
                    Message.ShowInformation("Entrez la première référence !", Galatee.Silverlight.Resources.Langue.errorTitle);
                    return;
                }
                if (!string.IsNullOrEmpty(avisCoupure.MatriculeDebut) && string.IsNullOrEmpty(avisCoupure.MatriculeFin))
                {
                    Message.ShowInformation("Entrez la deuxième référence!", Galatee.Silverlight.Resources.Langue.errorTitle);
                    return;
                }
                if (this.chk_ParAbonnement.IsChecked == true)
                {
                    avisCoupure.IsParAbonnement = true;
                }
                else
                {
                    avisCoupure.IsParAbonnement = false;
                }

                if (chk_ResilierExclus.IsChecked == true)
                {
                    avisCoupure.ClientResilie = true;
                }
                else
                {
                    avisCoupure.ClientResilie = false;
                }

                if (!string.IsNullOrEmpty(this.Txt_DateDebut.Text) && ClasseMEthodeGenerique.IsFormatPeriodeValide(this.Txt_DateDebut.Text))
                {
                    avisCoupure.PeriodeDebut = ClasseMEthodeGenerique.FormatPeriodeAAAAMM(this.Txt_DateDebut.Text);
                }


                if (!string.IsNullOrEmpty(this.Txt_DateFin.Text) && ClasseMEthodeGenerique.IsFormatPeriodeValide(this.Txt_DateFin.Text))
                {
                    avisCoupure.PeriodeFin = ClasseMEthodeGenerique.FormatPeriodeAAAAMM(this.Txt_DateFin.Text);
                }

                ligne.Clear();
                prgBar.Visibility = System.Windows.Visibility.Visible;
                LayoutRoot.Cursor = Cursors.Wait;
                RecouvrementServiceClient proxy = new RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement"));
                proxy.TraitementAvisCoupureGCAsync(avisCoupure, dis, IsPreavis);
                proxy.TraitementAvisCoupureGCCompleted += (ssn, results) =>
                {
                    try
                    {
                        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);
                            bntPrinting.IsEnabled = true;
                            LayoutRoot.Cursor     = Cursors.Arrow;
                            prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                            return;
                        }

                        if (results.Result == null || results.Result.Count == 0)
                        {
                            Message.ShowError("Aucune donnée de campagne retournée!", Galatee.Silverlight.Resources.Langue.errorTitle);
                            bntPrinting.IsEnabled = true;
                            LayoutRoot.Cursor     = Cursors.Arrow;
                            prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                            return;
                        }

                        ligne.Clear();
                        ligne.AddRange(results.Result);
                        ServiceRecouvrement.CsRegCli lereg = ((List <ServiceRecouvrement.CsRegCli>) this.Cbo_Regcli.Tag).First();
                        string key = Utility.getKey();
                        Dictionary <string, string> param = new Dictionary <string, string>();
                        if (param.Count != 0)
                        {
                            param.Clear();
                        }
                        if (this.chk_ParAbonnement.IsChecked == true)
                        {
                            if (IsPreavis)
                            {
                                param.Add("PpChefService", leParam != null && !string.IsNullOrEmpty(leParam.NOMCHEFSERVICE) ? leParam.NOMCHEFSERVICE : string.Empty);
                                Utility.ActionExportation <ServicePrintings.CsLclient, ServiceRecouvrement.CsLclient>(ligne, param, string.Empty, SessionObject.CheminImpression, "PreavisDeCoupurParAbon", "Recouvrement", true, "doc");
                            }
                            else
                            {
                                param.Add("PpNomDonneurOrdre", leParam != null && !string.IsNullOrEmpty(leParam.NOMCHEFSERVICE)? leParam.NOMCHEFSERVICE : string.Empty);
                                param.Add("PpTitreDonneurOrdre", leParam != null && !string.IsNullOrEmpty(leParam.TITRE_DONNEURORDRE)? leParam.TITRE_DONNEURORDRE:string.Empty);
                                param.Add("PpContactDonneurOrdre", leParam != null && !string.IsNullOrEmpty(leParam.CONTACT_DONNEURORDRE)? leParam.CONTACT_DONNEURORDRE :string.Empty);
                                param.Add("PpStructureExecution", leParam != null && !string.IsNullOrEmpty(leParam.STRUCTURE_EXECUTION)? leParam.STRUCTURE_EXECUTION :string.Empty);
                                param.Add("PpNomAgentExecution", leParam != null && !string.IsNullOrEmpty(leParam.AGENT_EXECUTION)? leParam.AGENT_EXECUTION :string.Empty);
                                param.Add("PpMatriculeAgent", leParam != null && !string.IsNullOrEmpty(leParam.MATRICULE_EXECUTION) ? leParam.MATRICULE_EXECUTION : string.Empty);

                                Utility.ActionExportation <ServicePrintings.CsLclient, ServiceRecouvrement.CsLclient>(ligne, param, string.Empty, SessionObject.CheminImpression, "OrdreDeCoupurParAbon", "Recouvrement", true, "doc");
                            }
                        }
                        else
                        {
                            if (IsPreavis)
                            {
                                param.Add("PpChefService", leParam != null && !string.IsNullOrEmpty(leParam.NOMCHEFSERVICE) ? leParam.NOMCHEFSERVICE : string.Empty);
                                Utility.ActionExportation <ServicePrintings.CsLclient, ServiceRecouvrement.CsLclient>(ligne, param, string.Empty, SessionObject.CheminImpression, "PreavisDeCoupur", "Recouvrement", true, "doc");
                            }
                            else
                            {
                                param.Add("PpNomDonneurOrdre", leParam != null && !string.IsNullOrEmpty(leParam.NOMCHEFSERVICE) ? leParam.NOMCHEFSERVICE : string.Empty);
                                param.Add("PpTitreDonneurOrdre", leParam != null && !string.IsNullOrEmpty(leParam.TITRE_DONNEURORDRE) ? leParam.TITRE_DONNEURORDRE : string.Empty);
                                param.Add("PpContactDonneurOrdre", leParam != null && !string.IsNullOrEmpty(leParam.CONTACT_DONNEURORDRE) ? leParam.CONTACT_DONNEURORDRE : string.Empty);
                                param.Add("PpStructureExecution", leParam != null && !string.IsNullOrEmpty(leParam.STRUCTURE_EXECUTION) ? leParam.STRUCTURE_EXECUTION : string.Empty);
                                param.Add("PpNomAgentExecution", leParam != null && !string.IsNullOrEmpty(leParam.AGENT_EXECUTION) ? leParam.AGENT_EXECUTION : string.Empty);
                                param.Add("PpMatriculeAgent", leParam != null && !string.IsNullOrEmpty(leParam.MATRICULE_EXECUTION) ? leParam.MATRICULE_EXECUTION : string.Empty);

                                Utility.ActionExportation <ServicePrintings.CsLclient, ServiceRecouvrement.CsLclient>(ligne, param, string.Empty, SessionObject.CheminImpression, "OrdreDeCoupur", "Recouvrement", true, "doc");
                            }
                        }


                        LayoutRoot.Cursor     = Cursors.Arrow;
                        prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                        bntPrinting.IsEnabled = true;
                    }
                    catch (Exception ex)
                    {
                        prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                        LayoutRoot.Cursor     = Cursors.Arrow;
                        bntPrinting.IsEnabled = true;
                        Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
                    }
                };
            }
            catch (Exception ex)
            {
                bntPrinting.IsEnabled = true;
                prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                LayoutRoot.Cursor     = Cursors.Arrow;
                Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
            }
        }
        private void   OKButton_Click(object sender, RoutedEventArgs e)
        {
            string IdCoupure = string.Empty;

            try
            {
                CsAvisCoupureEdition avisCoupure = new CsAvisCoupureEdition();
                bntPrinting.IsEnabled = false;
                aCampagne      Campagne = new aCampagne();
                aDisconnection dis      = new aDisconnection();

                avisCoupure.ClientResilie = this.Chk_ExclusResil.IsChecked;
                avisCoupure.Matricule     = UserConnecte.matricule;
                avisCoupure.AgentPia      = UserConnecte.matricule;
                string DueDate = (string.IsNullOrEmpty(this.dtpDate.Text)) ? null : dtpDate.Text;
                if (this.Cbo_Regcli.Tag != null)
                {
                    avisCoupure.ListeRegroupement = (List <ServiceRecouvrement.CsRegCli>) this.Cbo_Regcli.Tag;
                }

                avisCoupure.Exigible = this.dtpDate.SelectedDate;

                if (this.Rdb_facturePeriode.IsChecked == true)
                {
                    if (string.IsNullOrEmpty(this.Txt_MontantPeriode.Text))
                    {
                        Message.ShowWarning("Remplisez le montant èxigible de la période", "Avis de coupure");
                        LayoutRoot.Cursor = Cursors.Arrow;

                        return;
                    }
                    if (string.IsNullOrEmpty(this.Txt_Periode.Text))
                    {
                        Message.ShowWarning("Remplisez la période èxigible", "Avis de coupure");
                        return;
                    }
                    avisCoupure.Periode     = this.Txt_Periode.Text;
                    avisCoupure.SoldeClient = string.IsNullOrEmpty(this.Txt_MontantPeriode.Text) ? 0 : int.Parse(this.Txt_MontantPeriode.Text);
                }
                else if (this.Rdb_MontantGlobal.IsChecked == true)
                {
                    if (string.IsNullOrEmpty(this.Txt_MontantGlobal.Text))
                    {
                        Message.ShowWarning("Remplisez le montant èxigible", "Avis de coupure");
                        return;
                    }
                    avisCoupure.SoldeClient = System.Convert.ToDecimal(string.IsNullOrEmpty(this.Txt_MontantGlobal.Text) ? "0" : this.Txt_MontantGlobal.Text);
                }
                else if (this.Rdb_NombreFactureMontant.IsChecked == true)
                {
                    if (string.IsNullOrEmpty(this.Txt_MontantFacture.Text))
                    {
                        Message.ShowWarning("Remplisez le montant èxigible", "Avis de coupure");
                        return;
                    }
                    if (string.IsNullOrEmpty(this.Txt_NombreFactureMontant.Text))
                    {
                        Message.ShowWarning("Remplisez le nombre de facture èxigible", "Avis de coupure");
                        return;
                    }
                    avisCoupure.MontantPeriode = string.IsNullOrEmpty(this.Txt_MontantFacture.Text) ? 0 : System.Convert.ToDecimal(this.Txt_MontantFacture.Text);
                    avisCoupure.TotalClient    = string.IsNullOrEmpty(this.Txt_NombreFactureMontant.Text) ? 0 : int.Parse(this.Txt_NombreFactureMontant.Text);
                }
                if (string.IsNullOrEmpty(avisCoupure.MatriculeDebut) && !string.IsNullOrEmpty(avisCoupure.MatriculeFin))
                {
                    Message.ShowInformation("Entrez la première référence !", Galatee.Silverlight.Resources.Langue.errorTitle);
                    return;
                }
                if (!string.IsNullOrEmpty(avisCoupure.MatriculeDebut) && string.IsNullOrEmpty(avisCoupure.MatriculeFin))
                {
                    Message.ShowInformation("Entrez la deuxième référence!", Galatee.Silverlight.Resources.Langue.errorTitle);
                    return;
                }

                bool IsListe = false;
                ligne.Clear();
                if (this.rdbtnList.IsChecked == true)
                {
                    IsListe = true;
                }
                else
                {
                    IsListe = false;
                }
                prgBar.Visibility = System.Windows.Visibility.Visible;
                LayoutRoot.Cursor = Cursors.Wait;
                RecouvrementServiceClient proxy = new RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement"));
                proxy.TraitementAvisCoupureGCAsync(avisCoupure, dis, IsListe);
                proxy.TraitementAvisCoupureGCCompleted += (ssn, results) =>
                {
                    try
                    {
                        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);
                            bntPrinting.IsEnabled = true;
                            LayoutRoot.Cursor     = Cursors.Arrow;
                            prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                            return;
                        }

                        if (results.Result == null || results.Result.Count == 0)
                        {
                            Message.ShowError("Aucune donnée de campagne retournée!", Galatee.Silverlight.Resources.Langue.errorTitle);
                            bntPrinting.IsEnabled = true;
                            LayoutRoot.Cursor     = Cursors.Arrow;
                            prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                            return;
                        }

                        ligne.Clear();
                        ligne.AddRange(results.Result);
                        ServiceRecouvrement.CsRegCli lereg = ((List <ServiceRecouvrement.CsRegCli>) this.Cbo_Regcli.Tag).First();
                        Dictionary <string, string>  param = new Dictionary <string, string>();
                        string key = Utility.getKey();
                        if (IsListe == false)
                        {
                            Utility.Action <ServicePrintings.aDisconnection, ServiceRecouvrement.aDisconnection>(ligne, key, null, SessionObject.CheminImpression, "AvisDeCoupureDetailSGC", "Recouvrement");
                        }
                        else
                        {
                            Utility.Action <ServicePrintings.aDisconnection, ServiceRecouvrement.aDisconnection>(ligne, key, null, SessionObject.CheminImpression, "AvisDeCoupureListeSGC", "Recouvrement");
                        }

                        LayoutRoot.Cursor     = Cursors.Arrow;
                        prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                        bntPrinting.IsEnabled = true;
                    }
                    catch (Exception ex)
                    {
                        prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                        LayoutRoot.Cursor     = Cursors.Arrow;
                        bntPrinting.IsEnabled = true;
                        Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
                    }
                };
            }
            catch (Exception ex)
            {
                bntPrinting.IsEnabled = true;
                prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                LayoutRoot.Cursor     = Cursors.Arrow;
                Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
            }
        }
        private void   OKButton_Click(object sender, RoutedEventArgs e)
        {
            string IdCoupure = string.Empty;

            try
            {
                CsAvisCoupureEdition avisCoupure = new CsAvisCoupureEdition();
                bntPrinting.IsEnabled = false;
                aCampagne      Campagne = new aCampagne();
                aDisconnection dis      = new aDisconnection();

                avisCoupure.ClientGroupe  = this.Chk_ExclutRegr.IsChecked;
                avisCoupure.ClientResilie = this.Chk_ExclusResil.IsChecked;
                avisCoupure.Matricule     = UserConnecte.matricule;
                string DueDate = (string.IsNullOrEmpty(this.dtpDate.Text)) ? null : dtpDate.Text;

                avisCoupure.Exigible = this.dtpDate.SelectedDate;
                avisCoupure.idCentre = (this.Txt_Centre.Tag == null ? 0 : (int)this.Txt_Centre.Tag);
                avisCoupure.Centre   = (this.Txt_Centre.Tag == null ? string.Empty : this.Txt_Centre.Text);
                avisCoupure.Site     = this.Txt_Site.Text;

                if (this.Rdb_facturePeriode.IsChecked == true)
                {
                    if (string.IsNullOrEmpty(this.Txt_MontantPeriode.Text))
                    {
                        Message.ShowWarning("Remplisez le montant èxigible de la période", "Avis de coupure");
                        LayoutRoot.Cursor          = Cursors.Arrow;
                        this.bntPrinting.IsEnabled = true;
                        return;
                    }
                    if (string.IsNullOrEmpty(this.Txt_Periode.Text))
                    {
                        Message.ShowWarning("Remplisez la période èxigible", "Avis de coupure");
                        this.bntPrinting.IsEnabled = true;
                        return;
                    }
                    avisCoupure.Periode      = this.Txt_Periode.Text;
                    avisCoupure.SoldeMinimum = string.IsNullOrEmpty(this.Txt_MontantPeriode.Text) ? 0 : int.Parse(this.Txt_MontantPeriode.Text);
                }
                else if (this.Rdb_MontantGlobal.IsChecked == true)
                {
                    if (string.IsNullOrEmpty(this.Txt_MontantGlobal.Text))
                    {
                        Message.ShowWarning("Remplisez le montant èxigible", "Avis de coupure");
                        return;
                    }
                    avisCoupure.SoldeMinimum = System.Convert.ToDecimal(string.IsNullOrEmpty(this.Txt_MontantGlobal.Text) ? "0" : this.Txt_MontantGlobal.Text);
                }
                else if (this.Rdb_NombreFactureMontant.IsChecked == true)
                {
                    if (string.IsNullOrEmpty(this.Txt_MontantFacture.Text))
                    {
                        Message.ShowWarning("Remplisez le montant èxigible", "Avis de coupure");
                        return;
                    }
                    if (string.IsNullOrEmpty(this.Txt_NombreFactureMontant.Text))
                    {
                        Message.ShowWarning("Remplisez le nombre de facture èxigible", "Avis de coupure");
                        return;
                    }
                    avisCoupure.SoldeMinimum             = string.IsNullOrEmpty(this.Txt_MontantFacture.Text) ? 0 : System.Convert.ToDecimal(this.Txt_MontantFacture.Text);
                    avisCoupure.NombreFactureTotalClient = string.IsNullOrEmpty(this.Txt_NombreFactureMontant.Text) ? 0 : int.Parse(this.Txt_NombreFactureMontant.Text);
                }
                avisCoupure.NombreTotalDeClient = TryToParse(txtnbreSubscr.Text);
                avisCoupure.AgentPia            = Txt_AgentRecourvrement.Text;
                avisCoupure.NomAgentPia         = Txt_LibelleAgentRecouvrement.Text;
                if (string.IsNullOrEmpty(avisCoupure.MatriculeDebut) && !string.IsNullOrEmpty(avisCoupure.MatriculeFin))
                {
                    Message.ShowInformation("Entrez la première référence !", Galatee.Silverlight.Resources.Langue.errorTitle);
                    return;
                }
                if (!string.IsNullOrEmpty(avisCoupure.MatriculeDebut) && string.IsNullOrEmpty(avisCoupure.MatriculeFin))
                {
                    Message.ShowInformation("Entrez la deuxième référence!", Galatee.Silverlight.Resources.Langue.errorTitle);
                    return;
                }

                Campagne.FirstRouteNumber = avisCoupure.MatriculeDebut;
                Campagne.LastRouteNumber  = avisCoupure.MatriculeFin;
                avisCoupure.Categories    = new List <int>();
                avisCoupure.Tournees      = new List <int>();
                avisCoupure.Consomateur   = new List <int>();
                if (this.txt_CodeCategorie.Tag != null)
                {
                    avisCoupure.CategorieDebut = ((List <ServiceAccueil.CParametre>) this.txt_CodeCategorie.Tag).First().CODE;
                    avisCoupure.CategorieFin   = ((List <ServiceAccueil.CParametre>) this.txt_CodeCategorie.Tag).Last().CODE;
                    foreach (Galatee.Silverlight.ServiceAccueil.CParametre item in (List <Galatee.Silverlight.ServiceAccueil.CParametre>) this.txt_CodeCategorie.Tag)
                    {
                        avisCoupure.Categories.Add(item.PK_ID);
                    }
                }
                if (this.txt_codetourne.Tag != null)
                {
                    avisCoupure.TourneeDebut = ((List <ServiceAccueil.CParametre>) this.txt_codetourne.Tag).First().CODE;
                    avisCoupure.TourneeFin   = ((List <ServiceAccueil.CParametre>) this.txt_codetourne.Tag).Last().CODE;
                    foreach (ServiceAccueil.CParametre item in (List <ServiceAccueil.CParametre>) this.txt_codetourne.Tag)
                    {
                        avisCoupure.Tournees.Add(item.PK_ID);
                    }
                }
                if (this.txt_CodeConsomateur.Tag != null)
                {
                    foreach (Galatee.Silverlight.ServiceAccueil.CParametre item in (List <Galatee.Silverlight.ServiceAccueil.CParametre>) this.txt_CodeConsomateur.Tag)
                    {
                        avisCoupure.Consomateur.Add(item.PK_ID);
                    }
                }
                bool IsListe = false;
                ligne.Clear();
                if (this.rdbtnList.IsChecked == true)
                {
                    IsListe = true;
                }
                else
                {
                    IsListe = false;
                }
                prgBar.Visibility = System.Windows.Visibility.Visible;
                RecouvrementServiceClient proxy = new RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement"));
                proxy.TraitementAvisCoupureAsync(avisCoupure, dis, IsListe);
                proxy.TraitementAvisCoupureCompleted += (ssn, results) =>
                {
                    try
                    {
                        if (results.Cancelled || results.Error != null)
                        {
                            string error = results.Error.Message;
                            Message.ShowError("Erreur d'invocation du service. !", Galatee.Silverlight.Resources.Langue.errorTitle);
                            bntPrinting.IsEnabled = true;
                            prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                            return;
                        }

                        if (results.Result == null || results.Result.Count == 0)
                        {
                            Message.ShowError("Aucune donnée de campagne retournée!", Galatee.Silverlight.Resources.Langue.errorTitle);
                            bntPrinting.IsEnabled = true;
                            prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                            return;
                        }

                        ligne.Clear();
                        ligne.AddRange(results.Result);

                        Dictionary <string, string> param = new Dictionary <string, string>();
                        param.Add("pfirstzone", ((List <ServiceAccueil.CParametre>) this.txt_codetourne.Tag).First().CODE);
                        param.Add("plastzone", ((List <ServiceAccueil.CParametre>) this.txt_codetourne.Tag).Last().CODE);
                        param.Add("pminiAmount", avisCoupure.MontantPeriode.ToString());
                        param.Add("pduedate", avisCoupure.Exigible.Value.ToShortDateString());
                        param.Add("pnombreCustomer", avisCoupure.NombreTotalDeClient.ToString());
                        //param.Add("pcampainNumber", results.Result.First().i);
                        param.Add("pperioddue", avisCoupure.Periode);
                        param.Add("pnumberbill", avisCoupure.NombreFactureTotalClient.ToString());
                        param.Add("pfirstroute", avisCoupure.MatriculeDebut);
                        param.Add("plastroute", avisCoupure.MatriculeFin);
                        param.Add("pfirstcategorie", ((List <Galatee.Silverlight.ServiceAccueil.CParametre>) this.txt_CodeCategorie.Tag).First().CODE);
                        param.Add("plastcategorie", ((List <Galatee.Silverlight.ServiceAccueil.CParametre>) this.txt_CodeCategorie.Tag).Last().CODE);
                        param.Add("pnamecontroller", avisCoupure.NomAgentPia);
                        string key = Utility.getKey();

                        if (IsListe == false)
                        {
                            Utility.ActionDirectOrientation <ServicePrintings.CsAvisDeCoupureClient, ServiceRecouvrement.CsAvisDeCoupureClient>(ligne, null, SessionObject.CheminImpression, "AvisDeCoupureDetail", "Recouvrement", true);
                        }
                        else
                        {
                            Utility.ActionDirectOrientation <ServicePrintings.CsAvisDeCoupureClient, ServiceRecouvrement.CsAvisDeCoupureClient>(ligne, param, SessionObject.CheminImpression, "AvisDeCoupureListe", "Recouvrement", true);
                        }

                        prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                        bntPrinting.IsEnabled = true;
                    }
                    catch (Exception ex)
                    {
                        prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                        bntPrinting.IsEnabled = true;
                        Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
                    }
                };
            }
            catch (Exception ex)
            {
                bntPrinting.IsEnabled = true;
                prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
            }
        }