private static void MajSpvLiaiLiaiC(CElementDeSchemaReseau element) { if (element == null) { return; } if (element.LienReseau != null && element.SchemaReseau != null && element.SchemaReseau.LienReseau != null) { //C'est une dépendance de lien à lien //Cherche si la dépendance existe déjà CSpvLiai_Liaic dep = new CSpvLiai_Liaic(element.ContexteDonnee); CSpvLiai liaiSupportée = null; if (CSpvLiai.CanSupervise(element.SchemaReseau.LienReseau)) { liaiSupportée = CSpvLiai.GetObjetSpvFromObjetTimosAvecCreation(element.SchemaReseau.LienReseau); } CSpvLiai liaiSupportant = null; if (CSpvLiai.CanSupervise(element.LienReseau)) { liaiSupportant = CSpvLiai.GetObjetSpvFromObjetTimosAvecCreation(element.LienReseau); } if (liaiSupportée != null && liaiSupportant != null) { if (!dep.ReadIfExists(new CFiltreData(CSpvLiai_Liaic.c_champIdLiaisonSupportée + "=@1 and " + CSpvLiai_Liaic.c_champIdLiaisonSupportant + "=@2", liaiSupportée.Id, liaiSupportant.Id))) { dep.CreateNewInCurrentContexte(new object[] { liaiSupportée.Id, liaiSupportant.Id }); } } } }
public CInfoElementAEtatOperationnelDeSchemaSupervise( CInfoElementDeSchemaSupervise parent, CElementDeSchemaReseau eltDeSchema, CBasePourVueAnimee basePourVue) : base(parent, eltDeSchema, basePourVue) { }
//-------------------------------------------------------------------- private void RefreshVueSupervision(List <int> lstIdElements) { if (lstIdElements == null) { Invalidate(null, true); } else { if (m_stackCheminsReseau.Peek() != null) { CSchemaReseau schema = m_stackCheminsReseau.Peek(); CListeObjetsDonnees lstElements = schema.ElementsDeSchema; foreach (int nId in lstIdElements) { lstElements.Filtre = new CFiltreData(CElementDeSchemaReseau.c_champId + "=@1", nId); lstElements.InterditLectureInDB = true; if (lstElements.Count != 0) { CElementDeSchemaReseau elt = lstElements[0] as CElementDeSchemaReseau; if (elt != null) { Rectangle rct = new Rectangle( GetScreenPoint(new Point(elt.X - 15, elt.Y - 15), true), GetScreenSize(new Size(elt.Width + 30, elt.Height + 30))); Invalidate(rct, true); } } } } } }
public C2iObjetDeSchema GetObjetDeSchema(CElementDeSchemaReseau elementDeSchema) { C2iObjetDeSchema objet = new C2iObjetDeSchema(); C2iSymbole symbole = SymboleADessiner; objet.ElementDeSchema = elementDeSchema; return(objet); }
public CInfoSiteDeSchemaSupervise( CInfoElementDeSchemaSupervise parent, CElementDeSchemaReseau eltDeSchema, CBasePourVueAnimee basePourVue, int nNiveauProfondeur) : base(parent, eltDeSchema, basePourVue, nNiveauProfondeur) { }
public static void PropagerDependanceLien(CContexteDonnee contexte, Hashtable tableData, ref CResultAErreur result) { DataTable dt = contexte.Tables[CElementDeSchemaReseau.c_nomTable]; if (dt != null) { ArrayList rows = new ArrayList(dt.Rows); foreach (DataRow row in rows) { if (row.RowState != DataRowState.Unchanged) { CElementDeSchemaReseau element = new CElementDeSchemaReseau(row); switch (row.RowState) { case DataRowState.Added: case DataRowState.Modified: if (element != null && element.LienReseau != null && element.SchemaReseau != null && element.SchemaReseau.LienReseau != null) { //Il s'agit bien d'une liaison dans une liaisons MajSpvLiaiLiaiC(element); } break; case DataRowState.Deleted: element.VersionToReturn = DataRowVersion.Original; CLienReseau lienSupportant = element.LienReseau; if (lienSupportant != null && lienSupportant.IsValide()) { CSchemaReseau schema = element.SchemaReseau; if (schema.Row.RowState == DataRowState.Deleted) { schema.VersionToReturn = DataRowVersion.Original; } CLienReseau lienSupporte = schema.LienReseau; if (lienSupporte != null && lienSupporte.IsValide()) //Il s'agit bien d'un élément support/supportant { CSpvLiai liaiSupportant = CSpvLiai.GetSpvLiaiFromLienReseau(lienSupportant) as CSpvLiai; if (liaiSupportant != null) { liaiSupportant.UpdateSupportés(); } } } break; default: break; } } } } }
internal virtual void InitFromElementDeSchema(CElementDeSchemaReseau elementDeSchema) { if (elementDeSchema != null) { m_base.SetInfoPourElementDeSchema(this, elementDeSchema.Id); } m_dicEquipementsSpvConcernant.Clear(); m_dicSitesSpvConcernant.Clear(); m_dicLiaisonsSpvConcernant.Clear(); m_dicServicesSpvConcernant.Clear(); m_listeFils.Clear(); }
//------------------------------------ public CInfoElementDeSchemaSupervise( CInfoElementDeSchemaSupervise parent, CElementDeSchemaReseau eltDeSchema, CBasePourVueAnimee basePourVue, int nNiveauProfondeur) { m_parent = parent; if (eltDeSchema != null) { m_nIdElementDeSchema = eltDeSchema.Id; } m_base = basePourVue; m_nNiveauProfondeur = nNiveauProfondeur; }
void m_menuShowDiagram_Click(object sender, EventArgs e) { if (m_objetDeSchemaSelectionne == null) { return; } CElementDeSchemaReseau eltDeSchema = m_objetDeSchemaSelectionne.ElementDeSchema; if (eltDeSchema != null) { if (eltDeSchema.ElementAssocie != null) { DrillDown(eltDeSchema.ElementAssocie); } } }
/// <summary> /// Initialise l'objet à partir d'un schéma /// </summary> /// <param name="schema"></param> internal override void InitFromElementDeSchema(CElementDeSchemaReseau elt) { base.InitFromElementDeSchema(elt); CSchemaReseau schema = elt.SchemaReseauContenu; if (schema == null) { schema = elt.SchemaReseauInclus; } if (schema == null) { throw new Exception("Bad element for supervision data "); } InitFromSchema(schema); }
public List <CInfoAlarmeAffichee> GetAlarmesPourElement(CElementDeSchemaReseau element) { List <CInfoAlarmeAffichee> lst = new List <CInfoAlarmeAffichee>(); CInfoElementDeSchemaSupervise info = null; if (m_dicElementDeSchemaToInfoSupervision.TryGetValue(element.Id, out info)) { foreach (int nId in info.GetIdsAlarmesEnCours()) { CInfoAlarmeAffichee alarme = null; if (m_dicAlarmes.TryGetValue(nId, out alarme)) { lst.Add(alarme); } } } return(lst); }
internal override void InitFromElementDeSchema(CElementDeSchemaReseau elementDeSchema) { base.InitFromElementDeSchema(elementDeSchema); CEquipementLogique eqtLogique = elementDeSchema.EquipementLogique; if (eqtLogique == null) //Ca ne doit jamais arriver { throw new Exception("Bad element for supervision data "); } m_dbKeyEquipement = eqtLogique.DbKey; m_dicEquipementsConcernant[eqtLogique.DbKey] = true; CDonneeDessinElementDeSchemaReseau donneeDessin = elementDeSchema.DonneeDessin as CDonneeDessinElementDeSchemaReseau; if (donneeDessin != null && donneeDessin.CollectChildsAlarms) { SoitConcernePar(eqtLogique.EquipementsLogiquesContenus); } }
internal override void InitFromElementDeSchema(CElementDeSchemaReseau elementDeSchema) { base.InitFromElementDeSchema(elementDeSchema); CEntiteSnmp ettSnmp = elementDeSchema.EntiteSnmp; if (ettSnmp == null) //Ca ne doit jamais arriver { throw new Exception("Bad element for supervision data "); } m_dbKeyEntiteSnmp = ettSnmp.DbKey; m_dicEntitesSnmpConcernant[ettSnmp.DbKey] = true; CDonneeDessinElementDeSchemaReseau donneeDessin = elementDeSchema.DonneeDessin as CDonneeDessinElementDeSchemaReseau; if (donneeDessin != null && donneeDessin.CollectChildsAlarms) { SoitConcernePar(ettSnmp.EntiteSnmpsFilles); } }
//----------------------------- private void m_panelDessin_MouseDoubleClick(object sender, MouseEventArgs e) { List <C2iObjetDeSchema> lst = GetObjetsFromPoint(new Point(e.X, e.Y)); if (lst.Count > 0) { foreach (C2iObjetDeSchema objetDeSchema in lst) { CElementDeSchemaReseau elementDeSchema = objetDeSchema.ElementDeSchema; if (elementDeSchema != null) { IElementDeSchemaReseau elt = elementDeSchema.ElementAssocie; if (DrillDown(elt)) { return; } } } } }
internal override void InitFromElementDeSchema(CElementDeSchemaReseau eltDeSchema) { base.InitFromElementDeSchema(eltDeSchema); CSite site = eltDeSchema.Site; if (site == null) { throw new Exception("Bad element for supervision data "); } InitForSite(site); //Cherche les cablages pour ce site foreach (CSchemaReseau sousSchema in eltDeSchema.SchemaReseau.SchemaFils) { if (site.Equals(sousSchema.SiteApparenance)) { CInfoSchemaDeSchemaSupervise info = new CInfoSchemaDeSchemaSupervise(this, eltDeSchema, m_base, NiveauProfondeur + 1); m_listeFils.Add(info); info.InitFromSchema(sousSchema); break; } } }
private void m_menuRightClick_Opening(object sender, CancelEventArgs e) { m_menuAlarmes.Visible = false; m_menuShowDiagram.Visible = false; m_menuShowProperties.Visible = false; if (m_objetDeSchemaSelectionne != null) { CElementDeSchemaReseau eltDeSchema = m_objetDeSchemaSelectionne.ElementDeSchema; if (eltDeSchema != null) { IElementDeSchemaReseau elt = eltDeSchema.ElementAssocie; if (elt != null) { m_menuShowProperties.Visible = true; } m_menuAlarmes.DropDownItems.Clear(); if (elt is CSchemaReseau || elt is CLienReseau) { m_menuShowDiagram.Visible = true; } List <CLocalAlarme> lstAlarmes = m_baseVue.GetAlarmesPourElement(eltDeSchema); if (lstAlarmes.Count == 0) { m_menuAlarmes.Visible = false; } else { lstAlarmes.Sort(new CSorterAlarmes()); foreach (CLocalAlarme alarme in lstAlarmes) { CMenuItemAvecAlarme menu = new CMenuItemAvecAlarme(alarme); menu.Click += new EventHandler(menu_Click); m_menuAlarmes.DropDownItems.Add(menu); } m_menuAlarmes.Visible = true; } } } }
//------------------------------------------------------------------- public override CResultAErreur VerifieDonnees(CObjetDonnee objet) { CResultAErreur result = CResultAErreur.True; try { CElementDeSchemaReseau elt = (CElementDeSchemaReseau)objet; //S'agit-il d'un lien supportant ? if (elt.LienReseau != null && elt.SchemaReseau.LienReseau != null) { if (!elt.SchemaReseau.LienReseau.TypeSupportantPossible(elt.LienReseau)) { string strType1 = elt.SchemaReseau.LienReseau.TypeLienReseau != null ? elt.SchemaReseau.LienReseau.TypeLienReseau.Libelle: I.T("No type|20010"); string strType2 = elt.LienReseau.TypeLienReseau != null ? elt.LienReseau.TypeLienReseau.Libelle: I.T("No type|20010"); result.EmpileErreur(I.T("Link of type @1 can not be supported by link of type @2|30025", elt.SchemaReseau.LienReseau.TypeLienReseau.Libelle, elt.LienReseau.TypeLienReseau.Libelle)); } if (!elt.SchemaReseau.LienReseau.PeutEtreSupporte(elt.LienReseau)) { result.EmpileErreur(I.T("Link @1 is supported by @2, and @2 is supported by @1|20042", elt.SchemaReseau.LienReseau.Libelle, elt.LienReseau.Libelle)); } } } catch (Exception e) { result.EmpileErreur(new CErreurException(e)); } return(result); }
internal override void InitFromElementDeSchema(CElementDeSchemaReseau elementDeSchema) { base.InitFromElementDeSchema(elementDeSchema); CEquipementLogique eqtLogique = elementDeSchema.EquipementLogique; if (eqtLogique == null) //Ca ne doit jamais arriver { throw new Exception("Bad element for supervision data "); } CSpvEquip equip = CSpvEquip.GetObjetSpvFromObjetTimos(eqtLogique); if (equip != null) { m_dicEquipementsSpvConcernant[equip.Id] = true; m_nIdEquipementSpv = equip.Id; } CDonneeDessinElementDeSchemaReseau donneeDessin = elementDeSchema.DonneeDessin as CDonneeDessinElementDeSchemaReseau; if (donneeDessin != null && donneeDessin.CollectChildsAlarms) { SoitConcernePar(eqtLogique.EquipementsLogiquesContenus); } }
private void m_menuShowProperties_Click(object sender, EventArgs e) { if (m_objetDeSchemaSelectionne == null) { return; } CElementDeSchemaReseau eltDeSchema = m_objetDeSchemaSelectionne.ElementDeSchema; if (eltDeSchema != null) { if (eltDeSchema.ElementAssocie != null) { CReferenceTypeForm refTypeForm = CFormFinder.GetRefFormToEdit(eltDeSchema.ElementAssocie.GetType()); if (refTypeForm != null) { IFormNavigable form = refTypeForm.GetForm(eltDeSchema.ElementAssocie as CObjetDonneeAIdNumeriqueAuto) as IFormNavigable; if (form != null && m_navigateur != null) { m_navigateur.AffichePage(form); } } } } }
internal override void InitFromElementDeSchema(CElementDeSchemaReseau elementDeSchema) { base.InitFromElementDeSchema(elementDeSchema); CLienReseau lien = elementDeSchema.LienReseau; if (lien == null) { throw new Exception("Bad element for supervision data "); } m_nIdLienSmt = lien.Id; CSpvLiai liaisonSpv = CSpvLiai.GetObjetSpvFromObjetTimos(lien); if (liaisonSpv != null) { m_dicLiaisonsSpvConcernant[liaisonSpv.Id] = true; m_nIdLienSpv = liaisonSpv.Id; } /* */ CSchemaReseau schemaDeLiaison = lien.SchemaReseau; if (schemaDeLiaison != null) { CInfoSchemaDeSchemaSupervise info = new CInfoSchemaDeSchemaSupervise(this, null, m_base, NiveauProfondeur + 1); m_listeFils.Add(info); info.InitFromSchema(schemaDeLiaison); } //Si pas de schéma ou que le schéma ne contient pas les sites bool bHasElement1 = false; bool bHasElement2 = false; IElementALiensReseau elt1 = lien.Element1; IElementALiensReseau elt2 = lien.Element2; if (schemaDeLiaison != null) { foreach (CElementDeSchemaReseau elt in schemaDeLiaison.ElementsDeSchema) { IElementALiensReseau eltAssocie = elt.ElementAssocie as IElementALiensReseau; if (eltAssocie != null && eltAssocie.Equals(elt1)) { bHasElement1 = true; } if (eltAssocie != null && eltAssocie.Equals(elt2)) { bHasElement2 = true; } if (bHasElement1 && bHasElement2) { break; } } } CSpvSite site = new CSpvSite(m_base.ContexteDonnee); CSpvEquip equip = new CSpvEquip(m_base.ContexteDonnee); if (!bHasElement1) { if (elt1 is CSite) { if (site.ReadIfExists(new CFiltreData(CSpvSite.c_champSmtSite_Id + "=@1", elt1.Id), false)) { m_dicSitesSpvConcernant[site.Id] = true; } } else if (elt1 is CEquipementLogique) { if (equip.ReadIfExists(new CFiltreData(CSpvEquip.c_champSmtEquipementLogique_Id + "=@1", elt1.Id), false)) { m_dicEquipementsSpvConcernant[equip.Id] = true; } } } if (!bHasElement2) { if (elt2 is CSite) { if (site.ReadIfExists(new CFiltreData(CSpvSite.c_champSmtSite_Id + "=@1", elt2.Id), false)) { m_dicSitesSpvConcernant[site.Id] = true; } } else if (elt2 is CEquipementLogique) { if (equip.ReadIfExists(new CFiltreData(CSpvEquip.c_champSmtEquipementLogique_Id + "=@1", elt2.Id), false)) { m_dicEquipementsSpvConcernant[equip.Id] = true; } } } }
internal override void InitFromElementDeSchema(CElementDeSchemaReseau elementDeSchema) { base.InitFromElementDeSchema(elementDeSchema); CLienReseau lien = elementDeSchema.LienReseau; if (lien == null) { throw new Exception("Bad element for supervision data "); } m_dbKeyLien = lien.DbKey; CSchemaReseau schemaDeLiaison = lien.SchemaReseau; if (schemaDeLiaison != null) { CInfoSchemaDeSchemaSupervise info = new CInfoSchemaDeSchemaSupervise(this, null, m_base, NiveauProfondeur + 1); m_listeFils.Add(info); info.InitFromSchema(schemaDeLiaison); } //Si pas de schéma ou que le schéma ne contient pas les sites bool bHasElement1 = false; bool bHasElement2 = false; IElementALiensReseau elt1 = lien.Element1; IElementALiensReseau elt2 = lien.Element2; if (schemaDeLiaison != null) { foreach (CElementDeSchemaReseau elt in schemaDeLiaison.ElementsDeSchema) { IElementALiensReseau eltAssocie = elt.ElementAssocie as IElementALiensReseau; if (eltAssocie != null && eltAssocie.Equals(elt1)) { bHasElement1 = true; } if (eltAssocie != null && eltAssocie.Equals(elt2)) { bHasElement2 = true; } if (bHasElement1 && bHasElement2) { break; } } } IElementALiensReseau extremite = lien.Element1; if (extremite is CSite) { m_dicSitesConcernant[extremite.DbKey] = true; } if (extremite is CEquipementLogique) { m_dicEquipementsConcernant[extremite.DbKey] = true; } extremite = lien.Element2; if (extremite is CSite) { m_dicSitesConcernant[extremite.DbKey] = true; } if (extremite is CEquipement) { m_dicEquipementsConcernant[extremite.DbKey] = true; } m_dicLiaisonsConcernant[lien.DbKey] = true; }
////////////////////////////////////////////////////////////////// private static void SynchroSchemaToSpv( CContexteDonnee contexte, Hashtable tableData, ref CResultAErreur result) { if (!result) { return; } //Empèche de passer plusieurs fois if (tableData.ContainsKey(typeof(CSynchroniseurSchemaEtGraphe))) { return; } //Pour empecher de passer plusieurs fois tableData[typeof(CSynchroniseurSchemaEtGraphe)] = true; //S'assure que les liens sont biens créés et que leurs schémas aussi ! CSpvLiaiServeur.PropagerCLienReseau(contexte, tableData, ref result); if (!result) { return; } //Crée les services correspondants aux schémas modifiés //Toute modification d'un schéma est une modification du schéma auquel il appartient CListeObjetsDonnees lstSchemas = new CListeObjetsDonnees(contexte, typeof(CSchemaReseau), false); lstSchemas.InterditLectureInDB = true; foreach (CSchemaReseau schema in lstSchemas.ToArrayList()) { CSchemaReseau tmp = schema; while (tmp != null && tmp.Row.RowState == DataRowState.Modified) { tmp = tmp.SchemaParent; if (tmp != null) { tmp.ForceChangementSyncSession(); } } } DataTable table = contexte.Tables[CSchemaReseau.c_nomTable]; if (table == null) { //S'il n'y a pas de schéma, mais qu'il y a des éléments de schéma, //force la vérification des schémas if (contexte.Tables.Contains(CElementDeSchemaReseau.c_nomTable)) { table = contexte.GetTableSafe(CSchemaReseau.c_nomTable); } } if (table != null) { #region Recherche des schémas modifiés ArrayList lst = new ArrayList(table.Rows); //Cherche les schémas à vérifier Dictionary <DataRow, bool> dicSchemasAVerifier = new Dictionary <DataRow, bool>(); foreach (DataRow row in lst) { if (row.RowState == DataRowState.Modified || row.RowState == DataRowState.Added) { dicSchemasAVerifier[row] = true; } } DataTable tableElts = contexte.Tables[CElementDeSchemaReseau.c_nomTable]; if (tableElts != null) { lst = new ArrayList(tableElts.Rows); foreach (DataRow row in lst) { if (row.RowState == DataRowState.Added || row.RowState == DataRowState.Modified || row.RowState == DataRowState.Deleted) { CElementDeSchemaReseau elt = new CElementDeSchemaReseau(row); if (row.RowState == DataRowState.Deleted) { elt.VersionToReturn = DataRowVersion.Original; } CSchemaReseau schema = elt.SchemaReseau; if (schema != null && schema.IsValide()) { dicSchemasAVerifier[schema.Row] = true; } while (schema != null && schema.IsValide() && schema.SchemaParent != null) { dicSchemasAVerifier[schema.SchemaParent.Row] = true; schema = schema.SchemaParent; } } } } #endregion //Passe sur tous les schémas modifiés foreach (DataRow row in dicSchemasAVerifier.Keys) { #region Création du service, création des cablages CSchemaReseau schema = new CSchemaReseau(row); //Synchronisation du service avec le schéma CSpvSchemaReseau spvSchema = CSpvSchemaReseau.GetObjetSpvFromObjetTimosAvecCreation(schema); //Si le schéma correspond à un lien, force la modification de ce lien //Pour passer dans le traitement avant sauvegarde du lien if (schema.LienReseau != null) { if (schema.LienReseau.Row.RowState == DataRowState.Unchanged) { schema.LienReseau.ForceChangementSyncSession();//Force la modification du lien pour qu'il soit resynchronisé } } #endregion } } //Pour tous les schémas qui ont des éléments modifiés, s'assure que les //Graphes des services concernés sont à jour //Id de schéma -> true Dictionary <int, bool> schemasAGrapheObsolete = new Dictionary <int, bool>(); table = contexte.Tables[CElementDeSchemaReseau.c_nomTable]; if (table != null) { ArrayList lstRows = new ArrayList(table.Rows); foreach (DataRow row in lstRows) { if (row.RowState == DataRowState.Added || row.RowState == DataRowState.Deleted) { CElementDeSchemaReseau elt = new CElementDeSchemaReseau(row); DataRowVersion version = DataRowVersion.Current; if (row.RowState == DataRowState.Deleted) { version = DataRowVersion.Original; } schemasAGrapheObsolete[(int)row[CElementDeSchemaReseau.c_champIdSchemaReseauAuquelJappartiens, version]] = true; } } } table = contexte.Tables[CSchemaReseau.c_nomTable]; if (table != null) { ArrayList lstRows = new ArrayList(table.Rows); foreach (DataRow row in lstRows) { if (row.RowState == DataRowState.Added || row.RowState == DataRowState.Modified) { schemasAGrapheObsolete[(int)row[CSchemaReseau.c_champId]] = true; } } } CBaseGraphesReseau baseGraphes = new CBaseGraphesReseau(); foreach (int nIdSchema in schemasAGrapheObsolete.Keys) { CSchemaReseau schema = new CSchemaReseau(contexte); if ( schema.ReadIfExists(nIdSchema) && schema.IsValide() && (schema.SchemaParent == null || schema.SiteApparenance != null)) //Ne calcule pas les graphes des schémas fils, ils sont déjà integrés dans le graphe du schéma parent! { CSpvSchemaReseau spvSchema = CSpvSchemaReseau.GetObjetSpvFromObjetTimosAvecCreation(schema); if (spvSchema != null) { result = spvSchema.RecalculeArbreOperationnelInContexte(baseGraphes); if (!result) { return; } } } } }