public override object Execute() { Epi.Data.IDbDriver driver = null; if (this.Context.CurrentRead != null) { driver = Epi.Data.DBReadExecute.GetDataDriver(this.Context.CurrentRead.File); } else { return(null); } List <string> tableNames = driver.GetTableNames(); List <string> viewNames = new List <string>(); foreach (string name in tableNames) { if (name.ToUpperInvariant().StartsWith("VIEW")) { viewNames.Add(name); } } this.DialogThenAssign(viewNames); return(null); }
private void txtStandalonePath_TextChanged(object sender, TextChangedEventArgs e) { cmbStandaloneFormName.Items.Clear(); if (System.IO.File.Exists(txtStandalonePath.Text)) { Epi.Data.IDbDriver database = Epi.Data.DBReadExecute.GetDataDriver(txtStandalonePath.Text); List <string> tableNames = database.GetTableNames(); cmbStandaloneFormName.Items.Clear(); foreach (string tableName in tableNames) { cmbStandaloneFormName.Items.Add(tableName); } } }
public DashboardProperties(DashboardHelper dashboardHelper) { #region Input Validation if (dashboardHelper == null) { throw new ArgumentNullException("dashboardHelper"); } #endregion // Input Validation InitializeComponent(); this.DashboardHelper = dashboardHelper; DataContext = this; if (DashboardHelper.IsUsingEpiProject) { txtProjectPath.Text = dashboardHelper.View.Project.FilePath; if (System.IO.File.Exists(txtProjectPath.Text)) { cmbFormName.Items.Clear(); Project project = new Project(txtProjectPath.Text); foreach (View view in project.Views) { cmbFormName.Items.Add(view.Name); } } cmbFormName.Text = dashboardHelper.View.Name; panelDataSourceProject.Visibility = System.Windows.Visibility.Visible; panelDataSourceOther.Visibility = System.Windows.Visibility.Collapsed; panelDataSourceSql.Visibility = System.Windows.Visibility.Collapsed; panelAdvancedSQLQuery.Visibility = System.Windows.Visibility.Collapsed; } else { if (dashboardHelper.Database.ToString().Contains("SqlDatabase")) { txtSQLConnectionString.Text = DashboardHelper.Database.ConnectionString; Epi.Data.IDbDriver database = Epi.Data.DBReadExecute.GetDataDriver(txtSQLConnectionString.Text); List <string> tableNames = database.GetTableNames(); cmbSqlTable.Items.Clear(); cmbSqlTable.Items.Add(""); foreach (string tableName in tableNames) { cmbSqlTable.Items.Add(tableName); } cmbSqlTable.SelectedItem = DashboardHelper.TableName; if (!String.IsNullOrEmpty(dashboardHelper.CustomQuery)) { CustomQuery = DashboardHelper.CustomQuery; } panelDataSourceProject.Visibility = System.Windows.Visibility.Collapsed; panelDataSourceOther.Visibility = System.Windows.Visibility.Collapsed; panelDataSourceSql.Visibility = System.Windows.Visibility.Visible; panelAdvancedSQLQuery.Visibility = System.Windows.Visibility.Visible; } else { txtStandalonePath.Text = DashboardHelper.Database.DataSource; Epi.Data.IDbDriver database = Epi.Data.DBReadExecute.GetDataDriver(txtStandalonePath.Text); List <string> tableNames = database.GetTableNames(); cmbStandaloneFormName.Items.Clear(); cmbStandaloneFormName.Items.Add(""); foreach (string tableName in tableNames) { cmbStandaloneFormName.Items.Add(tableName); } cmbStandaloneFormName.SelectedItem = DashboardHelper.TableName; if (!String.IsNullOrEmpty(dashboardHelper.CustomQuery)) { CustomQuery = DashboardHelper.CustomQuery; } panelDataSourceProject.Visibility = System.Windows.Visibility.Collapsed; panelDataSourceOther.Visibility = System.Windows.Visibility.Visible; panelDataSourceSql.Visibility = System.Windows.Visibility.Collapsed; panelAdvancedSQLQuery.Visibility = System.Windows.Visibility.Visible; } } tblockRows.Text = dashboardHelper.DataSet.Tables[0].Rows.Count.ToString() + DashboardSharedStrings.GADGET_INFO_UNFILTERED_ROWS; tblockColumns.Text = dashboardHelper.DataSet.Tables[0].Columns.Count.ToString() + DashboardSharedStrings.CANVAS_COLUMNS; tblockCacheDateTime.Text = DashboardSharedStrings.CANVAS_DATA_LAST_CACHED + dashboardHelper.LastCacheTime.ToShortDateString() + " " + dashboardHelper.LastCacheTime.ToShortTimeString(); tblockCacheTimeElapsed.Text = DashboardSharedStrings.CANVAS_INFO_TOOK + dashboardHelper.TimeToCache + DashboardSharedStrings.CANVAS_INFO_LOCALLY_CACHE_DATA; Epi.ApplicationIdentity appId = new Epi.ApplicationIdentity(typeof(Configuration).Assembly); tblockCurrentEpiVersion.Text = "Epi Info " + appId.Version; lbxRelatedDataSources.Items.Clear(); if (dashboardHelper.ConnectionsForRelate.Count > 0) { // Related Data foreach (RelatedConnection rConn in dashboardHelper.ConnectionsForRelate) { lbxRelatedDataSources.Items.Add(rConn.db.ConnectionString); } } #region Translation lblConfigExpandedTitle.Content = DashboardSharedStrings.CMENU_PROPERTIES; tbtnDataSource.Title = DashboardSharedStrings.GADGET_DATA_SOURCE; tbtnDataSource.Description = DashboardSharedStrings.CANVASPROPERTIES_TABDESC_DATASOURCE; tbtnHTML.Title = DashboardSharedStrings.GADGET_TABBUTTON_DISPLAY; tbtnHTML.Description = DashboardSharedStrings.CANVASPROPERTIES_DESC_HTMLOUTPUT; //tbtnCharts.Title = DashboardSharedStrings.GADGET_TAB_COLORS_STYLES; //tbtnCharts.Description = DashboardSharedStrings.CANVASPROPERTIES_DESC_CHARTS; tbtnInfo.Title = DashboardSharedStrings.CANVASPROPERTIES_TITLE_INFORMATION; tbtnInfo.Description = DashboardSharedStrings.CANVASPROPERTIES_DESC_INFORMATION; //Data Source Panel tblockPanelDataSource.Content = DashboardSharedStrings.GADGET_DATA_SOURCE; tblockEpiInfoPro.Content = DashboardSharedStrings.CANVAS_EPIINFOPRO; btnBrowse.Content = DashboardSharedStrings.BUTTON_BROWSE; tblockForm.Content = DashboardSharedStrings.CANVAS_FORM; lblRelatedDataSources.Content = DashboardSharedStrings.RALATED_DATASOURCE; //Display Panel tblockHTMLOutput.Content = DashboardSharedStrings.GADGET_PANELHEADER_DISPLAY; tblockHTMLSetting.Content = DashboardSharedStrings.CANVAS_HTMLOUTPUT_SETTINGS; txtTitle.Text = DashboardSharedStrings.CANVAS_TITLE; txtSummary.Text = DashboardSharedStrings.CANVAS_SUMMARY; txtConclusion.Text = DashboardSharedStrings.CANVAS_CONCLUSION; checkboxGadgetHeadings.Content = DashboardSharedStrings.CANVAS_GADGET_HEADING; checkboxGadgetSettings.Content = DashboardSharedStrings.CANVAS_GADGET_SETTINGS; checkboxCanvasSummary.Content = DashboardSharedStrings.CANVAS_CANVAS_SUMMARY; checkboxAlternateColors.Content = DashboardSharedStrings.CANVAS_ALTERNATING_COLORS; checkboxTopToBottom.Content = DashboardSharedStrings.CANVAS_DISPLAY_TOPTO_BOTTOM; tblockChartSetting.Content = DashboardSharedStrings.CANVAS_CHART_SETTINGS; lbldefaultwidth.Content = DashboardSharedStrings.CANVAS_DEFAULT_WIDTH; lbldefaultheight.Content = DashboardSharedStrings.CANVAS_DEFAULT_HEIGHT; //Information Panel lblCanvasInformation.Content = DashboardSharedStrings.GADGET_CANVAS_INFO; #endregion // Translation }