//------------------------------------------------------------------- public CSetupSmartImportChampSimpleItem( CSetupSmartImportItem parentItem, CDefinitionProprieteDynamique def, object valeurExemple, CMappageChampSimple mappageSimple, int nColorIndex) : base(parentItem, def, nColorIndex) { m_valeurExemple = valeurExemple; m_mappageSimple = mappageSimple; if (m_mappageSimple == null) { m_mappageSimple = new CMappageChampSimple(); m_mappageSimple.Propriete = def; } }
//------------------------------------------------------------------------------- private void CreateChilds(CSetupSmartImportItem si, CValeursProprietes valeurs, CConfigMappagesSmartImport configMappage) { //Champs simples HashSet <CDefinitionProprieteDynamique> set = new HashSet <CDefinitionProprieteDynamique>(); if (valeurs != null) { foreach (CDefinitionProprieteDynamique prop in valeurs.GetDefinitionsSimples()) { if (prop != null) { set.Add(prop); } } } if (configMappage != null) { foreach (CMappageChampSimple mappage in configMappage.MappagesChampsSimples) { if (mappage.Propriete != null) { set.Add(mappage.Propriete); } } } List <CDefinitionProprieteDynamique> lst = new List <CDefinitionProprieteDynamique>(set.ToArray()); lst.Sort((x, y) => x.Nom.CompareTo(y.Nom)); int nIndex = si.Index; foreach (CDefinitionProprieteDynamique def in lst) { CMappageChampSimple mappageSimple = configMappage != null? configMappage.GetMappageSimpleFor(def) : null; bool bCreate = true; if (HideNullSources) { bCreate = mappageSimple != null && mappageSimple.Source != null; } if (bCreate) { CSetupSmartImportChampSimpleItem item = new CSetupSmartImportChampSimpleItem( si, def, valeurs != null ? valeurs.GetValeurSimple(def) : null, mappageSimple, si.ColorIndex); InsertItem(++nIndex, item, false); } } //Champs parents int nColorIndex = si.ColorIndex; set.Clear(); if (valeurs != null) { foreach (CDefinitionProprieteDynamique def in valeurs.GetDefinitionsParentes()) { if (def != null) { set.Add(def); } } } if (configMappage != null) { foreach (CMappageEntiteParente map in configMappage.MappagesEntitesParentes) { if (map.Propriete != null) { set.Add(map.Propriete); } } } lst = new List <CDefinitionProprieteDynamique>(set.ToArray()); lst.Sort((x, y) => x.Nom.CompareTo(y.Nom)); foreach (CDefinitionProprieteDynamique def in lst) { CMappageEntiteParente mappageParent = configMappage != null?configMappage.GetMappageParentFor(def) : null; bool bCreate = true; if (HideNullSources) { bCreate = mappageParent != null && mappageParent.Source != null; } if (bCreate) { nColorIndex++; if (CSetupSmartImportItem.GetCouleur(nColorIndex) == si.BackColor) { nColorIndex++; } CSetupSmartImportEntiteParentItem item = new CSetupSmartImportEntiteParentItem( si, def, valeurs != null ? valeurs.GetValeurParente(def) : null, mappageParent, nColorIndex); InsertItem(++nIndex, item, false); } } set.Clear(); if (valeurs != null) { foreach (CDefinitionProprieteDynamique def in valeurs.GetDefinitionsFilles()) { if (def != null) { set.Add(def); } } } if (configMappage != null) { foreach (CMappageEntitesFilles map in configMappage.MappagesEntitesFilles) { if (map.Propriete != null) { set.Add(map.Propriete); } } } lst = new List <CDefinitionProprieteDynamique>(set.ToArray()); lst.Sort((x, y) => x.Nom.CompareTo(y.Nom)); foreach (CDefinitionProprieteDynamique def in lst) { CMappageEntitesFilles mappageFilles = configMappage != null?configMappage.GetMappageFilleFor(def) : null; bool bCreate = true; if (HideNullSources) { bCreate = mappageFilles != null && mappageFilles.MappagesEntitesFilles.Count() > 0; } if (bCreate) { CSetupSmartImportEntiteFilleItem item = new CSetupSmartImportEntiteFilleItem( si, def, valeurs, mappageFilles, si.ColorIndex ); InsertItem(++nIndex, item, false); } } }