Ejemplo n.º 1
0
        void Recherche(string CodeSite, string IdCampagne, int IdPia, DateTime?DateDebut, DateTime?DateFin, string Centre, string Client, string Ordre)
        {
            try
            {
                if (lesClientCampagne.Count != 0)
                {
                    lesClientCampagne.Clear();
                }
                this.lvwResultat.ItemsSource = null;
                prgBar.Visibility            = System.Windows.Visibility.Visible;
                RecouvrementServiceClient client = new RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement"));
                client.RechercheClientCampagneCompleted += (ss, args) =>
                {
                    try
                    {
                        prgBar.Visibility = System.Windows.Visibility.Collapsed;
                        if (args.Cancelled || args.Error != null)
                        {
                            string error = args.Error.Message;
                            Message.ShowError("Erreur à l'exécution du service", "SearchCampagne");
                            return;
                        }

                        if (args.Result == null || args.Result.Count == 0)
                        {
                            Message.ShowInformation("Aucune donnée trouvée", "SearchCampagne");
                            return;
                        }

                        List <CsDetailCampagne> detailcampagnes = new List <CsDetailCampagne>();
                        detailcampagnes = args.Result;
                        detailcampagnes.ForEach(p => p.INDEX = p.INDEXCOMPTEUR);
                        lesClientCampagne.Clear();
                        foreach (CsDetailCampagne item in detailcampagnes)
                        {
                            lesClientCampagne.Add(item);
                        }

                        this.lvwResultat.ItemsSource = null;
                        this.lvwResultat.ItemsSource = lesClientCampagne;
                    }
                    catch (Exception ex)
                    {
                        Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
                    }
                };
                client.RechercheClientCampagneAsync(CodeSite, IdCampagne, IdPia, DateDebut, DateFin, Centre, Client, Ordre, 6);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }