public WizardImport(TabloidConfigImport i, TabloidConfigView view) { ImportResult = i ?? new TabloidConfigImport(); _linkList = new BindingList <ColumnFieldLink>(); _currentView = view; InitializeComponent(); dgv.AutoGenerateColumns = false; dgv.DataSource = _linkList; dgv.AllowUserToAddRows = false; dgv.AutoResizeColumns(); DataGridViewComboBoxColumn col = new DataGridViewComboBoxColumn(); col.DataSource = _currentView.Colonnes; col.DisplayMember = "CompleteName"; col.ValueMember = "Self"; col.DataPropertyName = "field"; col.HeaderText = "Champ de votre projet"; col.Width = 200; _ExcelColumnDDL = new DataGridViewComboBoxColumn(); _ExcelColumnDDL.DataPropertyName = "columnTitle"; _ExcelColumnDDL.HeaderText = "Colonne Excel"; _ExcelColumnDDL.Width = 200; dgv.Columns.Add(col); dgv.Columns.Add(_ExcelColumnDDL); }
private void Info_CloseFromNext(object sender, PageEventArgs e) { ImportResult = new TabloidConfigImport { WorkSheetNumber = Program.CurrentXLSStructure.CurrentWorkBookNum + 1, Title = txtTitreImport.Text, LineToSkip = Program.CurrentXLSStructure.IgnoreLine }; var mainTable = new TabloidConfigDestinationTable { TableName = _currentView.NomTable, Nom = "T0" }; ImportResult.DestinatrionTable.Add(mainTable); foreach (ColumnFieldLink link in _linkList) { if (link.columnTitle != null || link.field != null) { var ctrl = TabloidControl.TabloidControlList[link.field.Editeur]; TabloidConfigImpField importField = null; if (ctrl.isSingleObjectSelector) { if (!string.IsNullOrEmpty(link.field.Jointure)) { var join = _currentView.Jointures[link.field.Jointure]; // Add table to import list of values var newImportTable = new TabloidConfigDestinationTable { TableName = join.NomTable }; var newImportTableField = new TabloidConfigImpField { Deduplicate = true, FieldName = link.field.Champ, ColName = link.columnTitle }; Classes.WizardTools.Tools.AddWithUniqueName(newImportTable.Fields, newImportTableField, "C"); Classes.WizardTools.Tools.AddWithUniqueName(ImportResult.DestinatrionTable, newImportTable, "T", null, 0); // add field to main table importField = new TabloidConfigImpField { ColName = link.columnTitle, FieldName = join.ChampDeRef, JoinFieldName = link.field.Champ, JoinValueField = join.CalculatedKeyName, JoinTableName = join.NomTable }; } } else if (ctrl.isArrayObjectSelector) { } else { importField = new TabloidConfigImpField { ColName = link.columnTitle, FieldName = link.field.Champ }; } if (importField != null) { Classes.WizardTools.Tools.AddWithUniqueName(mainTable.Fields, importField, "C"); } } else { MetroMessageBox.Show(this, Properties.Resources.ImportIncorrectExcelLine, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }