//--------------------------------------------------- public C2iStructureImport GetStructureFinale() { m_structureImport.ClearMappages(); foreach (Control ctrl in m_panelMappage.Controls) { CControlMappageImport map = ctrl as CControlMappageImport; if (map != null && map.ChampDest != null) { CMappageChampImport mappage = new CMappageChampImport(); mappage.Origine = map.Origine; mappage.ProprieteDestination = map.ChampDest; mappage.IsCle = map.IsKey; m_structureImport.AddMappage(mappage); } } EOptionImport option = EOptionImport.None; if (m_chkOptionUpdate.Checked) { option |= EOptionImport.Update; } if (m_chkOptionCreate.Checked) { option |= EOptionImport.Create; } m_structureImport.ChargerTouteLaCible = m_chkPrechargerLaCible.Checked; m_structureImport.OptionImport = option; return(m_structureImport); }
//--------------------------------------------------- private void FillControleMappage() { if (m_structureImport.TypeCible == null || m_structureImport.ParametreLecture == null) { m_lblIlFautDefinirLaSource.Visible = true; m_panelMappage.Visible = false; return; } m_lblIlFautDefinirLaSource.Visible = false; m_panelMappage.Visible = false; m_panelMappage.SuspendDrawing(); foreach (Control ctrl in new ArrayList(m_panelMappage.Controls)) { ctrl.Visible = false; m_panelMappage.Controls.Remove(ctrl); ctrl.Dispose(); } //Crée la liste des champs CFournisseurPropDynStd four = new CFournisseurPropDynStd(false); List <CDefinitionProprieteDynamique> lstDefs = new List <CDefinitionProprieteDynamique>(); HashSet <CDefinitionProprieteDynamique> setDefsPouvantEtreCle = new HashSet <CDefinitionProprieteDynamique>(); foreach (CDefinitionProprieteDynamique def in four.GetDefinitionsChamps(m_structureImport.TypeCible)) { if (!def.IsReadOnly && !def.TypeDonnee.IsArrayOfTypeNatif) { lstDefs.Add(def); if (CMappageChampImport.GetFiltreCle(m_structureImport.TypeCible, def, 0)) { setDefsPouvantEtreCle.Add(def); } } } foreach (DataColumn col in m_structureImport.ParametreLecture.GetColonnes()) { CControlMappageImport ctrl = new CControlMappageImport(); C2iOrigineChampImport origine = new C2iOrigineChampImportDataColumn(col); CMappageChampImport mappage = m_structureImport.GetMappage(origine); ctrl.Init( origine, mappage != null ? mappage.ProprieteDestination : null, lstDefs, setDefsPouvantEtreCle); m_panelMappage.Controls.Add(ctrl); ctrl.Dock = DockStyle.Top; ctrl.BringToFront(); } m_panelMappage.ResumeDrawing(); m_panelMappage.Visible = true; }