コード例 #1
0
        public List <CsCprofac> GetPrintObjects(string module)
        {
            try
            {
                //this.Parameters = new Dictionary<string, string>();
                //this.Parameters.Add("pCoper", _LibelleCoper);

                int loaderHandler = LoadingManager.BeginLoading("Patienter ... ");


                string mois = (Cmb_month.SelectedIndex <= 0) ? null : Cmb_month.SelectedIndex.ToString("00");
                //string categ = (Cmb_cat.SelectedValue == null) ? null : Cmb_cat.SelectedValue.ToString();
                string categ = (Cmb_cat.SelectedIndex < 0) ? null : categories[Cmb_cat.SelectedIndex].CODE;
                //List<ServiceReport.CsCprofac> listprofac = new List<ServiceReport.CsCprofac>();

                ReportServiceClient service = new ReportServiceClient(Utility.Protocole(), Utility.EndPoint(module));

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

                service.SPX_CPROFAC_SEL_ELEC_CONSOAsync(Txt_year.Text, mois, categ, _Coper);
                service.SPX_CPROFAC_SEL_ELEC_CONSOCompleted += (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
                            reportPrint = res.Result;
                            //Dictionary<string, string> param = new Dictionary<string, string>();
                            Dictionary <string, string> param = null;
                            string key = Utility.getKey();

                            //Effectue l'aperçcu avant imprèssion
                            Utility.ActionPreview <ServicePrintings.CsCprofac, Galatee.Silverlight.ServiceReport.CsCprofac>(reportPrint, param, "CurrentPaymentsDetails", module);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        LoadingManager.EndLoading(loaderHandler);
                    }
                };



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