public EtatVersementUI()
        {
            payers = new List <LigneVersement>();
            InitializeComponent();
            caisseBL = new GestionCaisseBL();
            dpiDateFin.IsTodayHighlighted = true;
            dpiDateFin.SelectedDate       = DateTime.Today;
            dpiDateFin.Text                 = DateTime.Now.ToString();
            dpiDateDebut.SelectedDate       = DateTime.Today;
            dpiDateDebut.IsTodayHighlighted = true;
            dpiDateDebut.Text               = DateTime.Now.ToString();

            CultureInfo ci = CultureInfo.CreateSpecificCulture(CultureInfo.CurrentCulture.Name);

            ci.DateTimeFormat.ShortDatePattern  = "yyyy-MM-dd";
            Thread.CurrentThread.CurrentCulture = ci;

            entree = 0;
            payers = caisseBL.listerSuivantCriterePayers_versement("datepaiement = " + "'" + DateTime.Today.Date.ToShortDateString() + "'");

            changementMotif();

            foreach (LigneVersement l in payers)
            {
                l.nom    = caisseBL.obtenirNomEleve(l.matricule);
                l.classe = caisseBL.obtenirClasse(l.matricule);
            }

            grdEtatCaisse.ItemsSource = payers;
            grdEtatCaisse.Items.Refresh();
            txtTotalEntree.IsEnabled = false;
        }
        /**
         * fonction qui recupere les conditions pour alimenter la datagrid
         */
        private void chargerDataGrid()
        {
            CultureInfo ci = CultureInfo.CreateSpecificCulture(CultureInfo.CurrentCulture.Name);

            ci.DateTimeFormat.ShortDatePattern  = "yyyy-MM-dd";
            Thread.CurrentThread.CurrentCulture = ci;
            CultureInfo elGR = CultureInfo.CreateSpecificCulture("el-GR");

            string datefin   = DateTime.Today.Date.ToShortDateString();
            string datedebut = DateTime.Today.Date.ToShortDateString();

            if (dpiDateFin.SelectedDate != null)
            {
                datefin = dpiDateFin.SelectedDate.Value.Date.ToShortDateString();
            }
            if (dpiDateDebut.SelectedDate != null)
            {
                datedebut = dpiDateDebut.SelectedDate.Value.Date.ToShortDateString();
            }
            OperationBE operation = new OperationBE();

            entree = 0;

            if (datefin.CompareTo(datedebut) >= 0)
            {
                payers = new List <LigneVersement>();
                payers = caisseBL.listerSuivantCriterePayers_versement("datepaiement between " + "'" + datedebut + "' AND " + "'" + datefin + "'");

                //calcul du montant des entrees et des sorties
                if (payers != null)
                {
                    foreach (LigneVersement p in payers)
                    {
                        entree += (decimal)p.montant;
                    }
                }

                string motif = txtMotif.Text;

                foreach (LigneVersement l in payers)
                {
                    l.nom = caisseBL.obtenirNomEleve(l.matricule);
                    try
                    {
                        l.classe = caisseBL.obtenirClasse(l.matricule);
                    }
                    catch (Exception)
                    {
                        l.classe = " - ";
                    }
                }
                grdEtatCaisse.ItemsSource = payers;
                grdEtatCaisse.Items.Refresh();

                txtTotalEntree.Text = entree.ToString("0,0", elGR);
            }
            else
            {
                MessageBox.Show("La date de debut doit être plus petite ou égale à la date de fin");
                payers = new List <LigneVersement>();
                grdEtatCaisse.ItemsSource = payers;
                grdEtatCaisse.Items.Refresh();
            }
        }