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

                int loaderHandler = LoadingManager.BeginLoading("Please Wait for pass payment ... ");
                //List<CsSales> reportPrint=new List<CsSales>();
                List <ServiceReport.CsCprofac> listprofac = new List <ServiceReport.CsCprofac>();

                ReportServiceClient service = new ReportServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint((module)));
                string key = Utility.getKey();
                service.QUANTITY_SOLD_BY_CATEGAsync(Txt_year.Text, _Coper, key, this.Parameters);
                service.QUANTITY_SOLD_BY_CATEGCompleted += (er, res) =>
                {
                    try
                    {
                        if (res.Error != null || res.Cancelled)
                        {
                            LoadingManager.EndLoading(loaderHandler);
                            Message.ShowInformation("Erreur survenue lors de l'appel service", "ERROR");
                            return;
                        }
                        if (res.Result == null)
                        {
                            LoadingManager.EndLoading(loaderHandler);
                            Message.ShowInformation("Impossible d'afficher le rapport", "ERROR");
                            return;
                        }
                        ////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.CsSales>(null, "QuantitySoldByCategory", module, key);
                        //Utility.ActionPreview<ServicePrintings.CsSales, Galatee.Silverlight.ServiceReport.CsSales>(reportPrint, param, "QuantitySoldByCategory", module);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        LoadingManager.EndLoading(loaderHandler);
                    }
                };
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        public List <CsSales> GetPrintObjects(string module)
        {
            try
            {
                if (Txt_Year.Text.Length != 4)
                {
                    return(null);
                }
                else
                {
                    string coper        = "001"; // FactureGeneralCoper
                    string libelleCoper = "";


                    if (facturerationMois.IsChecked == true)
                    {
                        coper        = "001"; // FactureGeneralCoper
                        libelleCoper = "Monthly billing";
                    }
                    else if (factureration_Manuelle_Resiliation.IsChecked == true)
                    {
                        coper        = "002"; // FactureManuelleCoper
                        libelleCoper = "Manual and termination billing";
                    }
                    else if (Tous.IsChecked == true)
                    {
                        coper        = null;
                        libelleCoper = "All the billing";
                    }

                    //if (parameters.Count > 0)
                    //    parameters.Clear();
                    //parameters.Add("pCoper", libelleCoper);

                    int loaderHandler = LoadingManager.BeginLoading("Please Wait for pass payment ... ");


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

                    List <CsSales> reportPrint = new List <CsSales>();

                    service.QUANTITY_SOLD_BY_CATEGAsync(Txt_Year.Text, coper, null, null);
                    service.QUANTITY_SOLD_BY_CATEGCompleted += (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();
                                this.Parameters = new Dictionary <string, string>();
                                this.Parameters.Add("pCoper", libelleCoper);
                                //this.DefinedRDLC = reportName;
                                //Effectue l'aperçcu avant imprèssion
                                //Utility.ActionPreview<ServicePrintings.CsSales, Galatee.Silverlight.ServiceReport.CsSales>(reportPrint, param, "", module);
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                        finally
                        {
                            LoadingManager.EndLoading(loaderHandler);
                        }
                    };



                    //this.DefinedRDLC = "test";



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