private void ValiderModifPassWord()
        {
            try
            {
                Security.CsStrategieSecurite security = new Security.CsStrategieSecurite();
                Utility.ParseObject <Security.CsStrategieSecurite, ServiceAuthenInitialize.CsStrategieSecurite>(security, SessionObject.securiteActive);
                //security = Utility.ParseObject<CsStrategieSecurite, ServiceAdministration.CsStrategieSecurite>(security, SessionObject.securite);
                CsUtilisateur user = new CsUtilisateur();
                user = Utility.ParseObject(user, userSelected);
                user.INITUSERPASSWORD = ckc_Changepwd.IsChecked;
                //Galatee.Silverlight.Security.Securities.CheckConfirmPassword(txt_newPwd.Text, txt_confPwd.Text);
                user.PASSE = Galatee.Silverlight.Security.Cryptage.GetPasswordToBeSaved(security, userSelected.LOGINNAME, txt_newPwd.Text);
                //user.FONCTION = "Galatee";
                user.DATEDERNIEREMODIFICATIONPASSWORD = DateTime.Now;
                user.USERCREATION = UserConnecte.matricule;
                AdministrationServiceClient adm = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));

                adm.UpdateUserCompleted += (updates, resultupt) =>
                {
                    if (resultupt.Cancelled || resultupt.Error != null)
                    {
                        string error = resultupt.Error.Message;
                        Message.Show(error, Galatee.Silverlight.Resources.Langue.errorTitle);
                        return;
                    }

                    if (resultupt.Result == false)
                    {
                        Message.Show(Galatee.Silverlight.Resources.Langue.updateError, Galatee.Silverlight.Resources.Langue.errorTitle);
                        return;
                    }
                    else
                    {
                        Message.Show(Galatee.Silverlight.Resources.Langue.updateSuccess, Galatee.Silverlight.Resources.Langue.ConfirmationTitle);
                        //UpdateGridview(user);
                        this.DialogResult = true;
                    }
                };
                adm.UpdateUserAsync(user, true);
            }
            catch (Exception ex)
            {
                Message.Show(ex.Message, Galatee.Silverlight.Resources.Langue.errorTitle);
            }
        }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Security.CsStrategieSecurite security = new Security.CsStrategieSecurite();
                //Utility.ParseObject<Security.CsStrategieSecurite, ServiceAuthenInitialize.CsStrategieSecurite>(security, SessionObject.securiteActive);

                security.ACTIF = SessionObject.securiteActive.ACTIF;
                security.CHIFFREMENTREVERSIBLEPASSWORD = SessionObject.securiteActive.CHIFFREMENTREVERSIBLEPASSWORD;
                security.DUREEMAXIMALEPASSWORD         = SessionObject.securiteActive.DUREEMAXIMALEPASSWORD;
                security.DUREEMINIMALEPASSWORD         = SessionObject.securiteActive.DUREEMINIMALEPASSWORD;
                security.DUREEVEUILLESESSION           = SessionObject.securiteActive.DUREEVEUILLESESSION;
                security.DUREEVERROUILLAGECOMPTE       = SessionObject.securiteActive.DUREEVERROUILLAGECOMPTE;
                security.HISTORIQUENOMBREPASSWORD      = SessionObject.securiteActive.HISTORIQUENOMBREPASSWORD;
                security.LIBELLE = SessionObject.securiteActive.LIBELLE;
                security.LONGUEURMINIMALEPASSWORD                     = SessionObject.securiteActive.LONGUEURMINIMALEPASSWORD;
                security.NEPASCONTENIRNOMCOMPTE                       = SessionObject.securiteActive.NEPASCONTENIRNOMCOMPTE;
                security.NOMBREMAXIMALECHECSOUVERTURESESSION          = SessionObject.securiteActive.NOMBREMAXIMALECHECSOUVERTURESESSION;
                security.NOMBREMINIMALCARACTERESCHIFFRES              = SessionObject.securiteActive.NOMBREMINIMALCARACTERESCHIFFRES;
                security.NOMBREMINIMALCARACTERESMAJUSCULES            = SessionObject.securiteActive.NOMBREMINIMALCARACTERESMAJUSCULES;
                security.NOMBREMINIMALCARACTERENONALPHABETIQUES       = SessionObject.securiteActive.NOMBREMINIMALCARACTERENONALPHABETIQUES;
                security.PK_IDSTRATEGIESECURITE                       = SessionObject.securiteActive.PK_IDSTRATEGIESECURITE;
                security.REINITIALISERCOMPTEURVERROUILLAGECOMPTEAPRES = SessionObject.securiteActive.REINITIALISERCOMPTEURVERROUILLAGECOMPTEAPRES;
                security.TOUCHEVERROUILLAGESESSION                    = SessionObject.securiteActive.TOUCHEVERROUILLAGESESSION;



                Security.CsUtilisateur user = new Security.CsUtilisateur();

                user.PK_ID                            = userSelected.PK_ID;
                user.BRANCHE                          = userSelected.BRANCHE;
                user.DATECREATION                     = userSelected.DATECREATION;
                user.DATEDEBUTVALIDITE                = userSelected.DATEDEBUTVALIDITE;
                user.DATEDERNIERECONNEXION            = userSelected.DATEDERNIERECONNEXION;
                user.DATEDERNIEREMODIFICATION         = userSelected.DATEDERNIEREMODIFICATION;
                user.DATEDERNIEREMODIFICATIONPASSWORD = userSelected.DATEDERNIEREMODIFICATIONPASSWORD;
                user.DATEDERNIERVERROUILLAGE          = userSelected.DATEDERNIERVERROUILLAGE;
                user.DATEFINVALIDITE                  = userSelected.DATEFINVALIDITE;
                user.DERNIERECONNEXIONREUSSIE         = userSelected.DERNIERECONNEXIONREUSSIE;
                user.LIBELLE                          = userSelected.LIBELLE;
                user.ESTSUPPRIMER                     = userSelected.ESTSUPPRIMER;
                user.E_MAIL                           = userSelected.E_MAIL;
                user.EsADMIN                          = userSelected.EsADMIN;
                user.CENTRE                           = userSelected.CENTRE;
                user.FONCTION                         = userSelected.FONCTION;
                user.INITUSERPASSWORD                 = userSelected.INITUSERPASSWORD;
                user.LIBELLEFONCTION                  = userSelected.LIBELLEFONCTION;
                user.LOGINNAME                        = userSelected.LOGINNAME;
                user.NOMBREECHECSOUVERTURESESSION     = userSelected.NOMBREECHECSOUVERTURESESSION;
                user.USERCREATION                     = userSelected.USERCREATION;
                user.PASSE                            = userSelected.PASSE;
                user.PERIMETREACTION                  = userSelected.PERIMETREACTION;
                user.MATRICULE                        = userSelected.MATRICULE;
                //user.Prenoms = userSelected.Prenoms;
                //user.RoleDisplayName = userSelected.RO;
                //user.RoleID = userSelected.RoleID;
                user.LIBELLESTATUSCOMPTE = userSelected.LIBELLESTATUSCOMPTE;
                user.PK_ID       = userSelected.PK_ID;
                user.FK_IDSTATUS = userSelected.FK_IDSTATUS;


                //Utility.ParseObject(user, userSelected);

                bool isToUpate = Security.Securities.ChangePassword(user, security, user.PASSE, txt_new.Password, txt_confirm.Password, TenirCompteAncienPwd);
                if (isToUpate)
                {
                    // var admUser = Utility.ParseObject(new CsUtilisateur(),user);

                    ServiceAdministration.CsUtilisateur admUser = new ServiceAdministration.CsUtilisateur();
                    admUser.DATEDERNIEREMODIFICATIONPASSWORD = DateTime.Now; // userSelected.DateDerniereModificationPassword;
                    admUser.PK_ID                    = user.PK_ID;
                    admUser.BRANCHE                  = user.BRANCHE;
                    admUser.DATECREATION             = user.DATECREATION;
                    admUser.DATEDEBUTVALIDITE        = user.DATEDEBUTVALIDITE;
                    admUser.DATEDERNIERECONNEXION    = user.DATEDERNIERECONNEXION;
                    admUser.DATEDERNIEREMODIFICATION = user.DATEDERNIEREMODIFICATION;
                    //admUser.DateDerniereModificationPassword = user.DateDerniereModificationPassword;
                    admUser.DATEDERNIERVERROUILLAGE  = user.DATEDERNIERVERROUILLAGE;
                    admUser.DATEFINVALIDITE          = user.DATEFINVALIDITE;
                    admUser.DERNIERECONNEXIONREUSSIE = user.DERNIERECONNEXIONREUSSIE;
                    admUser.LIBELLE                      = user.LIBELLE;
                    admUser.ESTSUPPRIMER                 = user.ESTSUPPRIMER;
                    admUser.E_MAIL                       = user.E_MAIL;
                    admUser.EsADMIN                      = user.EsADMIN;
                    admUser.CENTRE                       = user.CENTRE;
                    admUser.FONCTION                     = user.FONCTION;
                    admUser.INITUSERPASSWORD             = false;
                    admUser.LIBELLEFONCTION              = user.LIBELLEFONCTION;
                    admUser.LOGINNAME                    = user.LOGINNAME;
                    admUser.NOMBREECHECSOUVERTURESESSION = user.NOMBREECHECSOUVERTURESESSION;
                    admUser.USERCREATION                 = user.USERCREATION;
                    admUser.PASSE               = user.PASSE;
                    admUser.PERIMETREACTION     = user.PERIMETREACTION;
                    admUser.MATRICULE           = user.MATRICULE;
                    admUser.LIBELLESTATUSCOMPTE = user.LIBELLESTATUSCOMPTE;
                    admUser.PK_ID               = user.PK_ID;
                    admUser.FK_IDCENTRE         = userSelected.FK_IDCENTRE;
                    admUser.FK_IDFONCTION       = userSelected.FK_IDFONCTION;
                    admUser.FK_IDSTATUS         = userSelected.FK_IDSTATUS;


                    AdministrationServiceClient adm = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));

                    adm.UpdateUserCompleted += (updates, resultupt) =>
                    {
                        if (resultupt.Cancelled || resultupt.Error != null)
                        {
                            string error = resultupt.Error.Message;
                            Message.ShowError(error, Galatee.Silverlight.Resources.Langue.errorTitle);
                            return;
                        }

                        if (resultupt.Result == false)
                        {
                            Message.ShowInformation(Galatee.Silverlight.Resources.Langue.updateError, Galatee.Silverlight.Resources.Langue.errorTitle);
                            IsPasswordChange = false;
                            return;
                        }
                        else
                        {
                            var ws = new MessageBoxControl.MessageBoxChildWindow("", Galatee.Silverlight.Resources.Langue.ConfirmationModifMotDePasse, MessageBoxControl.MessageBoxButtons.Ok, MessageBoxControl.MessageBoxIcon.Question);

                            IsPasswordChange       = true;
                            ws.OnMessageBoxClosed += (l, results) =>
                            {
                                if (ws.Result == MessageBoxResult.OK)
                                {
                                    //ObtenirDonneesConnection( Unuser);
                                    this.DialogResult = true;
                                }
                            };
                            ws.Show();
                        }
                    };
                    adm.UpdateUserAsync(admUser, true);
                }
            }
            catch (Exception ex)
            {
                Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
            }
        }