Exemplo n.º 1
0
        private List<IndicatorDropdownValue> GetRuleValues(SplittingType splitType, int dataTypeId)
        {
            var vals = new List<IndicatorDropdownValue>();

            if (options.SplitType == SplittingType.Split)
            {
                if (dataTypeId == (int)IndicatorDataType.Number)
                    vals.Add(new IndicatorDropdownValue { DisplayName = Translations.RedistrictRuleSplitByPercent, WeightedValue = (int)RedistrictingRule.SplitByPercent });
                vals.Add(new IndicatorDropdownValue { DisplayName = Translations.RedistrictRuleDefaultBlank, WeightedValue = (int)RedistrictingRule.DefaultBlank });
                vals.Add(new IndicatorDropdownValue { DisplayName = Translations.RedistrictRuleDuplicate, WeightedValue = (int)RedistrictingRule.Duplicate });
                vals.OrderBy(v => v.DisplayName).ToList();
            }
            else if (options.SplitType == SplittingType.Merge)
            {
                if (dataTypeId == (int)IndicatorDataType.Number || dataTypeId == (int)IndicatorDataType.Year || dataTypeId == (int)IndicatorDataType.Integer)
                {
                    vals.Add(new IndicatorDropdownValue { DisplayName = Translations.RedistrictRuleMin, WeightedValue = (int)MergingRule.Min });
                    vals.Add(new IndicatorDropdownValue { DisplayName = Translations.RedistrictRuleMax, WeightedValue = (int)MergingRule.Max });
                    if (dataTypeId == (int)IndicatorDataType.Number || dataTypeId == (int)IndicatorDataType.Integer)
                    {
                        vals.Add(new IndicatorDropdownValue { DisplayName = Translations.RedistrictRuleAverage, WeightedValue = (int)MergingRule.Average });
                        vals.Add(new IndicatorDropdownValue { DisplayName = Translations.RedistrictRuleSum, WeightedValue = (int)MergingRule.Sum });
                    }
                }
                else if (dataTypeId == (int)IndicatorDataType.Text || dataTypeId == (int)IndicatorDataType.LargeText || dataTypeId == (int)IndicatorDataType.Multiselect)
                {
                    vals.Add(new IndicatorDropdownValue { DisplayName = Translations.RedistrictRuleListAll, WeightedValue = (int)MergingRule.ListAll });
                }

                vals.Add(new IndicatorDropdownValue { DisplayName = Translations.RedistrictRuleDefaultBlank, WeightedValue = (int)MergingRule.DefaultBlank });
                vals.OrderBy(v => v.DisplayName).ToList();
            }

            return vals;
        }
Exemplo n.º 2
0
        private void AddRuleControls(List<Indicator> indicators, SplittingType splitType)
        {
            for (int i = 0; i < indicators.Count; i++)
            {
                var index = tblNewUnits.RowStyles.Add(new RowStyle { SizeType = SizeType.AutoSize });

                // Add control to screen
                var label = new H3bLabel { AutoSize = true, Text = indicators[i].DisplayName, Margin = new Padding(0, 5, 10, 5) };
                label.MakeBold();
                tblNewUnits.Controls.Add(label, 0, index);
                var cntrl = CreateDropdown(indicators[i], GetRuleValues(splitType, indicators[i].DataTypeId));
                tblNewUnits.Controls.Add(cntrl, 1, index);
            }
        }
Exemplo n.º 3
0
        public List<Indicator> GetCustomIndicatorsWithoutRedistrictingRules(SplittingType type)
        {
            List<Indicator> indicators = new List<Indicator>();

            string typeWhere = "";
            if (type == SplittingType.Merge)
                typeWhere = " AND MergeRuleId = 1";
            else if (type == SplittingType.Split)
                typeWhere = " AND RedistrictRuleId = 1";
            else
                typeWhere = " AND (MergeRuleId = 1 OR RedistrictRuleId = 1)";

            OleDbConnection connection = new OleDbConnection(DatabaseData.Instance.AccessConnectionString);
            using (connection)
            {
                connection.Open();
                try
                {
                    OleDbCommand command = command = new OleDbCommand(@"Select 
                        InterventionIndicators.ID,   
                        InterventionIndicators.DisplayName,
                        InterventionTypes.InterventionTypeName as TName,                  
                        InterventionIndicators.RedistrictRuleId,
                        InterventionIndicators.MergeRuleId,
                        InterventionIndicators.DataTypeId
                        FROM ((InterventionIndicators INNER JOIN InterventionTypes_to_Indicators ON InterventionTypes_to_Indicators.IndicatorId = InterventionIndicators.ID)
                            INNER JOIN InterventionTypes on InterventionTypes_to_Indicators.InterventionTypeId = InterventionTypes.Id)
                        WHERE IsEditable=-1 AND IsDisabled=0" + typeWhere, connection);
                    AddCustomIndicators(indicators, command, IndicatorEntityType.Intervention);

                    // process
                    command = command = new OleDbCommand(@"Select 
                        ProcessIndicators.ID,   
                        ProcessIndicators.DisplayName,
                        ProcessTypes.TypeName as TName,                  
                        ProcessIndicators.RedistrictRuleId,
                        ProcessIndicators.MergeRuleId,
                        ProcessIndicators.DataTypeId
                        FROM ProcessIndicators INNER JOIN ProcessTypes on ProcessIndicators.ProcessTypeId = ProcessTypes.Id
                        WHERE IsEditable=-1 AND IsDisabled=0" + typeWhere, connection);
                    AddCustomIndicators(indicators, command, IndicatorEntityType.Process);
                    // Survey
                    command = command = new OleDbCommand(@"Select 
                        SurveyIndicators.ID,   
                        SurveyIndicators.DisplayName,
                        SurveyTypes.SurveyTypeName as TName,                  
                        SurveyIndicators.RedistrictRuleId,
                        SurveyIndicators.MergeRuleId,
                        SurveyIndicators.DataTypeId
                        FROM SurveyIndicators INNER JOIN SurveyTypes on SurveyIndicators.SurveyTypeId = SurveyTypes.Id
                        WHERE IsEditable=-1 AND IsDisabled=0" + typeWhere, connection);
                    AddCustomIndicators(indicators, command, IndicatorEntityType.Survey);
                    // distro
                    command = command = new OleDbCommand(@"Select 
                        DiseaseDistributionIndicators.ID,   
                        DiseaseDistributionIndicators.DisplayName,
                        Diseases.DisplayName as TName,                  
                        DiseaseDistributionIndicators.RedistrictRuleId,
                        DiseaseDistributionIndicators.MergeRuleId,
                        DiseaseDistributionIndicators.DataTypeId
                        FROM DiseaseDistributionIndicators INNER JOIN Diseases on DiseaseDistributionIndicators.DiseaseId = Diseases.Id
                        WHERE IsEditable=-1 AND IsDisabled=0" + typeWhere, connection);
                    AddCustomIndicators(indicators, command, IndicatorEntityType.DiseaseDistribution);





                }
                catch (Exception)
                {
                    throw;
                }
            }

            return indicators;
        }
Exemplo n.º 4
0
 public JoyConSplittingEventArgs(JoyCon sourceJoyCon, SplittingType splittingType)
 {
     SourceJoyCon  = sourceJoyCon;
     SplittingType = splittingType;
 }