private void CControlePourInventaire_Load(object sender, EventArgs e) { CListeEntitesDeMemoryDb <CChampCustom> lstChamps = new CListeEntitesDeMemoryDb <CChampCustom>(CTimosInventoryDb.GetTimosDatas()); lstChamps.Filtre = CChampCustom.GetFiltreChampsForRole(CReleveEquipement.c_roleChampCustom); if (lstChamps.Count() == 0) { m_panelChampsCustom.Visible = false; } else { m_panelChampsCustom.Visible = true; foreach (CChampCustom champOrg in lstChamps) { CChampCustom champ = new CChampCustom(CTimosInventoryDb.GetInventaireDatas()); if (!champ.ReadIfExist(champOrg.Id)) { champ = champOrg.GetChampInMemoryDb(CTimosInventoryDb.GetInventaireDatas()); } if (champ != null) { CControleForCustomFieldReleve ctrl = new CControleForCustomFieldReleve(); m_panelChampsCustom.Controls.Add(ctrl); ctrl.Dock = DockStyle.Left; ctrl.Init(champ); ctrl.OnValueChanged += new EventHandler(ctrlCustom_OnValueChanged); } } } Height = m_panelTop.Height + m_lblLigneBas.Height + (m_panelChampsCustom.Controls.Count > 0 ? m_panelChampsCustom.Height : 0); }
//-------------------------------------------------------------- private void CFormCreerEquipement_Load(object sender, EventArgs e) { m_lblSite.Text = m_releveEqpt.ReleveSite.Site.Libelle; if (m_releveEqpt.ReleveEquipementParent != null) { m_panelEqptParent.Visible = true; m_lblEqptParent.Text = m_releveEqpt.ReleveEquipementParent.NumeroSerie + " " + m_releveEqpt.ReleveEquipementParent.TypeEquipement.Libelle + " (" + m_releveEqpt.ReleveEquipementParent.CoordonneeComplete + ")"; } else { m_panelEqptParent.Visible = false; } m_txtSerial.Text = m_releveEqpt.NumeroSerie; m_selectTypeEquipement.Init(m_releveEqpt, true); m_panelCoordonnee.Init(m_releveEqpt, true); CListeEntitesDeMemoryDb <CChampCustom> lstChamps = new CListeEntitesDeMemoryDb <CChampCustom>(CTimosInventoryDb.GetTimosDatas()); lstChamps.Filtre = CChampCustom.GetFiltreChampsForRole(CReleveEquipement.c_roleChampCustom); if (lstChamps.Count() == 0) { m_panelChampsCustom.Visible = false; } else { m_panelChampsCustom.Visible = true; foreach (CChampCustom champOrg in lstChamps) { CChampCustom champ = new CChampCustom(CTimosInventoryDb.GetInventaireDatas()); if (!champ.ReadIfExist(champOrg.Id)) { champ = champOrg.GetChampInMemoryDb(CTimosInventoryDb.GetInventaireDatas()); } if (champ != null) { CControleForCustomFieldReleve ctrl = new CControleForCustomFieldReleve(); m_panelChampsCustom.Controls.Add(ctrl); ctrl.Dock = DockStyle.Left; ctrl.Init(champ); } } } foreach (Control ctrl in m_panelChampsCustom.Controls) { CControleForCustomFieldReleve c = ctrl as CControleForCustomFieldReleve; if (c != null) { c.InitChamps(m_releveEqpt); } } }