Exemplo n.º 1
0
        ///////////////////////////////////////////////////////
        public void ResetCache()
        {
            CDonneeNotificationResetCacheDatabaseRegistre data = new CDonneeNotificationResetCacheDatabaseRegistre(IdSession);

            CEnvoyeurNotification.EnvoieNotifications(new CDonneeNotificationResetCacheDatabaseRegistre[] { data });
            ResetCacheStatic();
        }
Exemplo n.º 2
0
        ///////////////////////////////////////////////////////
        public CResultAErreur SetValeur(string strCle, string strValeur)
        {
            CResultAErreur result = CResultAErreur.True;

            try
            {
                lock (typeof(CDatabaseRegistre))
                {
                    string strRequete = "select " + c_champValeur + " from " + c_nomTable
                                        + " where " + c_champCle + "=" + Connexion.GetStringForRequete(strCle);
                    result = Connexion.ExecuteScalar(strRequete);
                    if (!result || result.Data == null)
                    {
                        string strInsert = "insert into " + c_nomTable + "(" + c_champCle + "," + c_champValeur + ") " +
                                           "values(" + Connexion.GetStringForRequete(strCle) + "," + Connexion.GetStringForRequete(strValeur) + ")";
                        return(Connexion.RunStatement(strInsert));
                    }
                    else
                    {
                        string strUpdate = "Update " + c_nomTable + " set " + c_champValeur + "=" + Connexion.GetStringForRequete(strValeur) +
                                           " where " + c_champCle + "=" + Connexion.GetStringForRequete(strCle);
                        return(Connexion.RunStatement(strUpdate));
                    }
                }
            }
            catch (Exception e)
            {
                result.EmpileErreur(new CErreurException(e));
            }
            finally
            {
                if (result)
                {
                    CDonneeNotificationResetCacheDatabaseRegistre data = new CDonneeNotificationResetCacheDatabaseRegistre(IdSession);
                    CEnvoyeurNotification.EnvoieNotifications(new CDonneeNotificationResetCacheDatabaseRegistre[] { data });
                }
                ResetCacheStatic();
            }
            return(result);
        }