public ConditionalAssignDialog(DashboardHelper dashboardHelper)
 {
     InitializeComponent();
     this.dashboardHelper = dashboardHelper;
     this.DataFilters = new DataFilters(dashboardHelper);
     FillComboBoxes();
 }
Example #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="view">The view to attach</param>
        /// <param name="db">The database to attach</param>
        /// <param name="dashboardHelper">The dashboard helper to attach</param>
        public MergeControl(DashboardHelper dashboardHelper)
        {
            InitializeComponent();

            pnlTableOverwrite.Visibility = System.Windows.Visibility.Collapsed;
            pnlError.Visibility = System.Windows.Visibility.Collapsed;
            pnlProgress.Visibility = System.Windows.Visibility.Collapsed;

            this.dashboardHelper = dashboardHelper;

            imgClose.MouseEnter += new MouseEventHandler(imgClose_MouseEnter);
            imgClose.MouseLeave += new MouseEventHandler(imgClose_MouseLeave);
            imgClose.MouseDown += new MouseButtonEventHandler(imgClose_MouseDown);

            cmbSourceDataFormat.Items.Clear();
            this.GadgetProgressUpdate += new GadgetProgressUpdateHandler(RequestUpdateStatusMessage);

            foreach (Epi.DataSets.Config.DataDriverRow row in dashboardHelper.Config.DataDrivers)
            {
                ComboBoxItem item = new ComboBoxItem();
                item.Content = row.DisplayName;
                //cmbDataFormats.Items.Add(new ComboBoxItem(row.Type, row.DisplayName, null));
                cmbSourceDataFormat.Items.Add(item);
            }
        }
Example #3
0
 public PMCCControl(DashboardHelper dashboardHelper)
 {
     InitializeComponent();
     this.DashboardHelper = dashboardHelper;
     Construct();
     FillComboboxes();
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="view">The view to attach</param>
 /// <param name="db">The database to attach</param>
 /// <param name="dashboardHelper">The dashboard helper to attach</param>
 public DataRecodingControl(DashboardHelper dashboardHelper)
 {
     InitializeComponent();
     this.dashboardHelper = dashboardHelper;
     txtTitle.RenderTransform = new RotateTransform(90);
     UpdateRules();
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="db">The database to attach</param>
 /// <param name="view">The view to attach</param>
 public LogisticRegressionControl(DashboardHelper dashboardHelper)
 {
     InitializeComponent();
     this.dashboardHelper = dashboardHelper;
     Construct();
     FillComboboxes();
 }
        /// <summary>
        /// Constructor for conditional assignment with custom column type
        /// </summary>
        public Rule_ConditionalAssign(DashboardHelper dashboardHelper, string friendlyRule, string destinationColumnName, string destinationColumnType, /*Dictionary<string, object> conditions*/object assignValue, object elseValue, string condition)
        {
            this.friendlyRule = friendlyRule;
            this.destinationColumnName = destinationColumnName;
            this.destinationColumnType = destinationColumnType;
            this.DashboardHelper = dashboardHelper;
            this.condition = condition;

            if (DestinationColumnType.Equals("System.String"))
            {
                this.variableType = DashboardVariableType.Text;
            }
            else if (DestinationColumnType.Equals("System.Boolean"))
            {
                this.variableType = DashboardVariableType.YesNo;
            }
            else
            {
                this.variableType = DashboardVariableType.Numeric;
            }
            //this.conditions = conditions;
            this.assignValue = assignValue;
            this.elseValue = elseValue;
            if (elseValue == null)
            {
                UseElse = false;
            }
            else
            {
                UseElse = true;
            }
        }
 public StandardImageControl(DashboardHelper dashboardHelper, DashboardControl dashboardControl)
 {
     InitializeComponent();
     Construct();
     this.dashboardHelper = dashboardHelper;
     this.dashboardControl = dashboardControl;
 }
 public AberrationChartGadget(DashboardHelper dashboardHelper)
 {
     InitializeComponent();
     this.DashboardHelper = dashboardHelper;
     Construct();
     FillComboboxes();
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dashboardHelper">The dashboard helper object to attach</param>
 public DuplicatesListControl(DashboardHelper dashboardHelper)
 {
     InitializeComponent();
     this.DashboardHelper = dashboardHelper;
     this.IsHostedByEnter = false;
     Construct();
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dashboardHelper">The dashboard helper object to attach</param>
 public ComplexSampleFrequencyControl(DashboardHelper dashboardHelper)
 {
     InitializeComponent();
     this.dashboardHelper = dashboardHelper;
     Construct();
     FillComboboxes();
 }
 public CrosstabControl(DashboardHelper dashboardHelper)
 {
     InitializeComponent();
     this.DashboardHelper = dashboardHelper;
     Construct();
     //FillComboboxes();
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="view">The view to attach</param>
        /// <param name="db">The database to attach</param>
        /// <param name="dashboardHelper">The dashboard helper to attach</param>
        public DataFilteringControl(DashboardHelper dashboardHelper)
        {
            InitializeComponent();
            this.dashboardHelper = dashboardHelper;
            txtTitle.RenderTransform = new RotateTransform(270);
            FillSelectionComboboxes();

            selectionGridHeight = grdSelectionProperties.Height;
            guidedButtonsGridHeight = grdGuidedModeButtons.Height;

            if (dashboardHelper.UseAdvancedUserDataFilter)
            {
                pnlAdvancedMode.Visibility = Visibility.Visible;
                txtAdvancedFilter.Text = dashboardHelper.AdvancedUserDataFilter;
                SetAdvancedFilterMode();
                ApplyAdvancedModeFilter();
            }
            else
            {
                pnlAdvancedMode.Visibility = Visibility.Collapsed;
                txtAdvancedFilter.Text = string.Empty;
                SetGuidedFilterMode();
            }

            UpdateFilterConditions();
            imgClose.MouseUp += new MouseButtonEventHandler(imgClose_MouseUp);

            if (!dashboardHelper.IsUsingEpiProject)
            {
                panelAdvanced.Visibility = Visibility.Collapsed;
            }
        }
 public AberrationControl(DashboardHelper dashboardHelper)
 {
     InitializeComponent();
     this.dashboardHelper = dashboardHelper;
     Construct();
     FillComboboxes();
 }
Example #14
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="view">The view to attach</param>
        /// <param name="db">The database to attach</param>
        /// <param name="dashboardHelper">The dashboard helper to attach</param>
        public ExportWindow(DashboardHelper dashboardHelper)
        {
            InitializeComponent();

            messagePanel.Visibility = System.Windows.Visibility.Collapsed;
            messagePanel.Text = string.Empty;
            messagePanel.HideProgressBar();

            //pnlTableOverwrite.Visibility = System.Windows.Visibility.Collapsed;
            //pnlError.Visibility = System.Windows.Visibility.Collapsed;
            //pnlProgress.Visibility = System.Windows.Visibility.Collapsed;

            this.dashboardHelper = dashboardHelper;
            lbxExportFields.SelectionChanged += new SelectionChangedEventHandler(lbxExportFields_SelectionChanged);
            FillComboboxes();
            exportFields = new List<string>();
            allFieldsSelected = true;

            cmbDataFormats.Items.Clear();
            this.GadgetProgressUpdate += new GadgetProgressUpdateHandler(RequestUpdateStatusMessage);

            foreach (Epi.DataSets.Config.DataDriverRow row in dashboardHelper.Config.DataDrivers)
            {
                ComboBoxItem item = new ComboBoxItem();
                item.Content = row.DisplayName;
                //cmbDataFormats.Items.Add(new ComboBoxItem(row.Type, row.DisplayName, null));
                cmbDataFormats.Items.Add(item);
            }

            cmbDataFormats.SelectionChanged += new SelectionChangedEventHandler(cmbDataFormats_SelectionChanged);

            if (dashboardHelper.IsUsingEpiProject)
            {
                checkboxTabOrder.IsEnabled = true;
                checkboxTabOrder.IsChecked = true;
                checkboxUsePrompts.IsEnabled = true;
            }
            else
            {
                checkboxTabOrder.IsEnabled = false;
                checkboxTabOrder.IsChecked = false;
                checkboxUsePrompts.IsEnabled = false;
                checkboxUsePrompts.IsChecked = false;
            }

            #region Translation
            this.Title = DashboardSharedStrings.EXPORT_WINDOW_TITLE;
            this.tblockOutputFormat.Text = DashboardSharedStrings.EXPORT_OUTPUT_FORMAT;
            this.tblockConnInfo.Text = DashboardSharedStrings.EXPORT_CONN_INFO;
            this.tblockDestinationTable.Text = DashboardSharedStrings.EXPORT_DEST_TABLE;
            this.tblockFields.Text = DashboardSharedStrings.EXPORT_FIELDS_TO_EXPORT;
            this.checkboxTabOrder.Content = DashboardSharedStrings.EXPORT_SORT_BY_TAB_ORDER;
            this.btnCancel.Content = DashboardSharedStrings.EXPORT_BUTTON_CLOSE;
            this.btnExport.Content = DashboardSharedStrings.EXPORT_BUTTON_EXPORT;
            this.btnConnectionBrowse.Content = DashboardSharedStrings.EXPORT_BUTTON_BROWSE;
            #endregion // Translation

            EnableDisableExportButton();
        }
Example #15
0
 public LayerList(ESRI.ArcGIS.Client.Map myMap, Epi.View view, Epi.Data.IDbDriver db, DashboardHelper dashboardHelper)
 {
     InitializeComponent();
     this.myMap = myMap;
     this.view = view;
     this.db = db;
     this.dashboardHelper = dashboardHelper;
 }
 /// <summary>
 /// Constructor for simple assignment
 /// </summary>
 public Rule_ExpressionAssign(DashboardHelper dashboardHelper, string friendlyRule, string destinationColumnName, string expression)
 {
     this.friendlyRule = friendlyRule;
     this.destinationColumnName = destinationColumnName;
     this.destinationColumnType = "System.Decimal";
     this.DashboardHelper = dashboardHelper;
     this.variableType = DashboardVariableType.Numeric;
     this.expression = expression;
 }
Example #17
0
 /// <summary>
 /// Constructor
 /// </summary>
 public RecodeDialog(DashboardHelper dashboardHelper)
 {
     this.dashboardHelper = dashboardHelper;
     this.editMode = false;
     InitializeComponent();
     FillComboBoxes();
     this.checkboxMaintainSortOrder.Checked = true;
     this.checkboxUseWildcards.Checked = false;
 }
Example #18
0
        public PieChart(DashboardHelper dashboardHelper, PieChartParameters parameters, List<XYColumnChartData> dataList)
        {
            InitializeComponent();
            PieChartParameters = parameters;
            this.DashboardHelper = dashboardHelper;
            SetChartProperties();
            SetChartData(dataList);

            xyChart.Legend.BorderBrush = Brushes.Gray;
        }
Example #19
0
 /// <summary>
 /// Constructor for simple assignment
 /// </summary>
 public Rule_SimpleAssign(DashboardHelper dashboardHelper, string friendlyRule, string destinationColumnName, SimpleAssignType assignmentType, List<string> assignmentParameters)
 {
     this.friendlyRule = friendlyRule;
     this.destinationColumnName = destinationColumnName;
     this.DashboardHelper = dashboardHelper;
     this.variableType = DashboardVariableType.Numeric;
     this.assignmentType = assignmentType;
     this.destinationColumnType = GetDestinationColumnType(this.assignmentType);
     this.assignmentParameters = assignmentParameters;
 }
        public ComplexSampleMeansProperties(
            DashboardHelper dashboardHelper, 
            IGadget gadget,
            ComplexSampleMeansParameters parameters,
            List<Grid> strataGridList
            )
        {
            InitializeComponent();
            this.DashboardHelper = dashboardHelper;
            this.Gadget = gadget;
            this.Parameters = parameters;

            List<string> fields = new List<string>();
            List<FieldInfo> items = new List<FieldInfo>();
            List<string> crosstabFields = new List<string>();
            List<string> strataFields = new List<string>();

            crosstabFields.Add(string.Empty);
            items.Add(new FieldInfo()
            {
                Name = "",
                DataType = "",
                VariableCategory = VariableCategory.Field
            });

            foreach (string fieldName in DashboardHelper.GetFieldsAsList())
            {
                items.Add(new FieldInfo()
                {
                    Name = fieldName,
                    DataType = DashboardHelper.GetColumnDbType(fieldName).ToString(),
                    VariableCategory = VariableCategory.Field
                });

                fields.Add(fieldName);
                crosstabFields.Add(fieldName);
                strataFields.Add(fieldName);
            }
            fields.Sort();
            crosstabFields.Sort();

            cbxField.ItemsSource = fields;
            cbxFieldWeight.ItemsSource = fields;
            cbxFieldCrosstab.ItemsSource = crosstabFields;
            cbxFieldStrata.ItemsSource = strataFields;
            cbxFieldPSU.ItemsSource = strataFields;

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(cbxField.ItemsSource);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("VariableCategory");
            view.GroupDescriptions.Add(groupDescription);

            RowFilterControl = new RowFilterControl(this.DashboardHelper, Dialogs.FilterDialogMode.ConditionalMode, (gadget as ComplexSampleMeansControl).DataFilters, true);
            RowFilterControl.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            panelFilters.Children.Add(RowFilterControl);
        }
Example #21
0
        public RowFilterDialog(DashboardHelper dashboardHelper, FilterDialogMode pMode, DataFilters filters, bool includeUserDefinedVars)
        {
            InitializeComponent();
            this.includeUserDefinedVars = includeUserDefinedVars;
            this.dashboardHelper = dashboardHelper;
            this.Mode = pMode;
            Construct();

            rfc = new EpiDashboard.RowFilterControl(dashboardHelper, Mode, filters, includeUserDefinedVars);
            host.Child = rfc;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="dashboardHelper">The dashboard helper to attach</param>
        public ExpressionAssignDialog(DashboardHelper dashboardHelper)
        {
            InEditMode = false;
            this.dashboardHelper = dashboardHelper;
            InitializeComponent();
            FillSelectionComboboxes();

            this.txtDestinationField.Text = string.Empty;
            this.txtExpression.Text = string.Empty;
            cbxDataType.SelectedIndex = 0;
        }
Example #23
0
 public ColumnChart(DashboardHelper dashboardHelper, GadgetParameters parameters, ColumnChartSettings settings, List<XYColumnChartData> dataList)
 {
     InitializeComponent();
     this.Settings = settings;
     this.ColumnChartSettings = settings;
     this.Parameters = parameters;
     this.DashboardHelper = dashboardHelper;
     SetChartProperties();
     SetChartData(dataList);
     xyChart.Legend.BorderBrush = Brushes.Gray;
 }
Example #24
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="dashboardHelper">The dashboard helper to attach</param>
        public SimpleAssignDialog(DashboardHelper dashboardHelper)
        {
            InEditMode = false;
            this.dashboardHelper = dashboardHelper;
            InitializeComponent();

            cbxAssignmentType.SelectedIndex = 0;

            FillSelectionComboBoxes();

            this.txtDestinationField.Text = string.Empty;
        }
Example #25
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="dashboardHelper">The dashboard helper to attach</param>
        public DataFilterDialog(DashboardHelper dashboardHelper)
        {
            InEditMode = false;
            this.dashboardHelper = dashboardHelper;
            InitializeComponent();

            cbxOperand.SelectedIndex = 0;

            FillSelectionComboBoxes();

            //this.txtDestinationField.Text = string.Empty;
        }
Example #26
0
        /// <summary>
        /// Constructor used for editing an existing format rule
        /// </summary>
        /// <param name="dashboardHelper">The dashboard helper to attach</param>
        public DataFilterDialog(DashboardHelper dashboardHelper, FilterCondition filterCondition)
        {
            InEditMode = true;
            this.dashboardHelper = dashboardHelper;
            this.FilterCondition = filterCondition;
            InitializeComponent();

            FillSelectionComboBoxes();

            //this.txtDestinationField.Text = AssignRule.DestinationColumnName;
            //this.txtDestinationField.Enabled = false;
        }
Example #27
0
        public LayerAdder(ESRI.ArcGIS.Client.Map myMap, Epi.View view, Epi.Data.IDbDriver db, DashboardHelper dashboardHelper, LayerList layerList, MapControl mapControl)
        {
            InitializeComponent();

            this.myMap = myMap;
            this.view = view;
            this.db = db;
            this.dashboardHelper = dashboardHelper;
            this.layerList = layerList;
            this.mapControl = mapControl;

            AddItem();
        }
Example #28
0
        public void SaveEmptyParametersCollectionTest()
        {
            using (var application = XpoInMemoryXafApplication.CreateInstance())
            {
                Dashboard dashboard   = new Dashboard();
                var       dashboardId = Guid.NewGuid().ToString();

                DashboardHelper.SaveParameters(application, dashboardId, dashboard.Parameters);

                var options = application.Model.Options as IModelOptionsXtraDashboards;
                Assert.Empty(options.XtraDashboards);
            }
        }
Example #29
0
        /// <summary>
        /// Constructor used for editing an existing format rule
        /// </summary>
        public FormatDialog(DashboardHelper dashboardHelper, Rule_Format formatRule)
        {
            InEditMode           = true;
            this.dashboardHelper = dashboardHelper;
            this.formatRule      = formatRule;
            InitializeComponent();
            FillSelectionComboboxes();

            this.txtDestinationField.Text    = formatRule.DestinationColumnName;
            this.txtDestinationField.Enabled = false;

            this.cbxFieldName.Enabled = false;
        }
        public DashboardProperties(DashboardHelper dashboardHelper)
        {
            #region Input Validation
            if (dashboardHelper == null) { throw new ArgumentNullException("dashboardHelper"); }
            #endregion // Input Validation

            InitializeComponent();
            this.DashboardHelper = dashboardHelper;

            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;
            }
            else
            {
                if (!string.IsNullOrEmpty(dashboardHelper.CustomQuery))
                {
                    SqlQuery = DashboardHelper.CustomQuery;
                }
            }

            tblockRows.Text = dashboardHelper.DataSet.Tables[0].Rows.Count.ToString() + " unfiltered rows";
            tblockColumns.Text = dashboardHelper.DataSet.Tables[0].Columns.Count.ToString() + " columns";
            tblockCacheDateTime.Text = "Data last cached at " + dashboardHelper.LastCacheTime.ToShortDateString() + " " + dashboardHelper.LastCacheTime.ToShortTimeString();
            tblockCacheTimeElapsed.Text = "Took " + dashboardHelper.TimeToCache + " to 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);
                }
            }
        }
Example #31
0
        public LinRegressionResults GetRegressionResult(GadgetParameters gadgetOptions, List <string> columnNames, List <DictionaryDTO> inputDtoList, IEnumerable <EwavDataFilterCondition> ewavDataFilters, List <EwavRule_Base> rules, string filterString = "")
        {
            if (gadgetOptions.UseAdvancedDataFilter)
            {
                dh = new DashboardHelper(gadgetOptions, filterString, rules);
                gadgetOptions.UseAdvancedDataFilter  = true;
                gadgetOptions.AdvancedDataFilterText = filterString;
            }
            else
            {
                dh = new DashboardHelper(gadgetOptions, ewavDataFilters, rules);
            }
            DataTable            dt;
            LinRegressionResults results = new LinRegressionResults();

            try
            {
                dt = dh.GenerateTable(columnNames, gadgetOptions);
            }
            catch (Exception e)
            {
                results.ErrorMessage = e.Message;
                return(results);
            }
            Dictionary <string, string> inputVariableList = RegressionManager.ConvertDtoToDic(inputDtoList);


            StatisticsRepository.LinearRegression linearRegression = new StatisticsRepository.LinearRegression();

            StatisticsRepository.LinearRegression.LinearRegressionResults regressionResults = linearRegression.LinearRegression(inputVariableList, dt);

            results.RegressionResults = RegressionManager.ConvertToLinRegResults(regressionResults);

            results.CorrelationCoefficient = results.RegressionResults.CorrelationCoefficient;
            results.RegressionDf           = results.RegressionResults.RegressionDf;
            results.RegressionF            = results.RegressionResults.RegressionF;
            results.RegressionMeanSquare   = results.RegressionResults.RegressionMeanSquare;
            results.RegressionSumOfSquares = results.RegressionResults.RegressionSumOfSquares;
            results.ResidualsDf            = results.RegressionResults.ResidualsDf;
            results.ResidualsMeanSquare    = results.RegressionResults.ResidualsMeanSquare;
            results.ResidualsSumOfSquares  = results.RegressionResults.ResidualsSumOfSquares;
            results.TotalDf           = results.RegressionResults.TotalDf;
            results.TotalSumOfSquares = results.RegressionResults.TotalSumOfSquares;
            results.Variables         = results.RegressionResults.Variables;
            if (results.RegressionResults.ErrorMessage != null)
            {
                results.ErrorMessage = results.RegressionResults.ErrorMessage.Replace("<tlt>", string.Empty).Replace("</tlt>", string.Empty);
            }

            return(results);
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            switch (SelectedDashboardType)
            {
            case DisplayType.ShowAll:
            {
                azureHelper.GetVirtualMashinesList().UpdateActiveVMs((int)id, new int[0]);
                break;
            }

            case DisplayType.ExcludeType:
            {
                azureHelper.GetVirtualMashinesList().UpdateActiveVMs((int)id, ExcludedVMs);
                break;
            }

            case DisplayType.SelectType:
            {
                azureHelper.GetVirtualMashinesList().UpdateActiveVMs((int)id, SelectedVMs);
                break;
            }
            }

            using (var ctx = new CADContext())
            {
                if (Dashboard.DashboardAnonAccessCode == null)
                {
                    Dashboard.DashboardAnonAccessCode = DashboardHelper.CalculateHash(Dashboard.DashboardName);
                }

                var dash = await ctx.Dashboards.Include(d => d.DashboardApplications).Include(l => l.Links).FirstOrDefaultAsync(d => d.DashboardId == Dashboard.DashboardId);

                dash.DashboardApplications.Clear();
                foreach (var sa in SelectedApplications)
                {
                    DashboardApplication app = new DashboardApplication();
                    app.Dashboard   = Dashboard;
                    app.Application = ctx.Applications.First(a => a.AppId == sa);
                    dash.DashboardApplications.Add(app);
                }
                dash.Links.Clear();
                dash.Links = Dashboard.Links;
                dash.DashboardAnonAccessCode = Dashboard.DashboardAnonAccessCode;
                dash.DashboardName           = Dashboard.DashboardName;
                dash.DashboardLogoUrl        = Dashboard.DashboardLogoUrl;
                dash.DisplayType             = SelectedDashboardType;
                ctx.SaveChanges();
            }
            return(RedirectToPage("./Index"));
        }
Example #33
0
        public List <FrequencyResultData> GenerateFrequencyTable(GadgetParameters gadgetParameters,
                                                                 IEnumerable <EwavDataFilterCondition> ewavDataFilters, List <EwavRule_Base> rules, string filterString = "")
        {
            if (gadgetParameters.UseAdvancedDataFilter)
            {
                dh = new DashboardHelper(gadgetParameters, filterString, rules);
                gadgetParameters.UseAdvancedDataFilter  = true;
                gadgetParameters.AdvancedDataFilterText = filterString;
            }
            else
            {
                dh = new DashboardHelper(gadgetParameters, ewavDataFilters, rules);
            }


            Dictionary <DataTable, List <DescriptiveStatistics> > dataTableDictionary;

            dataTableDictionary = dh.GenerateFrequencyTable(gadgetParameters, gadgetParameters.DatasourceName, gadgetParameters.TableName);


            Dictionary <List <EwavFrequencyControlDto>, List <DescriptiveStatistics> > dtoDictionary;

            dtoDictionary = FrequencyManager.ConvertDatatableToList(dataTableDictionary, gadgetParameters);

            List <FrequencyResultData> outputList = new List <FrequencyResultData>();

            foreach (KeyValuePair <List <EwavFrequencyControlDto>, List <DescriptiveStatistics> > khp in dtoDictionary)
            {
                List <EwavFrequencyControlDto> outFreqList = new List <EwavFrequencyControlDto>();
                List <DescriptiveStatistics>   outDscStat  = new List <DescriptiveStatistics>();

                foreach (EwavFrequencyControlDto freqDto in khp.Key)
                {
                    outFreqList.Add(freqDto);
                }
                foreach (DescriptiveStatistics descStat in khp.Value)
                {
                    outDscStat.Add(descStat);
                }

                var frequencyResultData = new FrequencyResultData()
                {
                    FrequencyControlDtoList   = outFreqList,
                    DescriptiveStatisticsList = outDscStat
                };
                outputList.Add(frequencyResultData);
            }

            return(outputList);
        }
Example #34
0
        /// <summary>
        /// Constructor
        /// </summary>
        public DashboardRules(DashboardHelper dashboardHelper)
        {
            this.dashboardHelper = dashboardHelper;

            DataColumn runOrderColumn = new DataColumn(COLUMN_RUN_ORDER, typeof(int));
            DataColumn ruleColumn     = new DataColumn(COLUMN_RULE, typeof(IDashboardRule));

            runOrderColumn.AllowDBNull = false;
            ruleColumn.AllowDBNull     = false;

            this.ruleTable = new DataTable("ruleTable");
            RuleTable.Columns.Add(runOrderColumn);
            RuleTable.Columns.Add(ruleColumn);
        }
        public SimpleDataGrid(View view, IDbDriver db)
        {
            InitializeComponent();

            this.view = view;
            this.db = db;
            this.dashboardHelper = new DashboardHelper(view, db);
            this.dashboardHelper.PopulateDataSet();

            //dgResults.MouseDoubleClick += new MouseButtonEventHandler(dgResults_MouseDoubleClick);
            //dgResults.AutoGeneratingColumn += new EventHandler<DataGridAutoGeneratingColumnEventArgs>(dgResults_AutoGeneratingColumn);
            this.Loaded += new RoutedEventHandler(SimpleDataGrid_Loaded);
            this.SizeChanged += new SizeChangedEventHandler(SimpleDataGrid_SizeChanged);
        }
Example #36
0
        public LayerListItem(ESRI.ArcGIS.Client.Map myMap, Epi.View view, Epi.Data.IDbDriver db, DashboardHelper dashboardHelper, MapControl mapControl)
        {
            InitializeComponent();

            this.myMap = myMap;
            this.view = view;
            this.db = db;
            this.dashboardHelper = dashboardHelper;
            this.mapControl = mapControl;

            cbxLayerType.SelectionChanged += new SelectionChangedEventHandler(cbxLayerType_SelectionChanged);
            cbxLayerType.SelectedIndex = 0;
            lblLayerType.Foreground = new SolidColorBrush(FontColor);
        }
        public LayerListItem(ESRI.ArcGIS.Client.Map myMap, Epi.View view, Epi.Data.IDbDriver db, DashboardHelper dashboardHelper, MapControl mapControl)
        {
            InitializeComponent();

            this.myMap           = myMap;
            this.view            = view;
            this.db              = db;
            this.dashboardHelper = dashboardHelper;
            this.mapControl      = mapControl;

            cbxLayerType.SelectionChanged += new SelectionChangedEventHandler(cbxLayerType_SelectionChanged);
            cbxLayerType.SelectedIndex     = 0;
            lblLayerType.Foreground        = new SolidColorBrush(FontColor);
        }
Example #38
0
        public SimpleDataGrid(View view, IDbDriver db)
        {
            InitializeComponent();

            this.view            = view;
            this.db              = db;
            this.dashboardHelper = new DashboardHelper(view, db);
            this.dashboardHelper.PopulateDataSet();

            //dgResults.MouseDoubleClick += new MouseButtonEventHandler(dgResults_MouseDoubleClick);
            //dgResults.AutoGeneratingColumn += new EventHandler<DataGridAutoGeneratingColumnEventArgs>(dgResults_AutoGeneratingColumn);
            this.Loaded      += new RoutedEventHandler(SimpleDataGrid_Loaded);
            this.SizeChanged += new SizeChangedEventHandler(SimpleDataGrid_SizeChanged);
        }
Example #39
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="view">The view to attach</param>
        /// <param name="db">The database to attach</param>
        /// <param name="dashboardHelper">The dashboard helper to attach</param>
        public ExportControl(DashboardHelper dashboardHelper)
        {
            InitializeComponent();

            pnlTableOverwrite.Visibility = System.Windows.Visibility.Collapsed;
            pnlError.Visibility          = System.Windows.Visibility.Collapsed;
            pnlProgress.Visibility       = System.Windows.Visibility.Collapsed;

            this.dashboardHelper              = dashboardHelper;
            lbxExportFields.SelectionChanged += new SelectionChangedEventHandler(lbxExportFields_SelectionChanged);
            FillComboboxes();
            exportFields      = new List <string>();
            allFieldsSelected = true;

            imgClose.MouseEnter += new MouseEventHandler(imgClose_MouseEnter);
            imgClose.MouseLeave += new MouseEventHandler(imgClose_MouseLeave);
            imgClose.MouseDown  += new MouseButtonEventHandler(imgClose_MouseDown);

            cmbDataFormats.Items.Clear();
            this.GadgetProgressUpdate += new GadgetProgressUpdateHandler(RequestUpdateStatusMessage);

            foreach (Epi.DataSets.Config.DataDriverRow row in dashboardHelper.Config.DataDrivers)
            {
                if (row.Type == Configuration.PostgreSQLDriver || row.Type == Configuration.MySQLDriver)
                {
                    continue;
                }

                ComboBoxItem item = new ComboBoxItem();
                item.Content = row.DisplayName;
                //cmbDataFormats.Items.Add(new ComboBoxItem(row.Type, row.DisplayName, null));
                cmbDataFormats.Items.Add(item);
            }

            cmbDataFormats.SelectionChanged += new SelectionChangedEventHandler(cmbDataFormats_SelectionChanged);

            if (dashboardHelper.IsUsingEpiProject)
            {
                checkboxTabOrder.IsEnabled   = true;
                checkboxTabOrder.IsChecked   = true;
                checkboxUsePrompts.IsEnabled = true;
            }
            else
            {
                checkboxTabOrder.IsEnabled   = false;
                checkboxTabOrder.IsChecked   = false;
                checkboxUsePrompts.IsEnabled = false;
                checkboxUsePrompts.IsChecked = false;
            }
        }
Example #40
0
 private void DashboardViewer_ConfigureDataConnection(object sender, DashboardConfigureDataConnectionEventArgs e)
 {
     if (e.ConnectionParameters is ExtractDataSourceConnectionParameters extractParameters)
     {
         if (Guid.TryParse(extractParameters.FileName, out var id))
         {
             var extract = DashboardHelper.GetDataExtract(Application, ObjectSpace, id);
             if (extract != null)
             {
                 extract.ConfigureConnectionParameters(Application, extractParameters);
             }
         }
     }
 }
Example #41
0
        public bool Execute(string packageName, XmlNode xmlData)
        {
            string sectionToRemove = GetUninstallSection(xmlData);

            try
            {
                return(DashboardHelper.UninstallSection(sectionToRemove));
            }
            catch (System.Exception ex)
            {
                LogHelper.Error <UninstallSection>(string.Format("Error removing section(s): {0}", sectionToRemove), ex);
                return(false);
            }
        }
Example #42
0
        public ConditionalAssignDialog(DashboardHelper dashboardHelper, Rule_ConditionalAssign conditionalAssignRule)
        {
            InitializeComponent();
            this.dashboardHelper = dashboardHelper;
            this.DataFilters     = conditionalAssignRule.DataFilters;

            editMode = true;

            FillComboBoxes();

            this.txtDestinationField.Text    = conditionalAssignRule.DestinationColumnName;
            this.txtDestinationField.Enabled = false;

            SetAssignValue setAssignValue = new SetAssignValue(SetAssignmentValue);

            switch (conditionalAssignRule.DestinationColumnType)
            {
            case "System.SByte":
            case "System.Byte":
            case "System.Boolean":
                this.cbxFieldType.SelectedItem = "Yes/No";
                setAssignValue = new SetAssignValue(SetBooleanAssignmentValue);
                break;

            case "System.String":
                this.cbxFieldType.SelectedItem = "Text";
                break;

            case "System.Single":
            case "System.Double":
            case "System.Decimal":
            case "System.Int32":
            case "System.Int16":
                this.cbxFieldType.SelectedItem = "Numeric";
                break;
            }

            cbxFieldType.Enabled = false;

            this.txtAssignCondition.Text = DataFilters.GenerateReadableDataFilterString();

            //foreach (KeyValuePair<string, object> kvp in conditionalAssignRule.Conditions)
            //{
            //    this.txtAssignValue.Text = kvp.Value.ToString();
            //    break;
            //}

            setAssignValue(conditionalAssignRule);
        }
Example #43
0
        public DataTable GetLoadedData(DashboardHelper dashboardHelper, string dataKey, ref string valueField)
        {
            if (dashboardHelper == null)
            {
                return(null);
            }

            List <string> columnNames = new List <string>();

            if (dashboardHelper.IsUsingEpiProject)
            {
                columnNames.Add("UniqueKey");
            }
            columnNames.Add(valueField);
            columnNames.Add(dataKey);

            DataTable loadedData;

            if (valueField.Equals("{Record Count}"))
            {
                GadgetParameters gadgetOptions = new GadgetParameters();
                gadgetOptions.MainVariableName = dataKey;

                Dictionary <string, string> inputVariableList = new Dictionary <string, string>();
                inputVariableList.Add("freqvar", dataKey);
                inputVariableList.Add("allvalues", "false");
                inputVariableList.Add("showconflimits", "false");
                inputVariableList.Add("showcumulativepercent", "false");
                inputVariableList.Add("includemissing", "false");
                inputVariableList.Add("maxrows", "500");

                gadgetOptions.InputVariableList     = inputVariableList;
                gadgetOptions.ShouldIgnoreRowLimits = true;
                loadedData = dashboardHelper.GenerateFrequencyTableforMap(gadgetOptions).First().Key;

                foreach (DataRow dr in loadedData.Rows)
                {
                    dr[0] = dr[0].ToString().Trim();
                }

                _valueField = "freq";
            }
            else
            {
                loadedData = dashboardHelper.GenerateTable(columnNames);
            }

            return(loadedData);
        }
Example #44
0
        /// <summary>
        /// Sets up the rule
        /// </summary>
        /// <param name="table">The table in which to apply the rule</param>
        public override void SetupRule(DataTable table)
        {
            string destinationColumnType = this.DestinationColumnType;

            sourceColumnType = DashboardHelper.GetColumnType(this.SourceColumnName);

            DataColumn dc;

            switch (destinationColumnType)
            {
            case "System.Byte":
            case "System.SByte":
                dc = new DataColumn(this.DestinationColumnName, typeof(byte));
                break;

            case "System.Boolean":
                dc             = new DataColumn(this.DestinationColumnName, typeof(bool));
                dc.AllowDBNull = true;
                break;

            case "System.Single":
            case "System.Double":
                dc = new DataColumn(this.DestinationColumnName, typeof(double));
                break;

            case "System.Decimal":
                dc = new DataColumn(this.DestinationColumnName, typeof(decimal));
                break;

            case "System.String":
            default:
                dc = new DataColumn(this.DestinationColumnName, typeof(string));
                break;
            }

            if (!table.Columns.Contains(dc.ColumnName))
            {
                table.Columns.Add(dc);
            }
            else
            {
                foreach (DataRow row in table.Rows)
                {
                    row[dc.ColumnName] = DBNull.Value;
                }
            }

            //table.Columns.Add(dc);
        }
Example #45
0
        /// <summary>
        /// Renders the icon to the provided <paramref name="element"/>.
        /// </summary>
        /// <param name="element">The element to render to.</param>
        protected virtual void RenderIconTo(XmlElement element)
        {
            // Add item icon, if defined.
            if (!String.IsNullOrWhiteSpace(this.Icon))
            {
                // Add the icon class to include the padding and other background style options.
                DashboardHelper.AddClass(element, "icon");

                // Set the background image explicitly.
                DashboardHelper.AddStyle(element, "background-image", String.Format("url({0})", DashboardHelpersEx.ImageFileToDataUri(this.Icon)));
                DashboardHelper.AddStyle(element, "background-repeat", "no-repeat");
                DashboardHelper.AddStyle(element, "background-position", "0px center");
                DashboardHelper.AddStyle(element, "padding-left", "20px");
            }
        }
        public MapControl(View view, IDbDriver db)
        {
            InitializeComponent();
            this.view       = view;
            this.db         = db;
            dashboardHelper = new DashboardHelper(view, db);

            worker         = new System.ComponentModel.BackgroundWorker();
            worker.DoWork += new DoWorkEventHandler(worker_DoWork);
            worker.RunWorkerAsync();
            MapContainer.SizeChanged += new SizeChangedEventHandler(MapContainer_SizeChanged);
            imgClose.MouseDown       += new MouseButtonEventHandler(imgClose_MouseDown);

            this.MapBackground = Brushes.White;
        }
        /// <summary>
        /// Converts an icon image file to a valid path.
        /// Also works with resources.
        /// </summary>
        /// <param name="iconUri">The icon URI.</param>
        /// <returns>A value that can be used as an icon source.</returns>
        public static string ImageFileToDataUri(string iconUri)
        {
            // Resolve the icon uri. If the icon is a file, convert it to a data-uri,
            // otherwise assume the specified icon is a path that will resolve on the client
            // (just wrap in quotes).
            if (System.IO.File.Exists(iconUri))
            {
                return(DashboardHelper.ImageFileToDataUri(iconUri));
            }
            else
            {
                // Is it in a resource?
                var assembly = System.Reflection.Assembly.GetExecutingAssembly();
                foreach (var resource in assembly.GetManifestResourceNames())
                {
                    // TODO: Is this good enough?
                    if (resource.EndsWith(iconUri.Replace("/", ".")))
                    {
                        // Resolve the mime type.
                        string mimeType = "image/unknown";
                        string ext      = iconUri.Substring(iconUri.LastIndexOf(".")).ToLower();
                        Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ext);
                        if (regKey != null && regKey.GetValue("Content Type") != null)
                        {
                            mimeType = regKey.GetValue("Content Type").ToString();
                        }

                        // Base64 encode the image file content.
                        using (var memoryStream = new System.IO.MemoryStream())
                        {
                            using (var stream = assembly.GetManifestResourceStream(resource))
                            {
                                stream.CopyTo(memoryStream);
                            }
                            // Create and return the data uri.
                            return(String.Format
                                   (
                                       "data:{0};base64,{1}",
                                       mimeType,
                                       Convert.ToBase64String(memoryStream.ToArray())
                                   ));
                        }
                    }
                }

                return(String.Format("'{0}'", iconUri));
            }
        }
Example #48
0
 private void btnBrowse_Click(object sender, RoutedEventArgs e)
 {
     waitCursor.Visibility        = Visibility.Visible;
     tblockLoadingData.Visibility = Visibility.Visible;
     dashboardHelper = mapControl.GetNewDashboardHelper();
     // this.DashboardHelper = dashboardHelper;
     layerprop.SetdashboardHelper(dashboardHelper);
     waitCursor.Visibility        = Visibility.Collapsed;
     tblockLoadingData.Visibility = Visibility.Collapsed;
     if (dashboardHelper != null)
     {
         txtProjectPath.Text = mapControl.ProjectFilepath;
         FillComboBoxes();
         SetFilter();
     }
 }
Example #49
0
        /// <inheritdoc />
        protected override XmlDocumentFragment GenerateXmlDocumentFragment(XmlDocument xml)
        {
            var elementName = this.DashboardTableCellType == DashboardTableCellType.Header
                                ? "th"
                                : "td";
            var fragment = DashboardHelper.CreateFragment(xml, $"<{elementName}></{elementName}>");
            var element  = fragment.FirstChild;

            // Add the content.
            element.AppendChild
            (
                this.InnerContent?.Generate(xml) ?? DashboardHelper.CreateFragment(xml, "&nbsp;")
            );

            return(fragment);
        }
Example #50
0
        public RowFilterDialog(DashboardHelper dashboardHelper, FilterDialogMode pMode, DataFilters filters, bool includeUserDefinedVars)
        {
            InitializeComponent();
            this.includeUserDefinedVars = includeUserDefinedVars;
            this.dashboardHelper        = dashboardHelper;
            this.Mode = pMode;
            Construct();

            rfc        = new EpiDashboard.RowFilterControl(dashboardHelper, Mode, filters, includeUserDefinedVars);
            host.Child = rfc;

            System.Windows.Size elementSize = GetElementPixelSize(host.Child);

            this.Width  = (int)elementSize.Width + 90;
            this.Height = (int)elementSize.Height + 90;
        }
Example #51
0
        public DatatableBag GenerateCombinedFrequency(EwavCombinedFrequencyGadgetParameters combinedParameters, string groupVar, GadgetParameters gadgetParameters,
                                                      IEnumerable <EwavDataFilterCondition> ewavDataFilters, List <EwavRule_Base> rules, string filterString = "")
        {
            if (gadgetParameters.UseAdvancedDataFilter)
            {
                dh = new DashboardHelper(gadgetParameters, filterString, rules);
                gadgetParameters.UseAdvancedDataFilter  = true;
                gadgetParameters.AdvancedDataFilterText = filterString;
            }
            else
            {
                dh = new DashboardHelper(gadgetParameters, ewavDataFilters, rules);
            }

            //DataTable dt = dh.GenerateCombinedBooleanFrequencyTable(groupVar, sortHighToLow, gadgetParameters, rules);
            bool      booleanResults = false;
            int       fields         = -1;
            int       denominator    = -1;
            DataTable dt             = dh.GenerateCombinedFrequencyTable(combinedParameters, groupVar, ref booleanResults, ref fields, ref denominator, gadgetParameters, rules);

            if (dt != null)
            {
                DatatableBag dtBag = new DatatableBag(dt, "");

                List <DictionaryDTO> DictionaryObject = new List <DictionaryDTO>();

                DictionaryObject.Add(new DictionaryDTO()
                {
                    Key = new MyString("booleanResults"), Value = new MyString(booleanResults.ToString())
                });
                DictionaryObject.Add(new DictionaryDTO()
                {
                    Key = new MyString("fields"), Value = new MyString(fields.ToString())
                });
                DictionaryObject.Add(new DictionaryDTO()
                {
                    Key = new MyString("denominator"), Value = new MyString(denominator.ToString())
                });
                dtBag.ExtraInfo = DictionaryObject;

                return(dtBag);
            }
            else
            {
                throw new Exception("No Records found.");
            }
        }
Example #52
0
        private TwoxTwoTableDTO CreateDTO(GadgetParameters gp, DashboardHelper dh, DataTable table)
        {
            int YesRowIndexExp = 1;
            int NoRowIndexExp  = 0;
            int YesRowIndexOut = 1;
            int NoRowIndexOut  = 2;

            if (dh.GetColumnType(gp.MainVariableName.ToString()).ToLower() != "system.string")
            {
                YesRowIndexExp = FindYesRowIndex(table);

                NoRowIndexExp = FindNoRowIndex(table);
            }


            if (dh.GetColumnType(gp.CrosstabVariableName.ToString()).ToLower() != "system.string")
            {
                YesRowIndexOut = FindYesColIndex(table);

                NoRowIndexOut = FindNoColIndex(table);
            }

            TwoxTwoTableDTO ttDTO = new TwoxTwoTableDTO
            {
                Yy = int.Parse(table.Rows[YesRowIndexExp][YesRowIndexOut].ToString()),
                Yn = int.Parse(table.Rows[YesRowIndexExp][NoRowIndexOut].ToString()),
                Ny = int.Parse(table.Rows[NoRowIndexExp][YesRowIndexOut].ToString()),
                Nn = int.Parse(table.Rows[NoRowIndexExp][NoRowIndexOut].ToString())
            };

            //Yy = int.Parse(table.Rows[1][1].ToString()),
            //               Yn = int.Parse(table.Rows[1][2].ToString()),
            //               Ny = int.Parse(table.Rows[0][1].ToString()),
            //               Nn = int.Parse(table.Rows[0][2].ToString())
            //ttDTO.Rows[0, 1] = int.Parse(table.Rows[0][1].ToString());
            //ttDTO.Rows[0, 2] = int.Parse(table.Rows[0][2].ToString());
            //ttDTO.Rows[1, 1] = int.Parse(table.Rows[1][1].ToString());
            //ttDTO.Rows[1, 2] = int.Parse(table.Rows[1][2].ToString());



            ttDTO.ColumnName1 = table.Columns[1].ColumnName;
            ttDTO.ColumnName2 = table.Columns[2].ColumnName;

            return(ttDTO);
        }
Example #53
0
        /// <summary>
        /// Constructor for simple assignment with custom column type
        /// </summary>
        public Rule_ExpressionAssign(DashboardHelper dashboardHelper, string friendlyRule, string destinationColumnName, string destinationColumnType, string expression)
        {
            this.friendlyRule          = friendlyRule;
            this.destinationColumnName = destinationColumnName;
            this.destinationColumnType = destinationColumnType;
            this.DashboardHelper       = dashboardHelper;

            if (DestinationColumnType.Equals("System.String"))
            {
                this.variableType = DashboardVariableType.Text;
            }
            else
            {
                this.variableType = DashboardVariableType.Numeric;
            }
            this.expression = expression;
        }
Example #54
0
        public Rule_VariableGroup(DashboardHelper dashboardHelper, string name, List <string> groupVariables)
        {
            this.dashboardHelper = dashboardHelper;
            this.groupName       = name;
            this.variables       = new List <string>();

            foreach (string s in groupVariables)
            {
                variables.Add(s);
            }

            this.friendlyRule = "Create a variable group called " + this.groupName + " and include: ";
            foreach (string var in variables)
            {
                this.friendlyRule = this.friendlyRule + var + ", ";
            }
            this.friendlyRule = this.friendlyRule.TrimEnd(' ').TrimEnd(',');
        }
Example #55
0
        public static long CountTimeStopsByTimeInterval(DashboardHelper dashboardHelper, string timeVar)
        {
            List <string> columnNames = new List <string>();

            if (dashboardHelper.IsUsingEpiProject)
            {
                columnNames.Add("UniqueKey");
            }

            if (!string.IsNullOrEmpty(timeVar))
            {
                if (!columnNames.Exists(s => s.Equals(timeVar)))
                {
                    columnNames.Add(timeVar);
                }
            }

            DataTable data = dashboardHelper.GenerateTable(columnNames);

            var minTime = DateTime.MaxValue;
            var maxTime = DateTime.MinValue;
            var minX    = double.MaxValue;
            var maxX    = double.MinValue;
            var minY    = double.MaxValue;
            var maxY    = double.MinValue;

            if (data != null)
            {
                foreach (DataRow row in data.Rows)
                {
                    if (row[timeVar] != DBNull.Value)
                    {
                        DateTime time = (DateTime)row[timeVar];
                        minTime = minTime < time ? minTime : time;
                        maxTime = maxTime > time ? maxTime : time;
                    }
                }
            }

            IEnumerable <DateTime> intervals = TimeSlider.CreateTimeStopsByTimeInterval(
                new TimeExtent(minTime, maxTime), new TimeSpan(1, 0, 0, 0));

            return(intervals.ToList().Count);
        }
Example #56
0
        public void RestoreParametersTest()
        {
            using (var application = XpoInMemoryXafApplication.CreateInstance())
            {
                Dashboard dashboard = new Dashboard();
                dashboard.Parameters.Add(new DashboardParameter("IntParameter", typeof(int), 25));
                dashboard.Parameters.Add(new DashboardParameter("DateParameter", typeof(DateTime), new DateTime(2019, 04, 09)));
                var dashboardId = Guid.NewGuid().ToString();
                DashboardHelper.SaveParameters(application, dashboardId, dashboard.Parameters);

                dashboard.Parameters[0].Value = 0;
                dashboard.Parameters[1].Value = DateTime.MinValue;

                DashboardHelper.RestoreParameters(application, dashboardId, dashboard.Parameters);

                Assert.Equal(25, dashboard.Parameters[0].Value);
                Assert.Equal(new DateTime(2019, 04, 09), dashboard.Parameters[1].Value);
            }
        }
        public void UpdateDataExtractByKey(object key)
        {
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            using (var objectSpace = Application.CreateObjectSpace())
            {
                var extract = DashboardHelper.GetDataExtract(Application, objectSpace, key);
                if (extract == null)
                {
                    throw new ArgumentException($"No DashboardExtract found for the key '{key}'", nameof(key));
                }

                UpdateDataExtract(extract);
                objectSpace.CommitChanges();
            }
        }
Example #58
0
        ///// <summary>
        ///// Fired when the user changes a column selection
        ///// </summary>
        ///// <param name="sender">Object that fired the event</param>
        ///// <param name="e">.NET supplied event parameters</param>
        //private void lbxColumns_SelectionChanged(object sender, SelectionChangedEventArgs e)
        //{
        //    ShowHideOutputColumns();
        //}

        /// <summary>
        /// Checks the selected variables and enables/disables checkboxes as appropriate
        /// </summary>
        private void CheckVariables()
        {
            bool isDropDownList = false;
            bool isCommentLegal = false;
            bool isOptionField  = false;
            bool isRecoded      = false;

            if (cmbField.SelectedItem != null && !string.IsNullOrEmpty(cmbField.SelectedItem.ToString()))
            {
                foreach (DataRow fieldRow in DashboardHelper.FieldTable.Rows)
                {
                    if (fieldRow["columnname"].Equals(cmbField.SelectedItem.ToString()))
                    {
                        if (fieldRow["epifieldtype"] is TableBasedDropDownField || fieldRow["epifieldtype"] is YesNoField || fieldRow["epifieldtype"] is CheckBoxField)
                        {
                            isDropDownList = true;
                            if (fieldRow["epifieldtype"] is DDLFieldOfCommentLegal)
                            {
                                isCommentLegal = true;
                            }
                        }
                        else if (fieldRow["epifieldtype"] is OptionField)
                        {
                            isOptionField = true;
                        }
                        break;
                    }
                }

                if (DashboardHelper.IsUserDefinedColumn(cmbField.SelectedItem.ToString()))
                {
                    List <IDashboardRule> associatedRules = DashboardHelper.Rules.GetRules(cmbField.SelectedItem.ToString());
                    foreach (IDashboardRule rule in associatedRules)
                    {
                        if (rule is Rule_Recode)
                        {
                            isRecoded = true;
                        }
                    }
                }
            }
        }
 private void GetValueLists(string fieldName)
 {
     if (!String.IsNullOrEmpty(fieldName))
     {
         List <string> distinctValueList = new List <string>();
         if (DashboardHelper.GetAllGroupsAsList().Contains(fieldName))
         {
             foreach (string var in DashboardHelper.GetVariablesInGroup(fieldName))
             {
                 distinctValueList = DashboardHelper.GetDistinctValuesAsList(var);
                 AddRemoveValues(distinctValueList);
             }
         }
         else
         {
             distinctValueList = DashboardHelper.GetDistinctValuesAsList(fieldName);
             AddRemoveValues(distinctValueList);
         }
     }
 }
Example #60
0
        public void ParameterTypeChangedTest()
        {
            using (var application = XpoInMemoryXafApplication.CreateInstance())
            {
                Dashboard dashboard = new Dashboard();
                dashboard.Parameters.Add(new DashboardParameter("Parameter1", typeof(string), "aaa"));
                dashboard.Parameters.Add(new DashboardParameter("Parameter2", typeof(int), int.MaxValue));
                var dashboardId = Guid.NewGuid().ToString();
                DashboardHelper.SaveParameters(application, dashboardId, dashboard.Parameters);


                dashboard = new Dashboard();
                dashboard.Parameters.Add(new DashboardParameter("Parameter1", typeof(int), 25));
                dashboard.Parameters.Add(new DashboardParameter("Parameter2", typeof(byte), 35));

                DashboardHelper.RestoreParameters(application, dashboardId, dashboard.Parameters);

                Assert.Equal(25, dashboard.Parameters[0].Value);
                Assert.Equal(35, dashboard.Parameters[1].Value);
            }
        }