private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.Txt_LibelleSite.Tag == null)
            {
                Message.Show("Sélectionnez le site", "Information");
                return;
            }
            prgBar.Visibility = System.Windows.Visibility.Visible;

            List <int> LsIdCentre = new List <int>();

            if (this.Txt_LibelleCentre.Tag != null)
            {
                LsIdCentre = (List <int>) this.Txt_LibelleCentre.Tag;
            }
            else
            {
                LsIdCentre = LstCentrePerimetre.Where(t => t.FK_IDCODESITE == (int)this.Txt_LibelleSite.Tag).Select(i => i.PK_ID).ToList();
            }

            if (leEtatExecuter == SessionObject.TauxRecouvrement)
            {
                TauxRecouvrement(LsIdCentre);
            }
            else if (leEtatExecuter == SessionObject.TauxEncaissement)
            {
                TauxEncaissement(LsIdCentre);
            }
        }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            List <int> lstCentre = new List <int>();
            DateTime   dateDebut = System.DateTime.Today;
            DateTime   dateFin   = dateDebut.AddYears(3);
            string     Produit   = string.Empty;

            List <int> TypeReclamation = new List <int>();

            if (LeEtatExecuter == SessionObject.ReclamationListe)
            {
                TypeReclamation = Txt_LibelleTypeDemande.Tag != null ? (List <int>)Txt_LibelleTypeDemande.Tag : SessionObject.ListeDesReclamation.Select(c => c.PK_ID).ToList();
            }
            List <int> lstCategorie = new List <int>();
            List <int> lstTournee   = new List <int>();

            if (this.Txt_LibelleCentre.Tag != null)
            {
                int centre;
                if (int.TryParse(this.Txt_LibelleCentre.Tag.ToString(), out centre) != true)
                {
                    lstCentre.AddRange((List <int>) this.Txt_LibelleCentre.Tag);
                }
                else
                {
                    lstCentre.Add(centre);
                }
            }
            else
            {
                lstCentre.AddRange(LstCentrePerimetre.Where(o => o.CODESITE == this.btn_Site.Tag.ToString()).Select(y => y.PK_ID).ToList());
            }

            dateDebut = string.IsNullOrEmpty(this.dtp_DateDebut.Text) ? dateDebut : Convert.ToDateTime(this.dtp_DateDebut.Text);
            dateFin   = string.IsNullOrEmpty(this.dtp_DateFin.Text) ? dateFin : Convert.ToDateTime(this.dtp_DateFin.Text);
            if (LeEtatExecuter == SessionObject.StatReclamation)
            {
                StatistiqueReclamation(lstCentre, dateDebut, dateFin);
            }
            if (LeEtatExecuter == SessionObject.ReclamationAgent)
            {
                ReclamationParAgent(lstCentre, dateDebut, dateFin);
            }
            if (LeEtatExecuter == SessionObject.ReclamationListe)
            {
                ListeDesReclamation(lstCentre, TypeReclamation, dateDebut, dateFin);
            }
            if (LeEtatExecuter == SessionObject.TauxReclamation)
            {
                TauxDetraitement(lstCentre, dateDebut, dateFin);
            }
        }
        private void ChargeDetailDEvis(int IdDemandeDevis)
        {
            ServiceAccueil.AcceuilServiceClient client = new ServiceAccueil.AcceuilServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Accueil"));
            client.ChargerDetailDemandeCompleted += (ssender, args) =>
            {
                if (args.Cancelled || args.Error != null)
                {
                    LayoutRoot.Cursor = Cursors.Arrow;
                    string error = args.Error.Message;
                    Message.ShowError(error, this.Title.ToString());
                    return;
                }
                if (args.Result == null)
                {
                    LayoutRoot.Cursor = Cursors.Arrow;
                    Message.ShowError(Silverlight.Resources.Devis.Languages.AucunesDonneesTrouvees, this.Title.ToString());
                    return;
                }
                else
                {
                    laDetailDemande          = new ServiceAccueil.CsDemande();
                    laDetailDemande          = args.Result;
                    this.Txt_CodeSite.Text   = laDetailDemande.LaDemande.NUMDEM.Substring(3, 3);
                    this.Txt_CodeCentre.Text = laDetailDemande.LaDemande.CENTRE;
                    this.txtClient.Text      = laDetailDemande.LaDemande.CLIENT;
                    this.txtOrdre.Text       = laDetailDemande.LaDemande.ORDRE;
                    this.txtNom.Text         = laDetailDemande.LeClient.NOMABON;

                    this.Txt_CodeSite.Tag   = LstCentrePerimetre.First(r => r.PK_ID == laDetailDemande.LaDemande.FK_IDCENTRE).FK_IDCODESITE;
                    this.Txt_CodeCentre.Tag = laDetailDemande.LaDemande.FK_IDCENTRE;


                    this.TxtDemande.Text      = laDetailDemande.LaDemande.NUMDEM;
                    this.txtMotifDemande.Text = laDetailDemande.LaDemande.MOTIF;

                    if (laDetailDemande.AnnotationDemande != null && laDetailDemande.AnnotationDemande.Count > 0)
                    {
                        this.txtMotifRejet.Text       = laDetailDemande.AnnotationDemande.First().COMMENTAIRE;
                        this.txtMotifRejet.Visibility = System.Windows.Visibility.Visible;
                        this.labMotifRejet.Visibility = System.Windows.Visibility.Visible;
                    }

                    RecherCherFacture();
                }
            };
            client.ChargerDetailDemandeAsync(IdDemandeDevis, string.Empty);
        }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            //this.DialogResult = true;
            if (this.btn_Site.Tag == null)
            {
                Message.ShowInformation("Selectionnez le site", "Reporting");
                return;
            }

            List <int> lstCentre    = new List <int>();
            List <int> lstCategorie = new List <int>();
            List <int> lstTournee   = new List <int>();

            lstTournee   = (List <int>) this.Txt_LibelleTournee.Tag;
            lstCategorie = (List <int>) this.Txt_LibelleCategorie.Tag;
            if (this.Txt_LibelleCentre.Tag != null)
            {
                lstCentre.AddRange((List <int>) this.Txt_LibelleCentre.Tag);
            }
            else
            {
                lstCentre.AddRange(LstCentrePerimetre.Where(o => o.CODESITE == this.btn_Site.Tag.ToString()).Select(y => y.PK_ID).ToList());
            }


            Dictionary <string, List <int> > lesDeCentre = new Dictionary <string, List <int> >();

            lesDeCentre.Add(this.btn_Site.Tag.ToString(), lstCentre);
            bool IsDetail = false;

            if (this.rdb_Detail.IsChecked == true)
            {
                IsDetail = true;
            }
            ImpayerCategorie(lesDeCentre, lstCategorie, lstTournee, IsDetail);
        }