Ejemplo n.º 1
0
        public void FillSecteurs()
        {
            try
            {
                ReportServiceClient service = new ReportServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Report"));
                //categories = service.SELECT_ALL_CATEGORY_By_NUMTABLE(12); // 12 represente la category
                //ddbSecteur.Items.Clear();
                //foreach (CsTa item in categories)
                //{
                //    string cat = item.PK_CODE.Substring(4, 2);
                //    item.PK_CODE = cat;
                //    ddbSecteur.Items.Add(cat);
                //}

                int    loaderHandler = LoadingManager.BeginLoading("Please Wait for pass payment ... ");
                string key           = Utility.getKey();
                service.SELECT_ALL_TOURNEEAsync();
                service.SELECT_ALL_TOURNEECompleted += (er, res) =>
                {
                    try
                    {
                        if (res.Error != null || res.Cancelled)
                        {
                            LoadingManager.EndLoading(loaderHandler);
                            throw new Exception("Cannot display report");
                        }
                        if (res.Result != null)
                        {
                            //Code en cas de succès
                            foreach (var item in res.Result)
                            {
                                categories.Add(item);
                            }

                            Cmb_categ.ItemsSource = categories;
                            //Cmb_categ.DisplayMemberPath = "LIBELLE";
                            //Cmb_categ.SelectedValuePath = "NUM";
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        LoadingManager.EndLoading(loaderHandler);
                    }
                };
            }
            catch (Exception ex)
            {
                //throw;
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }