コード例 #1
0
        private void btnprint_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                List <int> lstCentre = new List <int>();
                List <int> lst       = new List <int>();
                if (this.txt_libellecentre.Tag != null)
                {
                    //lstCentre.AddRange(((List<ServiceAccueil.CsCentre>)this.txt_libellecentre.Tag).Select(p => p.PK_ID).ToList());
                    lstCentre.AddRange(((List <int>) this.txt_libellecentre.Tag).ToList());
                }
                else
                {
                    lstCentre.AddRange(LstCentrePerimetre.Select(u => u.PK_ID).ToList());
                }

                DateTime?dateDebut = string.IsNullOrEmpty(this.dtp_debut.Text) ? null : this.dtp_debut.SelectedDate;
                DateTime?dateFin   = string.IsNullOrEmpty(this.dtp_fin.Text) ? null : this.dtp_fin.SelectedDate;
                int      Nombre    = int.Parse(this.txtParametre.Text);

                RecouvrementServiceClient proxy = new RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement"));
                proxy.ListeDesChequesImpayesCompleted += (senders, results) =>
                {
                    if (results.Cancelled || results.Error != null)
                    {
                        Message.Show("errror occurs while calling remote method", "Recouvrement");
                        return;
                    }

                    if (results.Result == null || results.Result.Count == 0)
                    {
                        Message.Show("Aucune donnée trouvée", "Recouvrement");
                        return;
                    }

                    List <ServiceRecouvrement.CsDetailCampagne> dataTable = new List <ServiceRecouvrement.CsDetailCampagne>();
                    dataTable.AddRange(results.Result);

                    lvwResultat.ItemsSource = null;
                    lvwResultat.ItemsSource = dataTable;
                };
                proxy.ListeDesChequesImpayesAsync(lstCentre, dateDebut, dateFin, Nombre);
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                Message.Show(ex.Message, "Recouvrement");
                return;
            }
        }