List <object> mapControl_DataSourceRequested() { if (MessageBox.Show("Use external data?", "Data source", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { Epi.Windows.Dialogs.BaseReadDialog dlg = new Epi.Windows.Dialogs.BaseReadDialog(this); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { List <object> resultsArray = new List <object>(); resultsArray.Add(dlg.SelectedDataSource); resultsArray.Add(dlg.SelectedDataMember); return(resultsArray); } else { return(null); } } else { List <object> resultsArray = new List <object>(); resultsArray.Add(currentView.Project); resultsArray.Add(currentView.Name); return(resultsArray); } }
private void btnImportListValues_Click(object sender, EventArgs e) { Epi.Windows.Dialogs.BaseReadDialog dlg = new Epi.Windows.Dialogs.BaseReadDialog(this); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (dlg.SelectedDataSource is Project) { Epi.Windows.MsgBox.ShowInformation(ImportExportSharedStrings.ERROR_CODE_TABLE_PROJECT_IMPORT_NOT_ALLOWED); } else { Epi.Data.IDbDriver db = (Epi.Data.IDbDriver)dlg.SelectedDataSource; if (string.IsNullOrEmpty(dlg.SQLQuery)) { DataTable DT = db.GetTopTwoTable(dlg.SelectedDataMember); List <string> columnNames = new List <string>(); foreach (DataColumn dc in DT.Columns) { columnNames.Add(dc.ColumnName); } Epi.Windows.ImportExport.Dialogs.FieldSelectionDialog fsd = new Windows.ImportExport.Dialogs.FieldSelectionDialog(columnNames); DialogResult fieldDialogResult = fsd.ShowDialog(); if (fieldDialogResult == System.Windows.Forms.DialogResult.OK) { string selectedColumn = fsd.SelectedField; string codeTableName = "code" + dlg.SelectedDataMember + selectedColumn; try { DT = db.GetTableData(dlg.SelectedDataMember); DT.TableName = codeTableName; codeTables.Add(DT); codeTableList.Add(codeTableName); ((DataGridViewComboBoxColumn)dgvFormFields.Columns["ListSourceTableName"]).Items.Clear(); foreach (string s in codeTableList) { ((DataGridViewComboBoxColumn)dgvFormFields.Columns["ListSourceTableName"]).Items.Add(s); } } catch (OutOfMemoryException) { Epi.Windows.MsgBox.ShowError(ImportExportSharedStrings.ERROR_OUT_OF_MEMORY_CODE_TABLE); DT.Rows.Clear(); } } } else { Epi.Windows.MsgBox.ShowInformation(ImportExportSharedStrings.ERROR_CODE_TABLE_QUERY_IMPORT_NOT_ALLOWED); } } } }
List<object> mapControl_DataSourceRequested() { if (MessageBox.Show("Use external data?", "Data source", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { Epi.Windows.Dialogs.BaseReadDialog dlg = new Epi.Windows.Dialogs.BaseReadDialog(); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { List<object> resultsArray = new List<object>(); resultsArray.Add(dlg.SelectedDataSource); resultsArray.Add(dlg.SelectedDataMember); return resultsArray; } else { return null; } } else { List<object> resultsArray = new List<object>(); resultsArray.Add(currentView.Project); resultsArray.Add(currentView.Name); return resultsArray; } }
private void btnImportListValues_Click(object sender, EventArgs e) { Epi.Windows.Dialogs.BaseReadDialog dlg = new Epi.Windows.Dialogs.BaseReadDialog(); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (dlg.SelectedDataSource is Project) { Epi.Windows.MsgBox.ShowInformation(ImportExportSharedStrings.ERROR_CODE_TABLE_PROJECT_IMPORT_NOT_ALLOWED); } else { Epi.Data.IDbDriver db = (Epi.Data.IDbDriver)dlg.SelectedDataSource; if (string.IsNullOrEmpty(dlg.SQLQuery)) { DataTable DT = db.GetTopTwoTable(dlg.SelectedDataMember); List<string> columnNames = new List<string>(); foreach(DataColumn dc in DT.Columns) { columnNames.Add(dc.ColumnName); } Epi.Windows.ImportExport.Dialogs.FieldSelectionDialog fsd = new Windows.ImportExport.Dialogs.FieldSelectionDialog(columnNames); DialogResult fieldDialogResult = fsd.ShowDialog(); if (fieldDialogResult == System.Windows.Forms.DialogResult.OK) { string selectedColumn = fsd.SelectedField; string codeTableName = "code" + dlg.SelectedDataMember + selectedColumn; try { DT = db.GetTableData(dlg.SelectedDataMember); DT.TableName = codeTableName; codeTables.Add(DT); codeTableList.Add(codeTableName); ((DataGridViewComboBoxColumn)dgvFormFields.Columns["ListSourceTableName"]).Items.Clear(); foreach (string s in codeTableList) { ((DataGridViewComboBoxColumn)dgvFormFields.Columns["ListSourceTableName"]).Items.Add(s); } } catch (OutOfMemoryException) { Epi.Windows.MsgBox.ShowError(ImportExportSharedStrings.ERROR_OUT_OF_MEMORY_CODE_TABLE); DT.Rows.Clear(); } } } else { Epi.Windows.MsgBox.ShowInformation(ImportExportSharedStrings.ERROR_CODE_TABLE_QUERY_IMPORT_NOT_ALLOWED); } } } }