Example #1
0
        private void RetourneConsoNull(Dictionary <string, List <int> > lstSiteCentre, string Periode)
        {
            Galatee.Silverlight.ServiceReport.ReportServiceClient service1 = new Galatee.Silverlight.ServiceReport.ReportServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Report"));
            service1.ReturneConsNullCompleted += (sr, res) =>
            {
                if (res != null && res.Cancelled)
                {
                    return;
                }

                if (res.Result != null && res.Result.Count != 0)
                {
                    string Rdlc = string.Empty;
                    Rdlc = "ConsoNull";
                    List <ServiceReport.CsEvenement> LstSourceDonnee = res.Result;
                    if (this.Chk_Recap.IsChecked == true)
                    {
                        Rdlc = "ConsoNullRecap";
                        var lstConsoNullDistinct             = LstSourceDonnee.Select(k => new { k.CENTRE, k.PRODUIT }).Distinct();
                        List <ServiceReport.CsEvenement> lst = new List <ServiceReport.CsEvenement>();
                        foreach (var item in lstConsoNullDistinct)
                        {
                            ServiceReport.CsEvenement l = new ServiceReport.CsEvenement();
                            l.CENTRE          = item.CENTRE;
                            l.PRODUIT         = item.PRODUIT;
                            l.NOMBRECLIENTLOT = LstSourceDonnee.Where(i => i.CENTRE == item.CENTRE && i.PRODUIT == item.PRODUIT).ToList().Count();
                            lst.Add(l);
                        }
                        LstSourceDonnee = lst;
                    }
                    if (OptionImpression == SessionObject.EnvoiPrinter)
                    {
                        Utility.ActionDirectOrientation <ServicePrintings.CsEvenement, ServiceReport.CsEvenement>(LstSourceDonnee, param, SessionObject.CheminImpression, Rdlc, "Report", true);
                    }
                    else if (OptionImpression == SessionObject.EnvoiExecl)
                    {
                        Utility.ActionExportation <ServicePrintings.CsEvenement, ServiceReport.CsEvenement>(LstSourceDonnee, param, string.Empty, SessionObject.CheminImpression, Rdlc, "Report", true, "xlsx");
                    }

                    else if (OptionImpression == SessionObject.EnvoiWord)
                    {
                        Utility.ActionExportation <ServicePrintings.CsEvenement, ServiceReport.CsEvenement>(LstSourceDonnee, param, string.Empty, SessionObject.CheminImpression, Rdlc, "Report", true, "doc");
                    }

                    else if (OptionImpression == SessionObject.EnvoiPdf)
                    {
                        Utility.ActionExportation <ServicePrintings.CsEvenement, ServiceReport.CsEvenement>(LstSourceDonnee, param, string.Empty, SessionObject.CheminImpression, Rdlc, "Report", true, "pdf");
                    }
                }
                else
                {
                    Message.ShowInformation("Aucune information trouvée", "Report");
                    return;
                }
            };
            service1.ReturneConsNullAsync(lstSiteCentre, Periode);
            service1.CloseAsync();
        }