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 bool InsertData_FileExcel(ParamsFileDTO _paramsFileDTO, ref string msgErr)
 {
     try
     {
         ParamsFile pf = new ParamsFile()
         {
             ID                  = Guid.NewGuid(),
             PathFileExcel       = _paramsFileDTO.PathFileExcel,
             PasswordFileExcel   = Crypteur.CrypterText(_paramsFileDTO.PasswordFileExcel),
             DateUpdatedFile     = _paramsFileDTO.DateUpdatedFile,
             DateUpdatedPassword = _paramsFileDTO.DateUpdatedPassword,
             AccountUpdatedPath  = _paramsFileDTO.AccountUpdatedPath,
             AccountUpdatetedPwd = _paramsFileDTO.AccountUpdatetedPwd
         };
         new DAL <ParamsFile>().InserRow(pf);
         return(true);
     }
     catch (Exception ex)
     {
         msgErr = ex.Message;
         return(false);
     }
 }
Example #4
0
        public bool UpdateData_FileExcel(ParamsFileDTO _paramsFileDTO, ref string msgErr, bool isAdminExcel)
        {
            try
            {
                ParamsFile _pf = new DAL <ParamsFile>().Find(f => f.ID == _paramsFileDTO.ID).FirstOrDefault();
                if (_pf != null)
                {
                    if (isAdminExcel)
                    {
                        _pf.PasswordFileExcel   = Crypteur.CrypterText(_paramsFileDTO.PasswordFileExcel);
                        _pf.AccountUpdatetedPwd = _paramsFileDTO.AccountUpdatetedPwd;
                        _pf.DateUpdatedPassword = _paramsFileDTO.DateUpdatedPassword;
                    }
                    else
                    {
                        _pf.DateUpdatedFile    = _paramsFileDTO.DateUpdatedFile;
                        _pf.AccountUpdatedPath = _paramsFileDTO.AccountUpdatedPath;
                        _pf.PathFileExcel      = _paramsFileDTO.PathFileExcel;
                    }



                    new DAL <ParamsFile>().UpdateRow(_pf, p => p.ID == _paramsFileDTO.ID);
                    return(true);
                }
                else
                {
                    msgErr = "Aucun paramétrage trouvé";
                    return(false);
                }
            }
            catch (Exception ex)
            {
                msgErr = ex.Message;
                return(false);
            }
        }
Example #5
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);
        }