//--------------------------------------
        private void InitChamps()
        {
            m_txtNomChamp.Text       = m_champEdite.NomChamp;
            m_txtDescription.Text    = m_champEdite.Description;
            m_lblDataType.Text       = new CTypeChampBasique(m_champEdite.TypeChamp).Libelle;
            m_chkNoUpdate.Checked    = m_champEdite.NoUpdateFromSnmp;
            m_chkNoWriteSNMP.Checked = m_champEdite.IsReadOnly;
            m_lblAcces.Text          = m_champEdite.IsReadOnly ? I.T("Read only|20296") : I.T("Read/write|20297");

            CFournisseurGeneriqueProprietesDynamiques fournisseur = new CFournisseurGeneriqueProprietesDynamiques();
            CEntiteSnmpPourSupervision entiteTest = m_typeEntite.GetEntiteDeTest();

            m_txtFormuleIndex.Init(fournisseur,
                                   new CObjetPourSousProprietes(entiteTest));
            m_txtFormuleIndex.Formule = m_champEdite.FormuleIndex;

            TypeDonnee typeChampMap = TypeDonnee.tString;

            switch (m_champEdite.TypeChamp)
            {
            case ETypeChampBasique.Bool:
                typeChampMap = TypeDonnee.tBool;
                break;

            case ETypeChampBasique.Date:
                typeChampMap = TypeDonnee.tDate;
                break;

            case ETypeChampBasique.Decimal:
                typeChampMap = TypeDonnee.tDouble;
                break;

            case ETypeChampBasique.Int:
                typeChampMap = TypeDonnee.tEntier;
                break;

            case ETypeChampBasique.String:
                typeChampMap = TypeDonnee.tString;
                break;

            default:
                break;
            }
            m_txtSelectChampCustom.InitAvecFiltreDeBase(typeof(CChampCustom),
                                                        "Nom",
                                                        CFiltreData.GetAndFiltre(CChampCustom.GetFiltreChampsForRole(CEntiteSnmp.c_roleChampCustom),
                                                                                 new CFiltreData(CChampCustom.c_champType + "=@1",
                                                                                                 (int)typeChampMap)),
                                                        false);
            CChampCustom champ = new CChampCustom(m_contexteDonnee);

            if (m_champToCustom.IdChampCustom != null && champ.ReadIfExists(m_champToCustom.IdChampCustom.Value))
            {
                m_txtSelectChampCustom.ElementSelectionne = champ;
            }
            else
            {
                m_txtSelectChampCustom.ElementSelectionne = null;
            }
        }
Пример #2
0
        //---------------------------------------------

        /// /////////////////////////////////////////////
        public CAgentSnmpPourSupervision GetAgentPourSupervision(CMemoryDb database, bool bAvecEntites)
        {
            if (database == null)
            {
                database = CMemoryDbPourSupervision.GetMemoryDb(ContexteDonnee);
            }
            CAgentSnmpPourSupervision agent = new CAgentSnmpPourSupervision(database);

            if (!agent.ReadIfExist(Id.ToString(), false))
            {
                agent.CreateNew(Id.ToString());
            }
            else
            if (!agent.IsToRead())
            {
                return(agent);
            }
            agent.Row[CMemoryDb.c_champIsToRead] = false;
            CTypeAgentPourSupervision typeAgent = TypeAgent.GetTypeAgentPourSupervision(database);

            agent.TypeAgent     = typeAgent;
            agent.Ip            = SnmpIp;
            agent.Timeout       = Timeout;
            agent.SnmpPort      = SnmpPort;
            agent.SnmpVersion   = SnmpVersion;
            agent.Communaute    = SnmpCommunaute;
            agent.TrapsIpString = TrapsIpsString;
            foreach (CSnmpPollingSetup setup in ParametresPolling)
            {
                CSnmpPollingSetup newSetup = database.ImporteObjet(setup, true, false) as CSnmpPollingSetup;
                newSetup.Agent = agent;
            }
            foreach (CSnmpHotelPollingSetup setup in ParametresHotelPolling)
            {
                CSnmpHotelPollingSetup newSetup = database.ImporteObjet(setup, true, false) as CSnmpHotelPollingSetup;
                newSetup.Agent = agent;
            }
            if (bAvecEntites)
            {
                foreach (CEntiteSnmp entite in EntitesSnmp)
                {
                    if (entite.EntiteSnmpParente == null)
                    {
                        CTypeEntiteSnmpPourSupervision typeEntite = typeAgent.TypesEntites.FirstOrDefault(te => te.Id == entite.TypeEntiteSnmp.Id.ToString());
                        if (typeEntite != null)
                        {
                            CEntiteSnmpPourSupervision ett = entite.GetEntitePourSupervision(typeEntite);
                            if (ett != null)
                            {
                                ett.AgentSnmp = agent;
                            }
                        }
                    }
                }
            }
            return(agent);
        }
Пример #3
0
        //----------------------------------------------------------------------
        public CResultAErreur UpdateValeurs(CContexteDonnee contexteDeBasePasEnEdition, IIndicateurProgression indicateurProgression)
        {
            if (Count == 0)
            {
                return(CResultAErreur.True);
            }
            CConteneurIndicateurProgression progress = CConteneurIndicateurProgression.GetConteneur(indicateurProgression);
            CResultAErreur result = CResultAErreur.True;
            //Lecture entite par entité pour optimiser la lecture
            Dictionary <CEntiteSnmp, HashSet <CChampCustom> > lstChamps = new Dictionary <CEntiteSnmp, HashSet <CChampCustom> >();

            progress.SetBornesSegment(0, Count);
            foreach (CCoupleEntiteSnmp_Champ couple in this)
            {
                HashSet <CChampCustom> set = null;
                if (!lstChamps.TryGetValue(couple.Entite, out set))
                {
                    set = new HashSet <CChampCustom>();
                    lstChamps[couple.Entite] = set;
                }
                set.Add(couple.ChampCustom);
            }

            CSessionClient session = CSousSessionClient.GetNewSousSession(this[0].Entite.ContexteDonnee.IdSession);

            session.OpenSession(new CAuthentificationSessionSousSession(this[0].Entite.ContexteDonnee.IdSession),
                                "SNMP", ETypeApplicationCliente.Service);
            using (CContexteDonnee ctxModif = new CContexteDonnee(session.IdSession, true, false))
            {
                int nIndex = 1;
                foreach (KeyValuePair <CEntiteSnmp, HashSet <CChampCustom> > kv in lstChamps)
                {
                    CEntiteSnmp        entite       = kv.Key.GetObjetInContexte(ctxModif) as CEntiteSnmp;
                    CInterrogateurSnmp dynamicAgent = new CInterrogateurSnmp();
                    dynamicAgent.Connexion = entite.AgentSnmp.GetNewSnmpConnexion();
                    CEntiteSnmpPourSupervision ettSup = null;
                    foreach (CChampCustom champ in kv.Value)
                    {
                        int nIdChamp = champ.Id;
                        if (entite.ReadChampSnmp(nIdChamp, dynamicAgent, ref ettSup))
                        {
                            entite.CopieValeurSnmpDansValeurChamp(nIdChamp);
                        }
                        progress.SetValue(nIndex++);
                    }
                }
                progress.SetValue(Count);
                ctxModif.SaveAll(true);
                System.Threading.Thread.Sleep(2000);
                session.CloseSession();
            }
            return(result);
        }
Пример #4
0
        //--------------------------------------
        private void InitChamps()
        {
            m_txtNomChamp.Text    = m_champEdite.NomChamp;
            m_txtDescription.Text = m_champEdite.Description;
            m_lblDataType.Text    = new CTypeChampBasique(m_champEdite.TypeChamp).Libelle;
            m_lblAcces.Text       = m_champEdite.IsReadOnly ? I.T("Read only|20101") : I.T("Read/write|20102");

            CFournisseurGeneriqueProprietesDynamiques fournisseur = new CFournisseurGeneriqueProprietesDynamiques();
            CEntiteSnmpPourSupervision entiteTest = m_typeEntite.GetEntiteDeTest();

            m_txtFormuleIndex.Init(fournisseur,
                                   new CObjetPourSousProprietes(entiteTest));
            m_txtFormuleIndex.Formule = m_champEdite.FormuleIndex;
        }
Пример #5
0
        //------------------------------------------
        public CResultAErreur LireValeursSnmp()
        {
            CResultAErreur result = CResultAErreur.True;

            if (TypeEntiteSnmp == null)
            {
                return(result);
            }
            IEnumerable <CChampEntiteFromQueryToChampCustom> champs = from champ in TypeEntiteSnmp.ChampsFromQuery
                                                                      where
                                                                      champ.IdChampCustom != null && !champ.Champ.NoUpdateFromSnmp
                                                                      select champ;
            CInterrogateurSnmp dynamicAgent = new CInterrogateurSnmp();

            dynamicAgent.Connexion = AgentSnmp.GetNewSnmpConnexion();
            CEntiteSnmpPourSupervision ettPourSup = null;

            foreach (CChampEntiteFromQueryToChampCustom champ in champs)
            {
                result += ReadChampSnmp(champ.IdChampCustom.Value, dynamicAgent, ref ettPourSup);
            }
            return(result);
        }
Пример #6
0
 public void Init(CEntiteSnmpPourSupervision entite)
 {
 }
Пример #7
0
        //-------------------------------------------------------------------------------
        public CResultAErreur FillFromSnmp(CEntiteSnmpPourSupervision entiteFromSnmp)
        {
            CResultAErreur result    = CResultAErreur.True;
            CTypeAgentSnmp typeAgent = AgentSnmp.TypeAgent;

            CTypeEntiteSnmp[] typesEntites = (CTypeEntiteSnmp[])typeAgent.TypesEntites.ToArray(typeof(CTypeEntiteSnmp));
            CTypeEntiteSnmp   typeEntite   = typesEntites.FirstOrDefault(t => t.Id.ToString() == entiteFromSnmp.TypeEntite.Id);

            if (typeEntite == null)
            {
                result.EmpileErreur(I.T("Can not find Snmp entity type @1|20309", entiteFromSnmp.TypeEntite.Id));
                return(result);
            }
            TypeEntiteSnmp = typeEntite;
            Index          = entiteFromSnmp.Index;
            Libelle        = entiteFromSnmp.Libelle;

            //Affecte les champs
            foreach (CChampEntiteFromQueryToChampCustom champ in typeEntite.ChampsFromQuery)
            {
                if (champ.IdChampCustom != null)
                {
                    CChampCustom champCustom = new CChampCustom(ContexteDonnee);
                    if (champCustom.ReadIfExists(champ.IdChampCustom))
                    {
                        object valeur = entiteFromSnmp.GetValeurChamp(champ.Champ.Id);
                        if (valeur != null)
                        {
                            if (champCustom.TypeDonneeChamp.TypeDonnee == TypeDonnee.tObjetDonneeAIdNumeriqueAuto)
                            {
                                Type tp = champCustom.TypeObjetDonnee;
                                CObjetDonneeAIdNumerique obj = Activator.CreateInstance(tp, new object[] { ContexteDonnee }) as CObjetDonneeAIdNumerique;
                                if (valeur is int)
                                {
                                    if (obj != null && obj.ReadIfExists((int)valeur, true))
                                    {
                                        SetValeurFromSnmp(champ.IdChampCustom.Value, obj);
                                    }
                                }
                                else
                                {
                                    SetValeurFromSnmp(champ.IdChampCustom.Value, null);
                                }
                            }
                            else
                            {
                                SetValeurFromSnmp(champ.IdChampCustom.Value, valeur);
                            }
                        }
                    }
                }
            }

            //calcule le libellé
            if (typeEntite.FormuleCalculLibelle != null)
            {
                CContexteEvaluationExpression ctx = new CContexteEvaluationExpression(this);
                result = typeEntite.FormuleCalculLibelle.Eval(ctx);
                if (result && result.Data != null)
                {
                    Libelle = result.Data.ToString();
                }
                result = CResultAErreur.True;
            }

            return(result);
        }
Пример #8
0
        public bool SetSnmpValueForField(int nIdChampCustom, object value)
        {
            ITableDefinition  table = null;
            IColumnDefinition col   = null;

            CResultAErreurType <IObjetDeEasyQuery> resObj = TypeEntiteSnmp.FindSourceObjetInQuery();

            if (!resObj || resObj.DataType == null)
            {
                return(false);
            }

            IObjetDeEasyQuery objetSource = resObj.DataType;
            CEasyQuery        query       = objetSource.Query;
            IEnumerable <CChampEntiteFromQueryToChampCustom> lstChamps = TypeEntiteSnmp.ChampsFromQuery;
            CChampEntiteFromQueryToChampCustom champ = null;

            foreach (CChampEntiteFromQueryToChampCustom champTest in lstChamps)
            {
                if (champTest.IdChampCustom != null &&
                    champTest.IdChampCustom == nIdChampCustom)
                {
                    champ = champTest;
                    break;
                }
            }
            if (champ == null)
            {
                return(false);
            }

            if (query.FindSource(champ.Champ.ColonneSource, objetSource,
                                 out table,
                                 out col))
            {
                CEntiteSnmpPourSupervision ettPourSup = null;
                CColumnDefinitionSNMP      colSnmp    = col as CColumnDefinitionSNMP;

                if (colSnmp != null && !colSnmp.IsReadOnly)
                {
                    ISnmpData snmpVal = AbstractTypeAssignment.GetSnmpFromDotNet(colSnmp.SnmpType, value);
                    if (snmpVal == null && value != null)
                    {
                        snmpVal = new OctetString(value.ToString());
                    }
                    if (snmpVal != null)
                    {
                        string strIndex = Index;
                        if (champ.Champ.FormuleIndex != null)
                        {
                            if (ettPourSup == null)
                            {
                                ettPourSup = GetEntitePourSupervision(TypeEntiteSnmp.GetTypeEntitePourSupervision(null, false));
                            }
                            CContexteEvaluationExpression ctx = new CContexteEvaluationExpression(ettPourSup);
                            CResultAErreur restTmp            = champ.Champ.FormuleIndex.Eval(ctx);
                            if (restTmp && restTmp.Data != null)
                            {
                                strIndex = restTmp.Data.ToString();
                            }
                        }
                        if (!strIndex.StartsWith("."))
                        {
                            strIndex = "." + strIndex;
                        }
                        try
                        {
                            CInterrogateurSnmp agent = new CInterrogateurSnmp();
                            agent.Connexion.Version  = AgentSnmp.SnmpVersion;
                            agent.ConnexionIp        = AgentSnmp.SnmpIp;
                            agent.ConnexionPort      = AgentSnmp.SnmpPort;
                            agent.ConnexionCommunity = AgentSnmp.SnmpCommunaute;
                            CResultAErreur resTmp = agent.Set(colSnmp.OIDString + strIndex, snmpVal);
                            if (resTmp)
                            {
                                return(true);
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            return(false);
        }
Пример #9
0
        //-------------------------------------------------------------------------------
        //Optimisation : l'entité pour sup n'est créée qu'une seul fois lors d'appels multiples
        public CResultAErreur ReadChampSnmp(int nIdChampCustom, CInterrogateurSnmp dynamicAgent, ref CEntiteSnmpPourSupervision ettPourSup)
        {
            CResultAErreur result = CResultAErreur.True;

            CResultAErreurType <string> resOID = GetFieldOIDWithEntitePourSupervision(nIdChampCustom, ettPourSup);

            if (!resOID)
            {
                result.EmpileErreur(resOID.Erreur);
                return(result);
            }

            string    strOID = resOID.DataType;
            ISnmpData valeur = dynamicAgent.Get(strOID) as ISnmpData;
            CRelationEntiteSnmp_ChampCustom relChamp = CUtilElementAChamps.GetRelationToChamp(this, nIdChampCustom) as CRelationEntiteSnmp_ChampCustom;

            if (relChamp != null)
            {
                if (valeur == null)
                {
                    relChamp.LastSnmpValue = null;
                }
                else
                {
                    relChamp.LastSnmpValue = valeur.ConvertToTypeDotNet();
                }
            }
            result.Data = valeur != null?valeur.ConvertToTypeDotNet() : null;

            return(result);
        }
Пример #10
0
        //-------------------------------------------------------------------------------
        public CResultAErreurType <string> GetFieldOIDWithEntitePourSupervision(int nIdChampCustom, CEntiteSnmpPourSupervision ettPourSup)
        {
            CResultAErreurType <string> resString = new CResultAErreurType <string>();
            CColumnDefinitionSNMP       colSnmp   = GetSourceColumn(nIdChampCustom);

            if (colSnmp == null)
            {
                CChampCustom champ    = new CChampCustom(ContexteDonnee);
                string       strChamp = nIdChampCustom.ToString();
                if (champ.ReadIfExists(nIdChampCustom))
                {
                    strChamp = champ.Nom;
                }
                resString.EmpileErreur(I.T("Can not find snmp source for @1|20099", strChamp));
                return(resString);
            }

            IEnumerable <CChampEntiteFromQueryToChampCustom> lstChamps = TypeEntiteSnmp.ChampsFromQuery;
            CChampEntiteFromQueryToChampCustom assocChamp = lstChamps.FirstOrDefault(c => c.IdChampCustom == nIdChampCustom);
            string strOID   = colSnmp.OIDString;
            string strIndex = Index;

            if (assocChamp != null && assocChamp.Champ.FormuleIndex != null)
            {
                if (ettPourSup == null)
                {
                    ettPourSup = GetEntitePourSupervision(TypeEntiteSnmp.GetTypeEntitePourSupervision(null, false));
                }
                CContexteEvaluationExpression ctxEval = new CContexteEvaluationExpression(ettPourSup);
                CResultAErreur resTmp = assocChamp.Champ.FormuleIndex.Eval(ctxEval);
                if (resTmp && resTmp.Data != null)
                {
                    strIndex = resTmp.Data.ToString();
                }
            }
            if (strIndex.Length > 0)
            {
                if (!strIndex.StartsWith("."))
                {
                    strOID += ".";
                }
                strOID += strIndex;
            }
            resString.DataType = strOID;
            return(resString);
        }
Пример #11
0
        //-------------------------------------------------------------------------------
        public CResultAErreur ReadChampSnmp(int nIdChampCustom, CInterrogateurSnmp dynamicAgent)
        {
            CEntiteSnmpPourSupervision ettPourSup = null;

            return(ReadChampSnmp(nIdChampCustom, dynamicAgent, ref ettPourSup));
        }
Пример #12
0
        //----------------------------------------------------------------
        public CEntiteSnmpPourSupervision GetEntitePourSupervision(CTypeEntiteSnmpPourSupervision typeEntite)
        {
            if (typeEntite == null)
            {
                return(null);
            }
            //Cherche le type d'entite
            if (typeEntite == null)
            {
                return(null);
            }

            CEntiteSnmpPourSupervision entite = new CEntiteSnmpPourSupervision(typeEntite.Database);

            if (!entite.ReadIfExist(Id.ToString(), false))
            {
                entite.CreateNew(Id.ToString());
            }
            else
            if (!entite.IsToRead())
            {
                return(entite);
            }
            entite.Row[CMemoryDb.c_champIsToRead] = false;
            entite.TypeEntite = typeEntite;
            entite.Libelle    = Libelle;
            entite.Index      = Index;
            if (SiteSupervise != null)
            {
                entite.IdSiteAssocie = SiteSupervise.DbKey;
            }
            if (EquipementLogiqueSupervise != null)
            {
                entite.IdEquipementLogiqueAssocie = EquipementLogiqueSupervise.DbKey;
                entite.IdSiteAssocie = EquipementLogiqueSupervise.Site.DbKey;
            }
            if (LienReseauSupervise != null)
            {
                entite.IdLienReseauAssocie = LienReseauSupervise.DbKey;
            }
            HashSet <int> champsCustomFaits = new HashSet <int>();

            foreach (CChampEntiteFromQueryToChampCustom champ in TypeEntiteSnmp.ChampsFromQuery)
            {
                if (champ.IdChampCustom != null)
                {
                    object val = GetValeurChamp(champ.IdChampCustom.Value);
                    entite.SetValeurChamp(champ.Champ.Id, val);
                    champsCustomFaits.Add(champ.IdChampCustom.Value);
                }
            }
            //Ajoute les champs qui ne font pas parti des champs from query
            foreach (CRelationDefinisseurChamp_ChampCustom def in TypeEntiteSnmp.RelationsChampsCustomDefinis)
            {
                if (!champsCustomFaits.Contains(def.ChampCustom.Id))
                {
                    object val = GetValeurChamp(def.ChampCustom.Id);
                    if (def.ChampCustom.TypeDonneeChamp.TypeDonnee == TypeDonnee.tObjetDonneeAIdNumeriqueAuto && val is CObjetDonneeAIdNumerique)
                    {
                        val = ((CObjetDonneeAIdNumerique)val).Id;
                    }
                    entite.SetValeurChamp(def.ChampCustom.Id.ToString(), val);
                }
            }

            //Ajoute les valeurs des champs calculés
            foreach (CFormuleNommee champ in TypeEntiteSnmp.ChampsCalculesPourMediation)
            {
                if (champ.Formule != null)
                {
                    CContexteEvaluationExpression ctx = new CContexteEvaluationExpression(this);
                    CResultAErreur result             = champ.Formule.Eval(ctx);
                    if (result && result.Data != null)
                    {
                        if (result.Data is CObjetDonneeAIdNumerique)
                        {
                            result.Data = ((CObjetDonneeAIdNumerique)result.Data).Id;
                        }
                        entite.SetValeurChamp(champ.Id, result.Data);
                    }
                }
            }
            return(entite);
        }
Пример #13
0
        //-----------------------------------------------------------------------
        //Si idsChampsAMettreAJour est vide, il faut tout mettre à jour
        public CResultAErreur SendToSnmp(bool bOnlyModifiés, params int[] idsChampsAMettreAJour)
        {
            CResultAErreur result = CResultAErreur.True;

            if (TypeEntiteSnmp == null)
            {
                return(result);
            }
            if (TypeEntiteSnmp.ReadOnly)
            {
                result.EmpileErreur(I.T("This is a readonly entity|20127"));
                return(result);
            }
            IEnumerable <CChampEntiteFromQueryToChampCustom> lstChamps = TypeEntiteSnmp.ChampsFromQuery;
            Dictionary <string, object>            lstValeurs          = new Dictionary <string, object>();
            CResultAErreurType <IObjetDeEasyQuery> resObj = TypeEntiteSnmp.FindSourceObjetInQuery( );

            if (!resObj || resObj.DataType == null)
            {
                result.EmpileErreur(resObj.Erreur);
                return(result);
            }

            IObjetDeEasyQuery objetSource = resObj.DataType;
            CEasyQuery        query       = objetSource.Query;

            Dictionary <string, string> dicOIDStringToChamp = new Dictionary <string, string>();
            CEntiteSnmpPourSupervision  ettPourSup          = null;

            foreach (CChampEntiteFromQueryToChampCustom champ in lstChamps)
            {
                if (champ.IdChampCustom != null && (idsChampsAMettreAJour.Length == 0 ||
                                                    idsChampsAMettreAJour.Contains(champ.IdChampCustom.Value)))
                {
                    CRelationElementAChamp_ChampCustom rel = CUtilElementAChamps.GetRelationToChamp(this, champ.IdChampCustom.Value);
                    if (rel != null && (bOnlyModifiés && (rel.Row.RowState == DataRowState.Added || rel.Row.RowState == DataRowState.Modified) ||
                                        !bOnlyModifiés))
                    {
                        object valeur = rel.Valeur;

                        ITableDefinition  table = null;
                        IColumnDefinition col   = null;
                        if (query.FindSource(champ.Champ.ColonneSource, objetSource,
                                             out table,
                                             out col))
                        {
                            CColumnDefinitionSNMP colSnmp = col as CColumnDefinitionSNMP;

                            if (colSnmp != null && !champ.Champ.IsReadOnly)
                            {
                                ISnmpData snmpVal = AbstractTypeAssignment.GetSnmpFromDotNet(colSnmp.SnmpType, valeur);
                                if (snmpVal == null && valeur != null)
                                {
                                    snmpVal = new OctetString(valeur.ToString());
                                }
                                if (snmpVal != null)
                                {
                                    string strIndex = Index;
                                    if (champ.Champ.FormuleIndex != null)
                                    {
                                        if (ettPourSup == null)
                                        {
                                            ettPourSup = GetEntitePourSupervision(TypeEntiteSnmp.GetTypeEntitePourSupervision(null, false));
                                        }
                                        CContexteEvaluationExpression ctx = new CContexteEvaluationExpression(ettPourSup);
                                        CResultAErreur restTmp            = champ.Champ.FormuleIndex.Eval(ctx);
                                        if (restTmp && restTmp.Data != null)
                                        {
                                            strIndex = restTmp.Data.ToString();
                                        }
                                    }
                                    if (!strIndex.StartsWith("."))
                                    {
                                        strIndex = "." + strIndex;
                                    }
                                    lstValeurs[colSnmp.OIDString + strIndex]          = snmpVal;
                                    dicOIDStringToChamp[colSnmp.OIDString + strIndex] = champ.ChampCustom.Nom;
                                }
                            }
                        }
                    }
                }
            }
            if (lstValeurs.Count > 0)
            {
                CInterrogateurSnmp agent = new CInterrogateurSnmp();
                agent.Connexion.Version  = AgentSnmp.SnmpVersion;
                agent.ConnexionIp        = AgentSnmp.SnmpIp;
                agent.ConnexionPort      = AgentSnmp.SnmpPort;
                agent.ConnexionCommunity = AgentSnmp.SnmpCommunaute;
                foreach (KeyValuePair <string, object> kv in lstValeurs)
                {
                    try
                    {
                        CResultAErreur resTmp = agent.Set(kv.Key, kv.Value);

                        if (!resTmp)
                        {
                            string strChamp = null;
                            if (dicOIDStringToChamp.TryGetValue(kv.Key, out strChamp))
                            {
                                result.EmpileErreur(new CErreurValidation(I.T("Entity @1 (@2), Field @3 : |20105", Libelle, Index, strChamp) + resTmp.Erreur.ToString(), resTmp.IsAvertissement));
                            }
                            else
                            {
                                result.EmpileErreur(resTmp.Erreur);
                            }
                            if (!result.IsAvertissement)
                            {
                                return(result);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        result.EmpileErreur(new CErreurException(e));
                    }
                }
            }
            return(result);
        }