예제 #1
0
        //----------------------------------------------------------------------------------------------
        private void StopAlarme(int?nIdAlarme)
        {
            if (nIdAlarme == null)
            {
                return;
            }

            // Traitement de l'état opérationnel des schémas
            CSpvAlarmeDonnee alarmeData = new CSpvAlarmeDonnee(ContexteDonnee);

            if (alarmeData.ReadIfExists(nIdAlarme.Value))
            {
                List <CElementDeArbreOperationnel> listeNoeudsConcernes = new List <CElementDeArbreOperationnel>();
                if (alarmeData.EquipId != null)
                {
                    m_dicEquipementToNoeudArbreOp.TryGetValue(alarmeData.EquipId.Value, out listeNoeudsConcernes);
                }
                else if (alarmeData.SiteId != null)
                {
                    m_dicSiteToNoeudArbreOp.TryGetValue(alarmeData.SiteId.Value, out listeNoeudsConcernes);
                }
                else if (alarmeData.LiaiId != null)
                {
                    m_dicLiaisonToNoeudArbreOp.TryGetValue(alarmeData.LiaiId.Value, out listeNoeudsConcernes);
                }

                // Passe tous les coef opérationnels à 1 = OK
                PropageCoefOperationnel(listeNoeudsConcernes, 1.0);
            }


            List <CInfoElementDeSchemaSupervise> lst = null;

            if (m_dicAlarmeToElementsConcernes.TryGetValue((int)nIdAlarme, 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(nIdAlarme.Value);
                        CInfoElementDeSchemaSupervise parent = info.Parent;
                        if (parent != null)
                        {
                            lstAPrevenir.Add(parent);
                        }
                    }
                }
            }

            if (lst != null && lst.Count > 0)
            {
                Refresh();
            }
        }
예제 #2
0
        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).IdEquipementSpv.Value, out listeNoeudsConcernes);
                        }
                        else if (info is CInfoSiteDeSchemaSupervise)
                        {
                            m_dicSiteToNoeudArbreOp.TryGetValue(((CInfoSiteDeSchemaSupervise)info).IdSiteSpv.Value, out listeNoeudsConcernes);
                        }
                        else if (info is CInfoLienDeSchemaSupervise)
                        {
                            m_dicLiaisonToNoeudArbreOp.TryGetValue(((CInfoLienDeSchemaSupervise)info).IdLienSpv.Value, out listeNoeudsConcernes);
                        }
                        else if (info is CInfoSchemaDeSchemaSupervise)
                        {
                            m_dicServiceToNoeudArbreOp.TryGetValue(((CInfoSchemaDeSchemaSupervise)info).IdSchemaSpv, out listeNoeudsConcernes);
                        }

                        if (listeNoeudsConcernes != null)
                        {
                            PropageCoefOperationnel(listeNoeudsConcernes, fCoef);
                        }
                    }
                }
            }
        }