Example #1
0
        public ParamsFileDTO get_ParamsFile(ref string msgErr)
        {
            try
            {
                ParamsFileDTO _pf = new ParamsFileDTO();
                ParamsFile    dt  = new DAL <ParamsFile>().FindAll().FirstOrDefault();
                if (dt != null)
                {
                    _pf.PasswordFileExcel   = Crypteur.DecrypterText(dt.PasswordFileExcel);
                    _pf.DateUpdatedFile     = dt.DateUpdatedFile;
                    _pf.DateUpdatedPassword = dt.DateUpdatedPassword;
                    _pf.AccountUpdatedPath  = dt.AccountUpdatedPath;
                    _pf.AccountUpdatetedPwd = dt.AccountUpdatetedPwd;
                    _pf.PathFileExcel       = dt.PathFileExcel;
                    _pf.ID = dt.ID;

                    return(_pf);
                }
                else
                {
                    msgErr = "Aucune configuration du fichier !";
                    return(null);
                }
            }
            catch (Exception ex)
            {
                msgErr = ex.Message;
                return(null);
            }
        }
Example #2
0
        public static string GetConnectionString(bool pChaineCryptee, string connectionStringName)
        {
            string Resultat = string.Empty;

            if (pChaineCryptee)
            {
                Resultat = Crypteur.DecrypterText(ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString);
            }
            else
            {
                Resultat = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;
            }

            return(Resultat);
        }
Example #3
0
        public static bool EstChaineDeConnexionALaBaseValide(ref string Error)
        {
            Error          = string.Empty;
            _ChaineCryptee = false;
            string ChaineDeConnexion = DatabaseConnectionString;

            if (!SAPHIRCOMDataAccess.SAPHIRCOMDataAccess.EstConnexionStringValide(ChaineDeConnexion, ref Error))
            {
                //- Vérifier que la chaîne de connexion est cryptée.
                Crypteur _Crypteur       = new Crypteur();
                string   ChaineDecryptee = string.Empty;
                try
                {
                    ChaineDecryptee = Crypteur.DecrypterText(ChaineDeConnexion);
                    if (SAPHIRCOMDataAccess.SAPHIRCOMDataAccess.EstConnexionStringValide(ChaineDecryptee, ref Error))
                    {
                        _SAPHIRCOMConnexionString = ChaineDecryptee;
                        _ChaineCryptee            = true;
                        Error = string.Empty;
                        return(true);
                    }
                    else
                    {
                        Error = "Chaîne de connexion décryptée. Erreur d'accès : \n" + Error;
                        return(false);
                    }
                }
                catch
                {
                    Error = "Chaîne de connexion non cryptée. Erreur d'accès : \n" + Error;
                    return(false);
                }
            }

            return(true);
        }