Example #1
0
        private void RetourneCompteurPeriode(Dictionary <string, List <int> > lesDeCentre, string Periode, bool IsStat)
        {
            prgBar.Visibility = System.Windows.Visibility.Visible;

            Galatee.Silverlight.ServiceReport.ReportServiceClient service1 = new Galatee.Silverlight.ServiceReport.ReportServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Report"));
            service1.ReturneCompteurParProduitPeriodeCompleted += (sr, res) =>
            {
                prgBar.Visibility = System.Windows.Visibility.Collapsed;

                if (res != null && res.Cancelled)
                {
                    return;
                }

                if (res.Result != null && res.Result.Count != 0)
                {
                    string Rdlc = "CompteurParProduitPeriode";
                    if (IsStat)
                    {
                        Rdlc = "CompteurParProduitPeriodeStat";
                    }

                    if (OptionImpression == SessionObject.EnvoiPrinter)
                    {
                        Utility.ActionDirectOrientation <ServicePrintings.CsEvenement, ServiceReport.CsEvenement>(res.Result, null, SessionObject.CheminImpression, Rdlc, "Report", true);
                    }
                    else if (OptionImpression == SessionObject.EnvoiExecl)
                    {
                        Utility.ActionExportation <ServicePrintings.CsEvenement, ServiceReport.CsEvenement>(res.Result, null, string.Empty, SessionObject.CheminImpression, Rdlc, "Report", true, "xlsx");
                    }

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

                    else if (OptionImpression == SessionObject.EnvoiPdf)
                    {
                        Utility.ActionExportation <ServicePrintings.CsEvenement, ServiceReport.CsEvenement>(res.Result, null, string.Empty, SessionObject.CheminImpression, Rdlc, "Report", true, "pdf");
                    }
                }
                else
                {
                    Message.ShowInformation("Aucune information trouvée", "Report");
                    return;
                }
            };
            service1.ReturneCompteurParProduitPeriodeAsync(lesDeCentre, Periode, IsStat);
            service1.CloseAsync();
        }
Example #2
0
        private void RechercherDonnee()
        {
            string key = Utility.getKey();

            if (leEtatExecuter == SessionObject.RecapComptaFacturation)
            {
                retourneFacture(true);
            }
            else if (leEtatExecuter == SessionObject.ComptaFacturation)
            {
                retourneFacture(false);
            }
            else if (leEtatExecuter == SessionObject.Statfacturation)
            {
                bool EstBT  = false;
                bool IsStat = this.Chk_Categorie.IsChecked == true ? true : false;
                if (lProduit.CODE == SessionObject.Enumere.Electricite)
                {
                    EstBT = true;
                }
                Galatee.Silverlight.ServiceReport.ReportServiceClient service = new Galatee.Silverlight.ServiceReport.ReportServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Report"));
                service.ReturneStatistiqueCompleted += (s, args) =>
                {
                    prgBar.Visibility = System.Windows.Visibility.Collapsed;

                    if (args != null && args.Cancelled)
                    {
                        return;
                    }

                    if (param != null && param.Count() != 0)
                    {
                        param.Clear();
                    }
                    param.Add("pPeriode", this.txt_Periode.Text);
                    param.Add("pAgence", this.Txt_LibelleSite.Text);
                    string Rdlc = string.Empty;

                    List <ServiceReport.CsStatFact> lstStatfact = args.Result;
                    if (!EstBT)
                    {
                        if (leEtatExecuter == SessionObject.Statfacturation)
                        {
                            Rdlc = this.Chk_Categorie.IsChecked == false ? "RecapStatFacturationMt" : "RecapStatFacturationMtStat";
                        }
                    }
                    else
                    {
                        if (leEtatExecuter == SessionObject.Statfacturation)
                        {
                            Rdlc = this.Chk_Categorie.IsChecked == false ? "RecapStatFacturationBtFac" : "RecapStatFacturationBtStat";
                        }
                    }

                    if (OptionImpression == SessionObject.EnvoiPrinter)
                    {
                        Utility.ActionDirectOrientation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result, param, SessionObject.CheminImpression, Rdlc, "Report", true);
                    }
                    else if (OptionImpression == SessionObject.EnvoiExecl)
                    {
                        Utility.ActionExportation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result, param, string.Empty, SessionObject.CheminImpression, Rdlc, "Report", true, "xlsx");
                    }

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

                    else if (OptionImpression == SessionObject.EnvoiPdf)
                    {
                        Utility.ActionExportation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result, param, string.Empty, SessionObject.CheminImpression, Rdlc, "Report", true, "pdf");
                    }
                };
                //service.ReturneStatistiqueAsync(lSiteSelect.CODE, Shared.ClasseMEthodeGenerique.FormatPeriodeAAAAMM(this.txt_Periode.Text), lProduit.CODE, IsStat);
                service.CloseAsync();
            }
            else if (leEtatExecuter == SessionObject.StatVenteCummuler)
            {
                bool IsStat = this.Chk_Categorie.IsChecked == true ? true : false;
                prgBar.Visibility = System.Windows.Visibility.Collapsed;

                List <int> lstCentre = LstCentrePerimetre.Where(p => p.FK_IDCODESITE == (int)this.Txt_LibelleSite.Tag).Select(l => l.PK_ID).ToList();
                if (param != null && param.Count() != 0)
                {
                    param.Clear();
                }
                //param.Add("pAgence", this.Txt_LibelleSite.Text );
                Galatee.Silverlight.ServiceReport.ReportServiceClient service = new Galatee.Silverlight.ServiceReport.ReportServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Report"));
                service.ReturneVenteCummuleCompleted += (s, args) =>
                {
                    prgBar.Visibility = System.Windows.Visibility.Collapsed;

                    if (args != null && args.Cancelled)
                    {
                        return;
                    }
                    string Rdlc = string.Empty;

                    Rdlc = this.Chk_Categorie.IsChecked == true ? "VenteCummul" : "VenteCummulCategorie";
                    if (OptionImpression == SessionObject.EnvoiPrinter)
                    {
                        Utility.ActionDirectOrientation <ServicePrintings.CsRedevanceFacture, ServiceReport.CsRedevanceFacture>(args.Result, param, SessionObject.CheminImpression, Rdlc, "Report", true);
                    }
                    else if (OptionImpression == SessionObject.EnvoiExecl)
                    {
                        Utility.ActionExportation <ServicePrintings.CsRedevanceFacture, ServiceReport.CsRedevanceFacture>(args.Result, param, string.Empty, SessionObject.CheminImpression, Rdlc + "Xls", "Report", true, "xlsx");
                    }

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

                    else if (OptionImpression == SessionObject.EnvoiPdf)
                    {
                        Utility.ActionExportation <ServicePrintings.CsRedevanceFacture, ServiceReport.CsRedevanceFacture>(args.Result, param, string.Empty, SessionObject.CheminImpression, Rdlc, "Report", true, "pdf");
                    }
                };
                service.ReturneVenteCummuleAsync(lstCentre, Shared.ClasseMEthodeGenerique.FormatPeriodeAAAAMM(this.txt_Periode.Text), IsStat);
                service.CloseAsync();
            }
            else if (leEtatExecuter == SessionObject.CompteurFacturePeriode)
            {
                bool IsStat = this.Chk_Categorie.IsChecked == true ? true : false;
                Dictionary <string, List <int> > lesDeCentre = new Dictionary <string, List <int> >();
                if (this.Txt_LibelleSite.Tag == null)
                {
                    Message.ShowInformation("Selectionner le site ", "Message");
                    return;
                }
                lesDeCentre.Add(lSiteSelect.CODE, LstCentrePerimetre.Where(i => i.CODESITE == lSiteSelect.CODE).Select(p => p.PK_ID).ToList());
                RetourneCompteurPeriode(lesDeCentre, Shared.ClasseMEthodeGenerique.FormatPeriodeAAAAMM(this.txt_Periode.Text), IsStat);
            }
            else if (leEtatExecuter == SessionObject.EncaissementCumule)
            {
                RetourneEncaissemntMoisComptat(LstCentrePerimetre.Where(i => i.CODESITE == lSiteSelect.CODE).Select(p => p.PK_ID).ToList(), Shared.ClasseMEthodeGenerique.FormatPeriodeAAAAMM(this.txt_Periode.Text));
            }
        }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            string key = Utility.getKey();
            Dictionary <string, string> param = new Dictionary <string, string>();

            prgBar.Visibility = System.Windows.Visibility.Visible;

            if (leEtatExecuter == SessionObject.RecapComptaFacturation)
            {
                retourneFacture(true);
            }
            else if (leEtatExecuter == SessionObject.ComptaFacturation)
            {
                retourneFacture(false);
            }
            else if (leEtatExecuter == SessionObject.Statfacturation ||
                     leEtatExecuter == SessionObject.StatfacturationStat)
            {
                bool EstBT = false;
                if (lProduit.CODE == SessionObject.Enumere.Electricite)
                {
                    EstBT = true;
                }
                Galatee.Silverlight.ServiceReport.ReportServiceClient service = new Galatee.Silverlight.ServiceReport.ReportServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Report"));
                service.ReturneStatistiqueCompleted += (s, args) =>
                {
                    prgBar.Visibility = System.Windows.Visibility.Collapsed;

                    if (args != null && args.Cancelled)
                    {
                        return;
                    }

                    List <ServiceReport.CsStatFact> lstStatfact = args.Result;
                    if (!EstBT)
                    {
                        param.Add("pPeriode", this.txt_Periode.Text);
                        if (chk_Exporter.IsChecked == true)
                        {
                            Utility.ActionExportation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result, param, SessionObject.CheminImpression, "RecapStatFacturationMtStat", "Report", true, "xlsx");
                        }
                        else
                        {
                            Utility.ActionDirectOrientation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(lstStatfact, param, SessionObject.CheminImpression, "RecapStatFacturationMtStat", "Report", false);
                        }
                    }
                    else
                    {
                        if (chk_Exporter.IsChecked == true)
                        {
                            Utility.ActionExportation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result, param, SessionObject.CheminImpression, "RecapStatFacturationBt", "Report", true, "xlsx");
                        }
                        else
                        {
                            Utility.ActionDirectOrientation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(lstStatfact, param, SessionObject.CheminImpression, "RecapStatFacturationBt", "Report", false);
                        }
                    }
                };
                service.ReturneStatistiqueAsync(lSiteSelect.CODE, Shared.ClasseMEthodeGenerique.FormatPeriodeAAAAMM(this.txt_Periode.Text), lProduit.CODE);
                service.CloseAsync();
            }
            //else if (leEtatExecuter == SessionObject.StatfacturationStat)
            //{
            //    bool EstBT = false;
            //    if (lProduit.CODE == SessionObject.Enumere.Electricite) EstBT = true;
            //    Galatee.Silverlight.ServiceReport.ReportServiceClient service = new Galatee.Silverlight.ServiceReport.ReportServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Report"));
            //    service.ReturneStatiqueDesVenteStatCompleted += (s, args) =>
            //    {
            //        prgBar.Visibility = System.Windows.Visibility.Collapsed;

            //        if (args != null && args.Cancelled)
            //            return;

            //        param.Add("pPeriode", this.txt_Periode.Text);
            //        param.Add("pAgence", this.Txt_LibelleSite.Text);

            //        List<ServiceReport.CsStatFact> lstStatfact = args.Result;
            //        if (!EstBT)
            //        {
            //            if (chk_Exporter.IsChecked == true)
            //                Utility.ActionExportation<ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result, param, SessionObject.CheminImpression, "RecapStatFacturationMtStat", "Report", true, "xlsx");
            //            else
            //                Utility.ActionDirectOrientation<ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(lstStatfact, param, SessionObject.CheminImpression, "RecapStatFacturationMtStat", "Report", false);
            //        }
            //        else
            //        {
            //            if (chk_Exporter.IsChecked == true)
            //                Utility.ActionExportation<ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result, param, SessionObject.CheminImpression, "RecapStatFacturationBtStat", "Report", true, "xlsx");
            //            else
            //                Utility.ActionDirectOrientation<ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(lstStatfact, param, SessionObject.CheminImpression, "RecapStatFacturationBtStat", "Report", false);
            //        }
            //    };
            //    service.ReturneStatiqueDesVenteStatAsync(LstCentrePerimetre.Where(t => t.FK_IDCODESITE == lSiteSelect.PK_ID).Select(o => o.PK_ID).ToList(), Shared.ClasseMEthodeGenerique.FormatPeriodeAAAAMM(this.txt_Periode.Text), lProduit.CODE);
            //    service.CloseAsync();
            //}
            else if (leEtatExecuter == SessionObject.StatVenteCummuler)
            {
                bool EstBT = false;
                if (lProduit.CODE == SessionObject.Enumere.Electricite)
                {
                    EstBT = true;
                }
                Galatee.Silverlight.ServiceReport.ReportServiceClient service = new Galatee.Silverlight.ServiceReport.ReportServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Report"));
                service.ReturneVenteCummuleCompleted += (s, args) =>
                {
                    prgBar.Visibility = System.Windows.Visibility.Collapsed;

                    if (args != null && args.Cancelled)
                    {
                        return;
                    }

                    List <ServiceReport.CsRedevanceFacture> lstStatfact = args.Result;
                    if (!EstBT)
                    {
                        if (chk_Exporter.IsChecked == true)
                        {
                            Utility.ActionExportation <ServicePrintings.CsRedevanceFacture, ServiceReport.CsRedevanceFacture>(args.Result, param, SessionObject.CheminImpression, "RecapStatFacturationMtStat", "Report", true, "xlsx");
                        }
                        else
                        {
                            Utility.ActionDirectOrientation <ServicePrintings.CsRedevanceFacture, ServiceReport.CsRedevanceFacture>(args.Result, param, SessionObject.CheminImpression, "RecapStatFacturationMtStat", "Report", false);
                        }
                    }
                    else
                    {
                        if (chk_Exporter.IsChecked == true)
                        {
                            Utility.ActionExportation <ServicePrintings.CsRedevanceFacture, ServiceReport.CsRedevanceFacture>(args.Result, param, SessionObject.CheminImpression, "VenteCummul", "Report", true, "xlsx");
                        }
                        else
                        {
                            Utility.ActionDirectOrientation <ServicePrintings.CsRedevanceFacture, ServiceReport.CsRedevanceFacture>(args.Result, param, SessionObject.CheminImpression, "VenteCummul", "Report", false);
                        }
                    }
                };
                service.ReturneVenteCummuleAsync(lSiteSelect.CODE, Shared.ClasseMEthodeGenerique.FormatPeriodeAAAAMM(this.txt_Periode.Text), lProduit.CODE);
                service.CloseAsync();
            }
        }
        private void RechercherDonnee()
        {
            lesDeCentre.Add(lSiteSelect.PK_ID);


            string key = Utility.getKey();

            if (leEtatExecuter == SessionObject.RecapComptaFacturation)
            {
                retourneFacture(true);
            }
            else if (leEtatExecuter == SessionObject.ComptaFacturation)
            {
                retourneFacture(false);
            }
            else if (leEtatExecuter == SessionObject.Statfacturation)
            {
                prgBar.Visibility = System.Windows.Visibility.Visible;

                if (string.IsNullOrEmpty(this.txt_Periode.Text))
                {
                    Message.ShowWarning("Veuillez saisir la période", "Vente");
                    return;
                }

                int idSite = 0;
                if (this.cbo_Site.SelectedItem != null)
                {
                    idSite = ((ServiceAccueil.CsSite) this.cbo_Site.SelectedItem).PK_ID;
                }

                int idCentre = 0;
                if (this.cbo_Centre.SelectedItem != null)
                {
                    idCentre = ((ServiceAccueil.CsCentre) this.cbo_Centre.SelectedItem).PK_ID;
                }

                int idSecteur = 0;
                //if (this.cbo_Secteur.SelectedItem != null)
                //    idSecteur = ((ServiceAccueil.CsSecteur)this.cbo_Secteur.SelectedItem).PK_ID;

                int idProduit = 0;
                //if (this.cbo_Produit.SelectedItem != null)
                //    idProduit = ((ServiceAccueil.CsProduit)this.cbo_Produit.SelectedItem).PK_ID;

                int idCategorie = 0;
                if (this.cbo_Catégorie.SelectedItem != null)
                {
                    idCategorie = ((ServiceAccueil.CsCategorieClient) this.cbo_Catégorie.SelectedItem).PK_ID;
                }

                Galatee.Silverlight.ServiceReport.ReportServiceClient service = new Galatee.Silverlight.ServiceReport.ReportServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Report"));
                service.ReturneStatistiqueCompleted += (s, args) =>
                {
                    prgBar.Visibility = System.Windows.Visibility.Collapsed;

                    if (args != null && args.Cancelled)
                    {
                        Message.ShowInformation("Problème d'accès aux données", "Report");
                        return;
                    }

                    if (args.Result == null || args.Result.Count == 0)
                    {
                        Message.ShowInformation("Aucune information trouvée", "Report");
                        return;
                    }


                    if (param != null && param.Count() != 0)
                    {
                        param.Clear();
                    }

                    if (this.ckbAnnee.IsChecked.Value)
                    {
                        param.Add("pPeriode", this.txt_Periode.Text.Substring(3, 4));
                    }
                    else
                    {
                        param.Add("pPeriode", this.txt_Periode.Text);
                    }
                    param.Add("pAgence", this.cbo_Site.ItemsSource.ToString());
                    string Rdlc = string.Empty;

                    List <ServiceReport.CsStatFact> lstStatfact = args.Result;


                    if (OptionImpression == SessionObject.EnvoiPrinter)
                    {
                        if (args.Result.Where(a => a.CONSOMATIONREACTIVE == 1) != null && args.Result.Where(a => a.CONSOMATIONREACTIVE == 1).ToList().Count > 0)
                        {
                            Utility.ActionDirectOrientation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result.Where(a => a.CONSOMATIONREACTIVE == 1).ToList(), param, SessionObject.CheminImpression, "RecapStatFacturation", "Report", true);
                        }
                        if (args.Result.Where(a => a.CONSOMATIONREACTIVE == 2) != null && args.Result.Where(a => a.CONSOMATIONREACTIVE == 2).ToList().Count > 0)
                        {
                            Utility.ActionDirectOrientation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result.Where(a => a.CONSOMATIONREACTIVE == 2).ToList(), param, SessionObject.CheminImpression, "RecapStatDemande", "Report", true);
                        }
                    }
                    else if (OptionImpression == SessionObject.EnvoiExecl)
                    {
                        if (args.Result.Where(a => a.CONSOMATIONREACTIVE == 1) != null && args.Result.Where(a => a.CONSOMATIONREACTIVE == 1).ToList().Count > 0)
                        {
                            Utility.ActionExportation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result.Where(a => a.CONSOMATIONREACTIVE == 1).ToList(), param, string.Empty, SessionObject.CheminImpression, "RecapStatFacturation", "Report", true, "xlsx");
                        }
                        if (args.Result.Where(a => a.CONSOMATIONREACTIVE == 2) != null && args.Result.Where(a => a.CONSOMATIONREACTIVE == 2).ToList().Count > 0)
                        {
                            Utility.ActionExportation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result.Where(a => a.CONSOMATIONREACTIVE == 2).ToList(), param, string.Empty, SessionObject.CheminImpression, "RecapStatDemande", "Report", true, "xlsx");
                        }
                    }

                    else if (OptionImpression == SessionObject.EnvoiWord)
                    {
                        if (args.Result.Where(a => a.CONSOMATIONREACTIVE == 1) != null && args.Result.Where(a => a.CONSOMATIONREACTIVE == 1).ToList().Count > 0)
                        {
                            Utility.ActionExportation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result.Where(a => a.CONSOMATIONREACTIVE == 1).ToList(), param, string.Empty, SessionObject.CheminImpression, "RecapStatFacturation", "Report", true, "doc");
                        }
                        if (args.Result.Where(a => a.CONSOMATIONREACTIVE == 2) != null && args.Result.Where(a => a.CONSOMATIONREACTIVE == 2).ToList().Count > 0)
                        {
                            Utility.ActionExportation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result.Where(a => a.CONSOMATIONREACTIVE == 2).ToList(), param, string.Empty, SessionObject.CheminImpression, "RecapStatDemande", "Report", true, "doc");
                        }
                    }
                    else if (OptionImpression == SessionObject.EnvoiPdf)
                    {
                        if (args.Result.Where(a => a.CONSOMATIONREACTIVE == 1) != null && args.Result.Where(a => a.CONSOMATIONREACTIVE == 1).ToList().Count > 0)
                        {
                            Utility.ActionExportation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result.Where(a => a.CONSOMATIONREACTIVE == 1).ToList(), param, string.Empty, SessionObject.CheminImpression, "RecapStatFacturation", "Report", true, "pdf");
                        }
                        if (args.Result.Where(a => a.CONSOMATIONREACTIVE == 2) != null && args.Result.Where(a => a.CONSOMATIONREACTIVE == 2).ToList().Count > 0)
                        {
                            Utility.ActionExportation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result.Where(a => a.CONSOMATIONREACTIVE == 2).ToList(), param, string.Empty, SessionObject.CheminImpression, "RecapStatDemande", "Report", true, "pdf");
                        }
                    }
                };
                service.ReturneStatistiqueAsync(idSite, idCentre, idSecteur, idProduit, idCategorie, Shared.ClasseMEthodeGenerique.FormatPeriodeAAAAMM(this.txt_Periode.Text), false, this.ckbAnnee.IsChecked.Value);
                service.CloseAsync();
            }


            else if (leEtatExecuter == SessionObject.StatfacturationIsolee)
            {
                prgBar.Visibility = System.Windows.Visibility.Visible;

                if (string.IsNullOrEmpty(this.txt_Periode.Text))
                {
                    Message.ShowWarning("Veuillez saisir la période", "Vente");
                    return;
                }

                int idSite = 0;
                if (this.cbo_Site.SelectedItem != null)
                {
                    idSite = ((ServiceAccueil.CsSite) this.cbo_Site.SelectedItem).PK_ID;
                }

                int idCentre = 0;
                if (this.cbo_Centre.SelectedItem != null)
                {
                    idCentre = ((ServiceAccueil.CsCentre) this.cbo_Centre.SelectedItem).PK_ID;
                }

                int idSecteur = 0;
                //if (this.cbo_Secteur.SelectedItem != null)
                //    idSecteur = ((ServiceAccueil.CsSecteur)this.cbo_Secteur.SelectedItem).PK_ID;

                int idProduit = 0;
                //if (this.cbo_Produit.SelectedItem != null)
                //    idProduit = ((ServiceAccueil.CsProduit)this.cbo_Produit.SelectedItem).PK_ID;

                int idCategorie = 0;
                if (this.cbo_Catégorie.SelectedItem != null)
                {
                    idCategorie = ((ServiceAccueil.CsCategorieClient) this.cbo_Catégorie.SelectedItem).PK_ID;
                }

                Galatee.Silverlight.ServiceReport.ReportServiceClient service = new Galatee.Silverlight.ServiceReport.ReportServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Report"));
                service.ReturneStatistiqueCompleted += (s, args) =>
                {
                    prgBar.Visibility = System.Windows.Visibility.Collapsed;

                    if (args != null && args.Cancelled)
                    {
                        return;
                    }

                    if (param != null && param.Count() != 0)
                    {
                        param.Clear();
                    }
                    if (this.ckbAnnee.IsChecked.Value)
                    {
                        param.Add("pPeriode", this.txt_Periode.Text.Substring(3, 4));
                    }
                    else
                    {
                        param.Add("pPeriode", this.txt_Periode.Text);
                    }
                    param.Add("pAgence", this.cbo_Site.ItemsSource.ToString());
                    string Rdlc = string.Empty;

                    List <ServiceReport.CsStatFact> lstStatfact = args.Result;

                    Rdlc = "RecapStatFacturationIsolee";


                    if (OptionImpression == SessionObject.EnvoiPrinter)
                    {
                        Utility.ActionDirectOrientation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result, param, SessionObject.CheminImpression, Rdlc, "Report", true);
                    }
                    else if (OptionImpression == SessionObject.EnvoiExecl)
                    {
                        Utility.ActionExportation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result, param, string.Empty, SessionObject.CheminImpression, Rdlc, "Report", true, "xlsx");
                    }

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

                    else if (OptionImpression == SessionObject.EnvoiPdf)
                    {
                        Utility.ActionExportation <ServicePrintings.CsStatFact, ServiceReport.CsStatFact>(args.Result, param, string.Empty, SessionObject.CheminImpression, Rdlc, "Report", true, "pdf");
                    }
                };
                service.ReturneStatistiqueAsync(idSite, idCentre, idSecteur, idProduit, idCategorie, Shared.ClasseMEthodeGenerique.FormatPeriodeAAAAMM(this.txt_Periode.Text), true, this.ckbAnnee.IsChecked.Value);
                service.CloseAsync();
            }


            else if (leEtatExecuter == SessionObject.CompteurFacturePeriode)
            {
                if (this.cbo_Site.ItemsSource != null)
                // lstIdAnomalie = this.Txt_LibelleAnomalie.Tag != null ? (List<int>)this.Txt_LibelleAnomalie.Tag : new List<int>();
                {
                    foreach (ServiceAccueil.CParametre st in this.ListeDesSites)
                    {
                        lesDeSite.Add(st.PK_ID);
                    }
                }

                else
                {
                    Message.ShowWarning("Veuillez sélectionnez le site", "Validation");
                    return;
                }
                // lesDeCentre.Add(lSiteSelect.CODE, LstCentrePerimetre.Where(i => i.CODESITE == lSiteSelect.CODE).Select(p => p.PK_ID).ToList());
                lesDeCentre.Add(lSiteSelect.PK_ID);
            }
            else if (leEtatExecuter == SessionObject.EncaissementCumule)
            {
                RetourneEncaissemntMoisComptat(LstCentrePerimetre.Where(i => i.CODESITE == lSiteSelect.CODE).Select(p => p.PK_ID).ToList(), Shared.ClasseMEthodeGenerique.FormatPeriodeAAAAMM(this.txt_Periode.Text));
            }
        }
        private void RechercherDonnee()
        {
            DateTime DateDebut = System.DateTime.Today;
            DateTime DateFin   = System.DateTime.Today;


            lesDeCentre.Add(lSiteSelect.PK_ID);


            string key = Utility.getKey();

            if (leEtatExecuter == SessionObject.VolumeEncaissement)
            {
                prgBar.Visibility = System.Windows.Visibility.Visible;

                DateDebut = string.IsNullOrEmpty(this.dtpDebut.Text) ? DateDebut : Convert.ToDateTime(this.dtpDebut.Text);
                DateFin   = string.IsNullOrEmpty(this.dtpFin.Text) ? DateFin : Convert.ToDateTime(this.dtpFin.Text);

                int idSite = 0;
                if (this.cbo_Site.SelectedItem != null)
                {
                    idSite = ((ServiceAccueil.CsSite) this.cbo_Site.SelectedItem).PK_ID;
                }

                int idCentre = 0;
                if (this.cbo_Centre.SelectedItem != null)
                {
                    idCentre = ((ServiceAccueil.CsCentre) this.cbo_Centre.SelectedItem).PK_ID;
                }

                int idSecteur = 0;
                //if (this.cbo_Secteur.SelectedItem != null)
                //    idSecteur = ((ServiceAccueil.CsSecteur)this.cbo_Secteur.SelectedItem).PK_ID;

                int idMode = 0;
                if (this.cbo_Mode.SelectedItem != null)
                {
                    idMode = ((ServiceCaisse.CsModereglement) this.cbo_Mode.SelectedItem).PK_ID;
                }

                int idCategorie = 0;
                if (this.cbo_Catégorie.SelectedItem != null)
                {
                    idCategorie = ((ServiceAccueil.CsCategorieClient) this.cbo_Catégorie.SelectedItem).PK_ID;
                }

                Galatee.Silverlight.ServiceReport.ReportServiceClient service = new Galatee.Silverlight.ServiceReport.ReportServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Report"));
                service.VolumeEncaissementCompleted += (s, args) =>
                {
                    prgBar.Visibility = System.Windows.Visibility.Collapsed;

                    if (args != null && args.Cancelled)
                    {
                        Message.ShowInformation("Problème d'accès aux données", "Report");
                        return;
                    }

                    if (args.Result == null || args.Result.Count == 0)
                    {
                        Message.ShowInformation("Aucune information trouvée", "Report");
                        return;
                    }


                    if (param != null && param.Count() != 0)
                    {
                        param.Clear();
                    }

                    param.Add("pPeriode", "");

                    if (idSite == 0)
                    {
                        param.Add("pAgence", "Tous les centres");
                    }
                    else
                    {
                        param.Add("pAgence", lstSite.FirstOrDefault(a => a.PK_ID == idSite).LIBELLE);
                    }


                    List <ServiceReport.CsLclient> lstStatfact = args.Result;


                    if (OptionImpression == SessionObject.EnvoiPrinter)
                    {
                        if (args.Result.Where(a => a.STATUS == "1") != null && args.Result.Where(a => a.STATUS == "1").ToList().Count > 0)
                        {
                            Utility.ActionDirectOrientation <ServicePrintings.CsLclient, ServiceReport.CsLclient>(args.Result.Where(a => a.STATUS == "1").ToList(), param, SessionObject.CheminImpression, "VolumeEncaissements", "Report", true);
                        }
                        if (args.Result.Where(a => a.STATUS == "2") != null && args.Result.Where(a => a.STATUS == "2").ToList().Count > 0)
                        {
                            Utility.ActionDirectOrientation <ServicePrintings.CsLclient, ServiceReport.CsLclient>(args.Result.Where(a => a.STATUS == "2").ToList(), param, SessionObject.CheminImpression, "VolumeEncaissementsDem", "Report", true);
                        }
                    }
                    else if (OptionImpression == SessionObject.EnvoiExecl)
                    {
                        if (args.Result.Where(a => a.STATUS == "1") != null && args.Result.Where(a => a.STATUS == "1").ToList().Count > 0)
                        {
                            Utility.ActionExportation <ServicePrintings.CsLclient, ServiceReport.CsLclient>(args.Result.Where(a => a.STATUS == "1").ToList(), param, string.Empty, SessionObject.CheminImpression, "VolumeEncaissements", "Report", true, "xlsx");
                        }
                        if (args.Result.Where(a => a.STATUS == "2") != null && args.Result.Where(a => a.STATUS == "2").ToList().Count > 0)
                        {
                            Utility.ActionExportation <ServicePrintings.CsLclient, ServiceReport.CsLclient>(args.Result.Where(a => a.STATUS == "2").ToList(), param, string.Empty, SessionObject.CheminImpression, "VolumeEncaissementsDem", "Report", true, "xlsx");
                        }
                    }
                    //Utility.ActionExportation<ServicePrintings.CsLclient, ServiceReport.CsLclient>(args.Result, param, string.Empty, SessionObject.CheminImpression, Rdlc, "Report", true, "xlsx");

                    else if (OptionImpression == SessionObject.EnvoiWord)
                    {
                        if (args.Result.Where(a => a.STATUS == "1") != null && args.Result.Where(a => a.STATUS == "1").ToList().Count > 0)
                        {
                            Utility.ActionExportation <ServicePrintings.CsLclient, ServiceReport.CsLclient>(args.Result.Where(a => a.STATUS == "1").ToList(), param, string.Empty, SessionObject.CheminImpression, "VolumeEncaissements", "Report", true, "doc");
                        }
                        if (args.Result.Where(a => a.STATUS == "2") != null && args.Result.Where(a => a.STATUS == "2").ToList().Count > 0)
                        {
                            Utility.ActionExportation <ServicePrintings.CsLclient, ServiceReport.CsLclient>(args.Result.Where(a => a.STATUS == "2").ToList(), param, string.Empty, SessionObject.CheminImpression, "VolumeEncaissementsDem", "Report", true, "doc");
                        }
                    }
                    else if (OptionImpression == SessionObject.EnvoiPdf)
                    {
                        if (args.Result.Where(a => a.STATUS == "1") != null && args.Result.Where(a => a.STATUS == "1").ToList().Count > 0)
                        {
                            Utility.ActionExportation <ServicePrintings.CsLclient, ServiceReport.CsLclient>(args.Result.Where(a => a.STATUS == "1").ToList(), param, string.Empty, SessionObject.CheminImpression, "VolumeEncaissements", "Report", true, "pdf");
                        }
                        if (args.Result.Where(a => a.STATUS == "2") != null && args.Result.Where(a => a.STATUS == "2").ToList().Count > 0)
                        {
                            Utility.ActionExportation <ServicePrintings.CsLclient, ServiceReport.CsLclient>(args.Result.Where(a => a.STATUS == "2").ToList(), param, string.Empty, SessionObject.CheminImpression, "VolumeEncaissementsDem", "Report", true, "pdf");
                        }
                    }
                };
                service.VolumeEncaissementAsync(idSite, idCentre, idMode, idCategorie, DateDebut, DateFin);
                service.CloseAsync();
            }
        }