//---------------------------------------------------------------------------------------------- public void SetInfoPourElementDeSchema(CInfoElementDeSchemaSupervise info, int nIdElementDeSchema) { m_dicElementDeSchemaToInfoSupervision[nIdElementDeSchema] = info; if (AfterLoadElement != null) { AfterLoadElement(nIdElementDeSchema); } }
public CInfoLienDeSchemaSupervise( CInfoElementDeSchemaSupervise parent, CElementDeSchemaReseau eltDeSchema, CBasePourVueAnimee basePourVue, int nNiveauProfondeur) : base(parent, eltDeSchema, basePourVue, nNiveauProfondeur) { }
//---------------------------------------------------------------------------------------------- public void OnChangementEtatSupervise(CInfoElementDeSchemaSupervise info) { lock (typeof(CLockerRefresh)) { if (info.IdElementDeSchema != null) { m_dicChangesDepuisDernierRefresh[info.IdElementDeSchema.Value] = true; } } }
public void InitFromSchema(CSchemaReseau schema) { m_dbKeySchemaReseau = schema.DbKey; m_schema = schema; CListeObjetsDonnees lstElements = schema.ElementsDeSchema; lstElements.ReadDependances( "SchemaReseauInclu", "SchemaReseauContenu"); foreach (CElementDeSchemaReseau elt in lstElements) { IElementDeSchemaReseau elementFils = elt.ElementAssocie; if (elementFils != null) { CInfoElementDeSchemaSupervise fils = null; if (elementFils is CSite) { fils = new CInfoSiteDeSchemaSupervise(this, elt, m_base, NiveauProfondeur + 1); } if (elementFils is CLienReseau) { fils = new CInfoLienDeSchemaSupervise(this, elt, m_base, NiveauProfondeur + 1); } if (elementFils is CElementDeSchemaReseau) { fils = new CInfoEquipementDeSchemaSupervise(this, elt, m_base, NiveauProfondeur + 1); } if (elementFils is CSchemaReseau) { fils = new CInfoSchemaDeSchemaSupervise(this, elt, m_base, NiveauProfondeur + 1); } if (elementFils is CEquipementLogique) { fils = new CInfoEquipementDeSchemaSupervise(this, elt, m_base, NiveauProfondeur + 1); } if (elementFils is CEntiteSnmp) { fils = new CInfoEntiteSnmpDeSchemaSupervise(this, elt, m_base, NiveauProfondeur + 1); } if (elementFils != null) { fils.InitFromElementDeSchema(elt); m_listeFils.Add(fils); } } } PrepareSupervisionEtatOperationnel(schema); CalculArbreOperationnel(); }
private void FillListeConcernes(CInfoElementDeSchemaSupervise info, List <CReferenceObjetDonnee> lst) { CReferenceObjetDonnee reference = info.GetReferenceObjetAssocie(); if (reference != null) { lst.Add(reference); } foreach (CInfoElementDeSchemaSupervise infoFils in info.ListeFils) { FillListeConcernes(infoFils, lst); } }
//---------------------------------------------------------------------------------------------- private void StopAlarme(CLocalAlarme alarme) { // Traitement de l'état opérationnel des schémas List <CElementDeArbreOperationnel> listeNoeudsConcernes = new List <CElementDeArbreOperationnel>(); if (alarme.EquipementId != null) { m_dicEquipementToNoeudArbreOp.TryGetValue(alarme.EquipementId, out listeNoeudsConcernes); } else if (alarme.SiteId != null) { m_dicSiteToNoeudArbreOp.TryGetValue(alarme.SiteId, out listeNoeudsConcernes); } else if (alarme.LienId != null) { m_dicLiaisonToNoeudArbreOp.TryGetValue(alarme.LienId, out listeNoeudsConcernes); } // Passe tous les coef opérationnels à 1 = OK PropageCoefOperationnel(listeNoeudsConcernes, 1.0); List <CInfoElementDeSchemaSupervise> lst = null; if (m_dicAlarmeToElementsConcernes.TryGetValue(alarme.Id, out lst)) { List <CInfoElementDeSchemaSupervise> lstAPrevenir = new List <CInfoElementDeSchemaSupervise>(lst); while (lstAPrevenir.Count != 0) { lstAPrevenir.Sort(); CInfoElementDeSchemaSupervise[] infos = lstAPrevenir.ToArray(); lstAPrevenir.Clear(); foreach (CInfoElementDeSchemaSupervise info in infos) { info.StopAlarme(alarme.Id); CInfoElementDeSchemaSupervise parent = info.Parent; if (parent != null) { lstAPrevenir.Add(parent); } } } } if (lst != null && lst.Count > 0) { Refresh(); } }
public bool DoDessinSupplementaireAfter(CContextDessinObjetGraphique ctx, C2iObjetGraphique objet) { C2iObjetDeSchema objetDeSchema = objet as C2iObjetDeSchema; if (objetDeSchema == null || objetDeSchema.ElementDeSchema == null) { return(true); } CInfoElementDeSchemaSupervise infoSupervision = null; if (!m_dicElementDeSchemaToInfoSupervision.TryGetValue(objetDeSchema.ElementDeSchema.Id, out infoSupervision)) { return(true); } infoSupervision.AfterDrawObjet(ctx, objetDeSchema); return(true); }
public List <CLocalAlarme> GetAlarmesPourElement(CElementDeSchemaReseau element) { List <CLocalAlarme> lst = new List <CLocalAlarme>(); CInfoElementDeSchemaSupervise info = null; if (m_dicElementDeSchemaToInfoSupervision.TryGetValue(element.Id, out info)) { foreach (string strId in info.GetIdsAlarmesEnCours()) { CLocalAlarme alarme = null; if (m_dicAlarmes.TryGetValue(strId, out alarme)) { lst.Add(alarme); } } } return(lst); }
public bool DoDessinSupplementaireBefore(CContextDessinObjetGraphique ctx, C2iObjetGraphique objet) { C2iLienDeSchemaReseau dessinLien = objet as C2iLienDeSchemaReseau; if (dessinLien == null) //Optim : seuls les liens sont dessinés avant. Pour le moment, les autres non { return(true); } //Dessine sous les segments CInfoElementDeSchemaSupervise infoSupervision = null; if (!m_dicElementDeSchemaToInfoSupervision.TryGetValue(dessinLien.ElementDeSchema.Id, out infoSupervision)) { return(true); } infoSupervision.BeforeDrawObjet(ctx, dessinLien); return(true); }
private void PropageCoefOperationnel(List <CElementDeArbreOperationnel> listeNoeudsConcernes, double fCoef) { // Passe tous les coef opérationnels à 0 = HS if (listeNoeudsConcernes != null) { foreach (CElementDeArbreOperationnel node in listeNoeudsConcernes) { node.SetCoeffOperationnel(fCoef); node.RecalculeCoefOperationnelFromChilds(); CElementDeArbreOperationnel nodeParent = node; while (nodeParent.ElementParent != null) { nodeParent = nodeParent.ElementParent; } CInfoElementDeSchemaSupervise info = null; if (m_dicNoeudArbreRacineToInfoElement.TryGetValue(nodeParent, out info)) { if (info is CInfoEquipementDeSchemaSupervise) { m_dicEquipementToNoeudArbreOp.TryGetValue(((CInfoEquipementDeSchemaSupervise)info).IdEquipement, out listeNoeudsConcernes); } else if (info is CInfoSiteDeSchemaSupervise) { m_dicSiteToNoeudArbreOp.TryGetValue(((CInfoSiteDeSchemaSupervise)info).IdSite, out listeNoeudsConcernes); } else if (info is CInfoLienDeSchemaSupervise) { m_dicLiaisonToNoeudArbreOp.TryGetValue(((CInfoLienDeSchemaSupervise)info).IdLien, out listeNoeudsConcernes); } else if (info is CInfoSchemaDeSchemaSupervise) { m_dicServiceToNoeudArbreOp.TryGetValue(((CInfoSchemaDeSchemaSupervise)info).IdSchema, out listeNoeudsConcernes); } if (listeNoeudsConcernes != null) { PropageCoefOperationnel(listeNoeudsConcernes, fCoef); } } } } }
//---------------------------------------------------------------------------------------------- private void StartAlarme(CLocalAlarme infoAlarme) { m_dicAlarmes[infoAlarme.Id] = infoAlarme; // Traitement de l'état opérationnel des schémas List <CElementDeArbreOperationnel> listeNoeudsConcernes = new List <CElementDeArbreOperationnel>(); if (infoAlarme.EquipementId != null) { m_dicEquipementToNoeudArbreOp.TryGetValue(infoAlarme.EquipementId, out listeNoeudsConcernes); } else if (infoAlarme.SiteId != null) { m_dicSiteToNoeudArbreOp.TryGetValue(infoAlarme.SiteId, out listeNoeudsConcernes); } else if (infoAlarme.LienId != null) { m_dicLiaisonToNoeudArbreOp.TryGetValue(infoAlarme.LienId, out listeNoeudsConcernes); } if (infoAlarme.MasquageApplique == null || infoAlarme.MasquageHerite.Priorite <= this.NiveauMasquageMaxAffiche) { PropageCoefOperationnel(listeNoeudsConcernes, infoAlarme.IsHS ? 0 : 0.5); } else { PropageCoefOperationnel(listeNoeudsConcernes, 1); } List <CInfoElementDeSchemaSupervise> lstConcernes = new List <CInfoElementDeSchemaSupervise>(); List <CInfoElementDeSchemaSupervise> lst = null; if (infoAlarme.EquipementId != null) { m_dicDirectementConcernesParEquipement.TryGetValue(infoAlarme.EquipementId, out lst); if (lst != null) { lstConcernes.AddRange(lst); } } if (infoAlarme.LienId != null) { m_dicDirectementConcernesParLiaison.TryGetValue(infoAlarme.LienId, out lst); if (lst != null) { lstConcernes.AddRange(lst); } } if (infoAlarme.EntiteSnmpId != null) { m_dicDirectementConcernesParEntiteSnmp.TryGetValue(infoAlarme.EntiteSnmpId, out lst); if (lst != null) { lstConcernes.AddRange(lst); } } if (infoAlarme.SiteId != null && infoAlarme.EquipementId == null && infoAlarme.EntiteSnmpId == null) { m_dicDirectementConcernesParSite.TryGetValue(infoAlarme.SiteId, out lst); if (lst != null) { lstConcernes.AddRange(lst); } } Dictionary <CInfoElementDeSchemaSupervise, bool> dicConcernes = new Dictionary <CInfoElementDeSchemaSupervise, bool>(); if (lstConcernes != null) { List <CInfoElementDeSchemaSupervise> lstAPrevenir = new List <CInfoElementDeSchemaSupervise>(lstConcernes); bool bFirstNiveau = true; while (lstAPrevenir.Count != 0) { lstAPrevenir.Sort(); CInfoElementDeSchemaSupervise[] infos = lstAPrevenir.ToArray(); lstAPrevenir.Clear(); foreach (CInfoElementDeSchemaSupervise info in infos) { if (bFirstNiveau) { dicConcernes[info] = true; } info.StartAlarme(infoAlarme, !bFirstNiveau); CInfoElementDeSchemaSupervise parent = info.Parent; if (parent != null) { lstAPrevenir.Add(parent); } } bFirstNiveau = false; } if (lstConcernes.Count > 0) { Refresh(); } } lst = new List <CInfoElementDeSchemaSupervise>(); lst.AddRange(dicConcernes.Keys); m_dicAlarmeToElementsConcernes[infoAlarme.Id] = lst; }