Esempio n. 1
0
        public int ResetBlockedFactors(String measureName, String metricName, Boolean updateExisting)
        {
            int blockedFactorCount = 0;
            if (updateExisting == false)
            {
                // Show all factors as blocked factors with appropriate drop downs
                ConfigBlockFactorTable.Clear();
            }
            else if (ConfigBlockFactorTable == null)
            {
                return - 1;
            }

            foreach (ExperimentMeasure expMeasure in ConfigMeasuresTable)
            {
                if ((expMeasure.Measure.Category.CompareTo(measureName) == 0) &&
                    (expMeasure.Measure.SubCategory.CompareTo("Metric") != 0))
                {
                    Boolean blockedFactorFound = false;

                    foreach (BlockedFactorItem item in ConfigBlockFactorTable)
                    {
                        if (item.FactorName.CompareTo(expMeasure.Measure.SubCategory) == 0)
                        {
                            blockedFactorFound = true;
                            break;
                        }
                    }

                    if (!blockedFactorFound)
                    {
                        BlockedFactorItem factorItem = new BlockedFactorItem();
                        factorItem.FactorName = expMeasure.Measure.SubCategory;
                        factorItem.MeasureID = expMeasure.Measure.MeasureID;
                        factorItem.FactorLevelNames = new ObservableCollection<string>();
                        factorItem.FactorLevelNames.Add("Click here to select");

                        foreach (ExperimentMeasure expMeasure2 in ConfigMeasuresTable)
                        {
                            if ((expMeasure2.Measure.Category.CompareTo(measureName) == 0) &&
                                (expMeasure2.Measure.SubCategory.CompareTo(factorItem.FactorName) == 0) &&
                                (expMeasure2.ExperimentEntityID > 0) &&
                                (!factorItem.FactorLevelNames.Contains(expMeasure2.ExperimentEntity.Name)))
                            {
                                factorItem.FactorLevelNames.Add(expMeasure2.ExperimentEntity.Name);
                            }
                            else if ((expMeasure2.Measure.Category.CompareTo(measureName) == 0) &&
                                (expMeasure2.Measure.SubCategory.CompareTo(factorItem.FactorName) == 0) &&
                                ((!expMeasure2.ExperimentEntityID.HasValue) || (expMeasure2.ExperimentEntityID == 0)) &&
                                (!factorItem.FactorLevelNames.Contains(expMeasure2.Measure.Name)))
                            {
                                factorItem.FactorLevelNames.Add(expMeasure2.Measure.Name);
                            }
                        }

                        if (factorItem.FactorLevelNames.Count == 1)
                        {
                            factorItem.FactorLevelNames.Clear();
                        }

                        ConfigBlockFactorTable.Add(factorItem);
                        blockedFactorCount++;
                    }
                }
            }

            // Remove set Factors from Blocked Factor list
            if (updateExisting)
            {
                foreach (DisplayFactor df in CurConfigDisplay.DisplayFactors)
                {
                    foreach (BlockedFactorItem bf in ConfigBlockFactorTable)
                    {
                        if (bf.FactorName.CompareTo(df.FactorName) == 0)
                        {
                            ConfigBlockFactorTable.Remove(bf);
                            blockedFactorCount--;
                            break;
                        }
                    }
                }
            }
                        
            OnPropertyChanged("ConfigBlockFactorTable");

            return blockedFactorCount;
        }
Esempio n. 2
0
        public int ResetBlockedFactors(String measureName, String metricName, Boolean updateExisting)
        {
            int blockedFactorCount = 0;

            if (updateExisting == false)
            {
                // Show all factors as blocked factors with appropriate drop downs
                ConfigBlockFactorTable.Clear();
            }
            else if (ConfigBlockFactorTable == null)
            {
                return(-1);
            }

            foreach (ExperimentMeasure expMeasure in ConfigMeasuresTable)
            {
                if ((expMeasure.Measure.Category.CompareTo(measureName) == 0) &&
                    (expMeasure.Measure.SubCategory.CompareTo("Metric") != 0))
                {
                    Boolean blockedFactorFound = false;

                    foreach (BlockedFactorItem item in ConfigBlockFactorTable)
                    {
                        if (item.FactorName.CompareTo(expMeasure.Measure.SubCategory) == 0)
                        {
                            blockedFactorFound = true;
                            break;
                        }
                    }

                    if (!blockedFactorFound)
                    {
                        BlockedFactorItem factorItem = new BlockedFactorItem();
                        factorItem.FactorName       = expMeasure.Measure.SubCategory;
                        factorItem.MeasureID        = expMeasure.Measure.MeasureID;
                        factorItem.FactorLevelNames = new ObservableCollection <string>();
                        factorItem.FactorLevelNames.Add("Click here to select");

                        foreach (ExperimentMeasure expMeasure2 in ConfigMeasuresTable)
                        {
                            if ((expMeasure2.Measure.Category.CompareTo(measureName) == 0) &&
                                (expMeasure2.Measure.SubCategory.CompareTo(factorItem.FactorName) == 0) &&
                                (expMeasure2.ExperimentEntityID > 0) &&
                                (!factorItem.FactorLevelNames.Contains(expMeasure2.ExperimentEntity.Name)))
                            {
                                factorItem.FactorLevelNames.Add(expMeasure2.ExperimentEntity.Name);
                            }
                            else if ((expMeasure2.Measure.Category.CompareTo(measureName) == 0) &&
                                     (expMeasure2.Measure.SubCategory.CompareTo(factorItem.FactorName) == 0) &&
                                     ((!expMeasure2.ExperimentEntityID.HasValue) || (expMeasure2.ExperimentEntityID == 0)) &&
                                     (!factorItem.FactorLevelNames.Contains(expMeasure2.Measure.Name)))
                            {
                                factorItem.FactorLevelNames.Add(expMeasure2.Measure.Name);
                            }
                        }

                        if (factorItem.FactorLevelNames.Count == 1)
                        {
                            factorItem.FactorLevelNames.Clear();
                        }

                        ConfigBlockFactorTable.Add(factorItem);
                        blockedFactorCount++;
                    }
                }
            }

            // Remove set Factors from Blocked Factor list
            if (updateExisting)
            {
                foreach (DisplayFactor df in CurConfigDisplay.DisplayFactors)
                {
                    foreach (BlockedFactorItem bf in ConfigBlockFactorTable)
                    {
                        if (bf.FactorName.CompareTo(df.FactorName) == 0)
                        {
                            ConfigBlockFactorTable.Remove(bf);
                            blockedFactorCount--;
                            break;
                        }
                    }
                }
            }

            OnPropertyChanged("ConfigBlockFactorTable");

            return(blockedFactorCount);
        }