void ChercherInfoUtilisateur()
        {
            //On recherche maintenant les infos du gars qui a initiée la demande
            AdministrationServiceClient adminClient = new AdministrationServiceClient(Utility.Protocole(),
                                                                                      Utility.EndPoint("Administration"));

            AfficherOuCacherChargement(true);
            adminClient.RetourneListeAllUserCompleted += (usender, uargs) =>
            {
                AfficherOuCacherChargement(false);
                if (uargs.Cancelled || uargs.Error != null)
                {
                    string error = uargs.Error.Message;
                    Message.Show(error, Languages.ListeCodePoste);
                    return;
                }
                if (uargs.Result == null)
                {
                    Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Parametrage);
                    return;
                }

                leGarQuiAInitie = uargs.Result.Where(u => u.MATRICULE == _LaDemande.MATRICULEUSERCREATION)
                                  .FirstOrDefault();
            };
            adminClient.RetourneListeAllUserAsync();
        }
Ejemplo n.º 2
0
        void GetData()
        {
            try
            {
                AdministrationServiceClient client = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));
                client.RetourneListeAllUserCompleted += (ss, res) =>
                {
                    if (res.Cancelled || res.Error != null)
                    {
                        string error = res.Error.Message;
                        Message.ShowError(error, Galatee.Silverlight.Resources.Langue.errorTitle);
                        return;
                    }

                    if (res.Result == null || res.Result.Count == 0)
                    {
                        Message.ShowInformation(Galatee.Silverlight.Resources.Langue.msgNodata, Galatee.Silverlight.Resources.Langue.informationTitle);
                        return;
                    }

                    List <ServiceAccueil.CsCentre> lstCentreProfil = Shared.ClasseMEthodeGenerique.RetourCentreByPerimetre(SessionObject.LstCentre, UserConnecte.listeProfilUser);
                    List <int> lstCentreHabil = new List <int>();
                    foreach (var item in lstCentreProfil)
                    {
                        lstCentreHabil.Add(item.PK_ID);
                    }

                    var lstUtilisateurDistnct = res.Result.Where(t => lstCentreHabil.Contains(t.FK_IDCENTRE)).ToList().Select(t => new { t.PK_ID, t.MATRICULE, t.LIBELLE }).Distinct().ToList();
                    foreach (var item in lstUtilisateurDistnct)
                    {
                        _lstUserProfil.Add(new CsUtilisateur {
                            PK_ID = item.PK_ID, MATRICULE = item.MATRICULE, LIBELLE = item.LIBELLE
                        });
                    }


                    //Cbo_Utilisateur.ItemsSource = null;
                    //Cbo_Utilisateur.ItemsSource = _lstUserProfil.OrderBy(t=>t.LIBELLE  ).ToList();
                    //this.Cbo_Utilisateur.DisplayMemberPath = "LIBELLE";
                };
                client.RetourneListeAllUserAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void RetourneListeAllUser()
        {
            try
            {
                AdministrationServiceClient client = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));
                client.RetourneListeAllUserCompleted += (ss, res) =>
                {
                    if (res.Cancelled || res.Error != null)
                    {
                        string error = res.Error.Message;
                        Message.ShowError(error, Galatee.Silverlight.Resources.Langue.errorTitle);
                        return;
                    }

                    if (res.Result == null || res.Result.Count == 0)
                    {
                        Message.ShowInformation(Galatee.Silverlight.Resources.Langue.msgNodata, Galatee.Silverlight.Resources.Langue.informationTitle);
                        return;
                    }

                    List <Galatee.Silverlight.ServiceAccueil.CsCentre> lstCentreProfil = Shared.ClasseMEthodeGenerique.RetourCentreByPerimetre(SessionObject.LstCentre, UserConnecte.listeProfilUser);
                    List <int> lstCentreHabil = new List <int>();
                    foreach (var item in lstCentreProfil)
                    {
                        lstCentreHabil.Add(item.PK_ID);
                    }
                    List <CsUtilisateur> _lstUserProfil = res.Result.Where(t => lstCentreHabil.Contains(t.FK_IDCENTRE)).ToList();
                    donnesDatagrid = _lstUserProfil;

                    var listeTemp = (from t in donnesDatagrid
                                     select new
                    {
                        t.PK_ID,
                        t.CENTREAFFICHER,
                        t.CENTRE,
                        t.MATRICULE,
                        t.LOGINNAME,
                        t.LIBELLE,
                        t.LIBELLESTATUSCOMPTE,
                        t.LIBELLEPERIMETREACTION
                    }).Distinct().ToList();
                    foreach (var t in listeTemp)
                    {
                        CsUtilisateur user = new CsUtilisateur();
                        user.PK_ID                  = t.PK_ID;
                        user.CENTREAFFICHER         = t.CENTREAFFICHER;
                        user.CENTRE                 = t.CENTRE;
                        user.MATRICULE              = t.MATRICULE;
                        user.LOGINNAME              = t.LOGINNAME;
                        user.LIBELLE                = t.LIBELLE;
                        user.LIBELLESTATUSCOMPTE    = t.LIBELLESTATUSCOMPTE;
                        user.LIBELLEPERIMETREACTION = t.LIBELLEPERIMETREACTION;
                        LstUser.Add(user);
                    }
                    //cbo_utilisateurGestionnaire.SelectedValue = "PK_ID";
                    //cbo_utilisateurGestionnaire.DisplayMemberPath = "LIBELLE";
                    //cbo_utilisateurGestionnaire.ItemsSource = LstUser.OrderBy(t=>t.LIBELLE);
                };
                client.RetourneListeAllUserAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        void GetData()
        {
            try
            {
                int back = LoadingManager.BeginLoading("Chargement des utilisateurs ...");
                AdministrationServiceClient client = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));
                client.RetourneListeAllUserCompleted += (ss, res) =>
                {
                    if (res.Cancelled || res.Error != null)
                    {
                        string error = res.Error.Message;
                        Message.ShowError(error, Galatee.Silverlight.Resources.Langue.errorTitle);
                        LoadingManager.EndLoading(back);
                        return;
                    }

                    if (res.Result == null || res.Result.Count == 0)
                    {
                        Message.ShowInformation(Galatee.Silverlight.Resources.Langue.msgNodata, Galatee.Silverlight.Resources.Langue.informationTitle);
                        LoadingManager.EndLoading(back);
                        return;
                    }

                    foreach (CsUtilisateur item in res.Result)
                    {
                        item.CENTREAFFICHER = item.CENTRE + "  " + item.LIBELLECENTRE;
                        if (item.PERIMETREACTION == 1)
                        {
                            item.LIBELLEPERIMETREACTION = "Centre";
                        }
                        else if (item.PERIMETREACTION == 2)
                        {
                            item.LIBELLEPERIMETREACTION = "Site";
                        }
                        else if (item.PERIMETREACTION == 3)
                        {
                            item.LIBELLEPERIMETREACTION = "Globale";
                        }
                    }

                    List <Galatee.Silverlight.ServiceAccueil.CsCentre> lstCentreProfil = Shared.ClasseMEthodeGenerique.RetourCentreByPerimetre(SessionObject.LstCentre, UserConnecte.listeProfilUser);
                    List <int> lstCentreHabil = new List <int>();
                    foreach (var item in lstCentreProfil)
                    {
                        lstCentreHabil.Add(item.PK_ID);
                    }
                    _lstUserProfil = res.Result.Where(t => lstCentreHabil.Contains(t.FK_IDCENTRE)).ToList();

                    donnesDatagrid          = _lstUserProfil;
                    lvwResultat.ItemsSource = _lstUserProfil;

                    if (_lstUserProfil != null)
                    {
                        lvwResultat.SelectedItem = _lstUserProfil[0];
                    }

                    LoadingManager.EndLoading(back);
                };
                client.RetourneListeAllUserAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }