Example #1
0
        public List <ServiceReport.CsConnexion> GetPrintObjects(string module)
        {
            try
            {
                //if (Txt_Year.Text.Length != 4)
                //{
                //    return null;
                //}
                //else
                //{
                //IdProd =int.Parse(Cmb_Produit.SelectedValue.ToString());
                ReportServiceClient service = new ReportServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint(module));
                //string mois = (Cmb_month.SelectedIndex < 0) ? null : (Cmb_month.SelectedIndex + 1).ToString("00");
                List <ServiceReport.CsConnexion> reportPrint = new List <CsConnexion>();

                int loaderHandler = LoadingManager.BeginLoading("Please Wait for pass payment ... ");
                service.GetNewBranchementsByProduitAsync(Txt_Year.Text, IdProd, Etat);
                service.GetNewBranchementsByProduitCompleted += (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.OrderBy(c => c.Mois).ToList();

                            Dictionary <string, string> dico = new Dictionary <string, string>();
                            dico.Add("annee", Txt_Year.Text);
                            //Effectue l'aperçcu avant imprèssion
                            //Utility.ActionPreview<ServicePrintings.CsConnexion, Galatee.Silverlight.ServiceReport.CsConnexion>(reportPrint, dico, DefinedRDLC, module);
                            Utility.ActionDirectOrientation <ServicePrintings.CsConnexion, Galatee.Silverlight.ServiceReport.CsConnexion>(reportPrint, dico, SessionObject.DefaultPrinter, "VisuReportNewElectricityServiceConnection", module, false);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        LoadingManager.EndLoading(loaderHandler);
                    }
                };

                //this.DefinedRDLC = "ConnexionsElectricite";
                return(reportPrint);
                //}
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }