コード例 #1
0
        void Recherche(CsCAMPAGNE laCampagneSelect)
        {
            try
            {
                prgBar.Visibility = System.Windows.Visibility.Visible;

                List <CsCAMPAGNE> lesCampagne = new List <CsCAMPAGNE>();
                lesCampagne.Add(laCampagneSelect);
                RecouvrementServiceClient client = new RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement"));
                client.ListeDesClientAResilierAsync(lesCampagne);
                client.ListeDesClientAResilierCompleted += (ss, args) =>
                {
                    try
                    {
                        this.btnsearch.IsEnabled = true;
                        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;
                        foreach (CsDetailCampagne item in detailcampagnes)
                        {
                            lesClientCampagne.Add(item);
                        }

                        this.lvwResultat.ItemsSource   = null;
                        this.lvwResultat.ItemsSource   = lesClientCampagne;
                        this.lvwResultat.SelectedIndex = 0;

                        OKButton.Visibility = System.Windows.Visibility.Visible;
                    }
                    catch (Exception ex)
                    {
                        this.btnsearch.IsEnabled = true;

                        Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
                    }
                };
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }