private void dgMyDataGrid2_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            DataGrid dg         = (sender as DataGrid);
            var      allObjects = dg.ItemsSource as List <ServiceCaisse.CsLclient>;

            //foreach (var o in allObjects)
            //    o.Selectionner = false;

            if (dg.SelectedItem != null)
            {
                ServiceCaisse.CsLclient SelectedObject = (ServiceCaisse.CsLclient)dg.SelectedItem;
                if (SelectedObject.Selectionner == false)
                {
                    SelectedObject.Selectionner = true;
                    if (SelectedObject.STATUS == SessionObject.Enumere.StatusDemandeValider)
                    {
                        this.btn_Retirer.Visibility = System.Windows.Visibility.Collapsed;
                    }
                    else
                    {
                        this.btn_Retirer.Visibility = System.Windows.Visibility.Visible;
                    }
                }
                else
                {
                    SelectedObject.Selectionner = false;
                }
            }
        }
        private void RemplireDataGrid(List <ServiceCaisse.CsLclient> _LstReglement)
        {
            try
            {
                var _lstfacture = (from p in _LstReglement
                                   group new { p } by new { p.FK_IDHABILITATIONCAISSE, p.NOMCAISSIERE, p.ACQUIT, p.DENR, p.MATRICULE, p.MOTIFANNULATION, p.IsDEMANDEANNULATION, p.CAISSE, p.NUMDEM } into pResult
                                   select new
                {
                    pResult.Key.ACQUIT,
                    pResult.Key.DENR,
                    pResult.Key.MATRICULE,
                    pResult.Key.MOTIFANNULATION,
                    pResult.Key.IsDEMANDEANNULATION,
                    pResult.Key.NOMCAISSIERE,
                    pResult.Key.CAISSE,
                    pResult.Key.FK_IDHABILITATIONCAISSE,
                    pResult.Key.NUMDEM,
                    MONTANT = (decimal?)pResult.Sum(o => o.p.MONTANT)
                }).ToList();

                foreach (var item in _lstfacture)
                {
                    CsUtilisateur leUSer = _ListeDesUtilisateurs.FirstOrDefault(p => p.MATRICULE == item.MATRICULE);

                    ServiceCaisse.CsLclient leReglement = new ServiceCaisse.CsLclient()
                    {
                        //REFFERENCECLIENT = item.REFFERENCECLIENT,
                        ACQUIT = item.ACQUIT,
                        //NOM = item.NOM,
                        DENR                    = item.DENR,
                        NUMDEM                  = item.NUMDEM,
                        MONTANT                 = item.MONTANT,
                        MOTIFANNULATION         = item.MOTIFANNULATION,
                        IsDEMANDEANNULATION     = item.IsDEMANDEANNULATION,
                        MATRICULE               = item.MATRICULE,
                        CAISSE                  = item.CAISSE,
                        FK_IDHABILITATIONCAISSE = item.FK_IDHABILITATIONCAISSE,
                        NOMCAISSIERE            = (leUSer != null) ? (leUSer.LIBELLE + "(" + item.MATRICULE + ")") : item.MATRICULE
                    };
                    ListeDesReglementADupliquer.Add(leReglement);
                }
                dtg_FactureAnnule.ItemsSource = null;
                dtg_FactureAnnule.ItemsSource = ListeDesReglementADupliquer;
            }
            catch (Exception ex)
            {
            }
        }
 private void btn_Ajouter_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         ServiceCaisse.CsLclient leReglementSelect = (ServiceCaisse.CsLclient)dtg_FactureAAnnule.SelectedItem;
         if (leReglementSelect != null)
         {
             FrmMotifAction ctrl = new FrmMotifAction(_LstrefReglement.Where(t => t.ACQUIT == leReglementSelect.ACQUIT).ToList());
             ctrl.Closed += new EventHandler(galatee_OkClickedRaisonAnnulation);
             ctrl.Show();
         }
     }
     catch (Exception ex)
     {
         Message.Show(ex.Message, Langue.LibelleModule);
     }
 }
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     try
     {
         ServiceCaisse.CsLclient leReglementSelect = (ServiceCaisse.CsLclient)dtg_FactureAnnule.SelectedItem;
         if (leReglementSelect != null)
         {
             List <ServiceCaisse.CsLclient>            _lstReglement = ((List <ServiceCaisse.CsLclient>)dtg_FactureAnnule.ItemsSource).Where(r => r.Selectionner == true).ToList();
             Galatee.Silverlight.Caisse.FrmMotifAction ctrl          = new Galatee.Silverlight.Caisse.FrmMotifAction(_lstReglement);
             ctrl.Closed += new EventHandler(galatee_OkClickedRaisonAnnulation);
             ctrl.Show();
         }
     }
     catch (Exception ex)
     {
         Message.ShowError(ex, Langue.errorTitle);
     }
 }
        private void dgMyDataGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            DataGrid dg         = (sender as DataGrid);
            var      allObjects = dg.ItemsSource as List <ServiceCaisse.CsLclient>;

            foreach (var o in allObjects)
            {
                o.Selectionner = false;
            }

            if (dg.SelectedItem != null)
            {
                ServiceCaisse.CsLclient SelectedObject = (ServiceCaisse.CsLclient)dg.SelectedItem;
                //if (SelectedObject.Selectionner == false)
                SelectedObject.Selectionner = true;
                //else
                //    SelectedObject.Selectionner = false;
            }
        }
        private void dgMyDataGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            DataGrid dg         = (sender as DataGrid);
            var      allObjects = dg.ItemsSource as List <ServiceCaisse.CsLclient>;

            if (dg.SelectedItem != null)
            {
                ServiceCaisse.CsLclient SelectedObject = (ServiceCaisse.CsLclient)dg.SelectedItem;
                if (SelectedObject.Selectionner == false)
                {
                    SelectedObject.Selectionner        = true;
                    this.dtg_FactureDetail.ItemsSource = null;
                    this.dtg_FactureDetail.ItemsSource = _ListeDesReglementDuRecu.Where(t => t.MATRICULE == SelectedObject.MATRICULE && t.ACQUIT == SelectedObject.ACQUIT).ToList();;
                }
                else
                {
                    SelectedObject.Selectionner        = false;
                    this.dtg_FactureDetail.ItemsSource = null;
                }
            }
        }