コード例 #1
0
        public List <ServiceReport.CsReglement> GetPrintObjects(string module)
        {
            try
            {
                string MatriculeCollector = (string.IsNullOrEmpty(CmbCollector.SelectedValue.ToString())) ? null : ((CsReglement)listeDeReglement.ElementAt(CmbCollector.SelectedIndex)).MATRICULE.ToString();
                string Date = (string.IsNullOrEmpty(CmbDatePayment.SelectedValue.ToString())) ? null : ((CsReglement)listeDeDates.ElementAt(CmbDatePayment.SelectedIndex)).DATEENCAISSEMENT.Value.ToShortDateString();



                int loaderHandler           = LoadingManager.BeginLoading("Please Wait for pass payment ... ");
                ReportServiceClient service = new ReportServiceClient(Utility.Protocole(), Utility.EndPoint(module));

                List <ServiceReport.CsReglement> reportPrint = new List <CsReglement>();


                service.ManualDailyPaymentAsync(MatriculeCollector, Date, null, null);
                service.SelectionDateParAgentCompleted += (er, res) =>
                {
                    try
                    {
                        if (res.Error != null || res.Cancelled)
                        {
                            LoadingManager.EndLoading(loaderHandler);
                            throw new Exception("Cannot display report");
                        }
                        if (res.Result != null)
                        {
                            reportPrint = res.Result;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        LoadingManager.EndLoading(loaderHandler);
                    }
                };

                return(reportPrint);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }