//----------------------------------------------- void itemPollSetup_DropDownOpening(object sender, EventArgs e) { ToolStripMenuItem item = sender as ToolStripMenuItem; if (item != null) { item.DropDownItems.Clear(); } CSnmpPollingSetup setup = item != null ? item.Tag as CSnmpPollingSetup : null; CEntiteSnmp ett = EditedElement as CEntiteSnmp; if (setup != null && ett != null) { CTypeDonneeCumulee tp = new CTypeDonneeCumulee(ett.ContexteDonnee); if (tp.ReadIfExists(setup.IdTypeDonneeCumulee)) { foreach (CChampDonneeCumulee champ in tp.GetChampsRenseignes()) { string strNomChamp = tp.GetNomChamp(champ); if (strNomChamp != null && strNomChamp.Length > 0) { ToolStripMenuItem itemAddToPolledField = new ToolStripMenuItem(strNomChamp); itemAddToPolledField.Tag = new CAddToPollData(setup, champ); itemAddToPolledField.Click += new EventHandler(itemAddToPolledField_Click); item.DropDownItems.Add(itemAddToPolledField); } } } } }
//--------------------------------------------- /// ///////////////////////////////////////////// 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); }
public static bool EditeSetup(CSnmpPollingSetup setup, CAgentSnmpPourSupervision agent, IEnumerable <ITypeDonneeCumulee> lstTypesDonnees) { using (CFormEditePollingSetup frm = new CFormEditePollingSetup()) { frm.m_panelSetup.Init(setup, agent, lstTypesDonnees); if (frm.ShowDialog() == DialogResult.OK) { return(true); } return(false); } }
//-------------------------------------------------- public void Init(CSnmpPollingSetup pollingSetup, CAgentSnmpPourSupervision agent, IEnumerable <ITypeDonneeCumulee> lstTypesDonneesCumulees) { m_agent = agent; m_listeTypesDonneesCumulees = lstTypesDonneesCumulees; m_setup = pollingSetup; m_txtLibelle.Text = pollingSetup.Libelle; m_txtFrequence.UnitValue = new CValeurUnite(m_setup.FrequenceMinutes, CClasseUniteTemps.c_idMIN); m_cmbTypesDonnees.ListDonnees = lstTypesDonneesCumulees; m_cmbTypesDonnees.ProprieteAffichee = "Libelle"; ITypeDonneeCumulee tp = lstTypesDonneesCumulees.FirstOrDefault(t => t.Id == pollingSetup.IdTypeDonneeCumulee); m_cmbTypesDonnees.SelectedValue = tp; FillListeChamps(); }
public CAddToPollData(CSnmpPollingSetup pollSetup, CChampDonneeCumulee champ) { PollSetup = pollSetup; Champ = champ; }
/// ///////////////////////////////////////////////////////// public void RemoveParametrePolling(CSnmpPollingSetup parametre) { ParametresPollingList.Remove(parametre); CommitParametresPolling(); }
/// ///////////////////////////////////////////////////////// public void AddParametrePolling(CSnmpPollingSetup parametre) { ParametresPollingList.Add(parametre); CommitParametresPolling(); }