Esempio n. 1
0
        private void primaryRestoreButton_Click(object sender, EventArgs e)
        {
            BindingList <ItemWeightRecord> recordList = this.primaryPrimaryWeightGridControl.DataSource as BindingList <ItemWeightRecord>;
            int number = recordList.Count;

            double[] itemArray = ManualAssignmentPlatformWeightSetMethod.getAverageWeight(number);
            ManualAssignmentPlatformWeightSetMethod manualSet = (ManualAssignmentPlatformWeightSetMethod)this.Strategy.PlatformWeightSetMethod.Value;
            SerializableDictionary <string, SerializableDictionary <string, double> > primaryWeightDict = manualSet.PrimaryVariableWeightDict;
            string primaryVariableStr = primaryPrimaryVariableListBoxControl.SelectedItem as string;

            foreach (ItemWeightRecord record in recordList)
            {
                if (recordList.IndexOf(record) != recordList.Count - 1)
                {
                    record.Weight = itemArray[0];
                }
                else
                {
                    record.Weight = itemArray[number - 1];
                }
                string primayItemStr = record.Item;
                primaryWeightDict[primaryVariableStr][primayItemStr] = record.Weight;
            }
            this.primaryPrimaryWeightGridControl.DataSource = recordList;
            this.setPrimaryGridView();
            this.primaryPrimaryWeightGridControl.RefreshDataSource();
        }
Esempio n. 2
0
        private void secondaryVariableDependenceListBoxControl_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListBoxControl listBoxControl = sender as ListBoxControl;
            int            selectIndex    = listBoxControl.SelectedIndex;
            string         temVariableStr = listBoxControl.SelectedItem as string;

            if (selectIndex >= 0 && listBoxControl.Focused)
            {
                string[] keyArray = Regex.Split(temVariableStr, " --- ", RegexOptions.IgnoreCase);
                if (keyArray.Length == 2)
                {
                    string primaryKey   = keyArray[0];
                    string secondaryKey = keyArray[1];
                    ManualAssignmentPlatformWeightSetMethod manualSet = (ManualAssignmentPlatformWeightSetMethod)this.Strategy.PlatformWeightSetMethod.Value;
                    SerializableDictionary <VariableDependenceRecordKey, VariableDependenceRecord> primaryWeightDict = manualSet.SecondaryItemWeightSetMethod.Value.DependenceRecordDict;
                    VariableDependenceRecord record      = primaryWeightDict[new VariableDependenceRecordKey(primaryKey, secondaryKey)];
                    List <string>            itemStrList = new List <string>(record.ItemDependencDict.Keys);
                    this.secondaryPrimaryVariableListBoxControl.DataSource    = itemStrList;
                    this.secondaryPrimaryVariableListBoxControl.SelectedIndex = -1;
                    this.secondarySecondaryVariablGridControl.DataSource      = null;
                }
                else
                {
                    throw new Exception("key array length error");
                }
            }
        }
Esempio n. 3
0
        private void primaryPrimaryVariableListBoxControl_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListBoxControl listBoxControl = sender as ListBoxControl;
            int            selectIndex    = listBoxControl.SelectedIndex;
            string         temVariableStr = listBoxControl.SelectedItem as string;

            if (selectIndex >= 0 && listBoxControl.Focused)
            {
                ManualAssignmentPlatformWeightSetMethod manualSet = (ManualAssignmentPlatformWeightSetMethod)this.Strategy.PlatformWeightSetMethod.Value;
                SerializableDictionary <string, SerializableDictionary <string, double> > primaryWeightDict = manualSet.PrimaryVariableWeightDict;
                this.primaryPrimaryWeightGridControl.DataSource = this.getItemWeightRecordList(primaryWeightDict[temVariableStr]);
                this.setPrimaryGridView();
            }
        }
Esempio n. 4
0
        private void primaryGridView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            GridView gridView = sender as GridView;

            if (e.Column.FieldName.Equals("Weight"))
            {
                string cellValue          = e.Value.ToString();
                int    selectIndex        = primaryPrimaryVariableListBoxControl.SelectedIndex;
                string primaryVariableStr = primaryPrimaryVariableListBoxControl.SelectedItem as string;
                if (selectIndex >= 0)
                {
                    string primayItemStr = gridView.GetRowCellValue(e.RowHandle, gridView.Columns["Item"]) as string;
                    ManualAssignmentPlatformWeightSetMethod manualSet = (ManualAssignmentPlatformWeightSetMethod)this.Strategy.PlatformWeightSetMethod.Value;
                    SerializableDictionary <string, SerializableDictionary <string, double> > primaryWeightDict = manualSet.PrimaryVariableWeightDict;
                    primaryWeightDict[primaryVariableStr][primayItemStr] = (double)e.Value;
                }
            }
        }
Esempio n. 5
0
        private void secondaryVariableRadioGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            RadioGroup radioGroup = sender as RadioGroup;
            int        index      = radioGroup.SelectedIndex;
            ManualAssignmentPlatformWeightSetMethod manualSet = this.Strategy.PlatformWeightSetMethod.Value as ManualAssignmentPlatformWeightSetMethod;
            Type secondaryItemType = StrategyOptionMapping.SecondaryItemWeightSetIndexDict[index];

            manualSet.SecondaryItemWeightSetMethod.Value = manualSet.SecondaryItemWeightSetMethodDict[secondaryItemType.FullName];
            if (index == StrategyOptionMapping.SecondaryItemWeightSetTypeDict[StrategyOptionMapping.equalSecondaryItemWeightSetTypeName])
            {
                this.groupBox5.Enabled = false;
            }
            else if (index == StrategyOptionMapping.SecondaryItemWeightSetTypeDict[StrategyOptionMapping.manualSecondaryItemWeightSetTypeName])
            {
                this.groupBox5.Enabled = true;
                loadSeconaryItemWeightData(manualSet.SecondaryItemWeightSetMethod.Value.DependenceRecordDict);
            }
        }
Esempio n. 6
0
        private void platformWeightRadioGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            RadioGroup radioGroup            = sender as RadioGroup;
            int        index                 = radioGroup.SelectedIndex;
            Type       platformWeightSetType = StrategyOptionMapping.PlatformWeightSetIndexDict[index];

            this.Strategy.PlatformWeightSetMethod.Value = this.Strategy.PlatformWeightSetMethodDict[platformWeightSetType.FullName];

            if (radioGroup.SelectedIndex == StrategyOptionMapping.PlatformWeightSetTypeDict[StrategyOptionMapping.manualWeightSetTypeName])
            {
                this.manualAssignNode.Expanded = true;
                this.autoAssignNode.Expanded   = false;
                // load the manual assignment data
                //load primary variable data
                ManualAssignmentPlatformWeightSetMethod manualSet = (ManualAssignmentPlatformWeightSetMethod)this.Strategy.PlatformWeightSetMethod.Value;
                SerializableDictionary <string, SerializableDictionary <string, double> > primaryWeightDict = manualSet.PrimaryVariableWeightDict;
                SerializableDictionary <string, SerializableDictionary <string, double> > .KeyCollection primaryVarialbeStrList = primaryWeightDict.Keys;

                this.primaryPrimaryVariableListBoxControl.DataSource = primaryVarialbeStrList;
                // load the secondary variable
                Type secondaryItemType = manualSet.SecondaryItemWeightSetMethod.Value.GetType();
                this.secondaryVariableRadioGroup.SelectedIndex = StrategyOptionMapping.SecondaryItemWeightSetTypeDict[secondaryItemType];
            }
            else if (radioGroup.SelectedIndex == StrategyOptionMapping.PlatformWeightSetTypeDict[StrategyOptionMapping.autoWeightSetTypeName])
            {
                this.autoAssignNode.Expanded   = true;
                this.manualAssignNode.Expanded = false;
                // load the auto assignment data
                // language priority load
                AutoAssignmentPlatformWeightSetMethod autoSet = (AutoAssignmentPlatformWeightSetMethod)this.Strategy.PlatformWeightSetMethod.Value;
                Type languagePriorityType = autoSet.FactorPrioritySetMethod.Value.GetType();
                this.factorPriorityRadioGroup.SelectedIndex = StrategyOptionMapping.FactorPriorityTypeDict[languagePriorityType];
                // platform priority load
                Type platformPriorityType = autoSet.PlatformPrioritySetMethod.Value.GetType();
                this.platformPriorityRadioGroup.SelectedIndex = StrategyOptionMapping.PlatformPriorityTypeDict[platformPriorityType];
            }
        }
Esempio n. 7
0
        private void secondaryRestoreButton_Click(object sender, EventArgs e)
        {
            BindingList <ItemWeightRecord> recordList = this.secondaryGridView.DataSource as BindingList <ItemWeightRecord>;
            int number = recordList.Count;

            double[] itemArray           = ManualAssignmentPlatformWeightSetMethod.getAverageWeight(number);
            int      variableSelectIndex = this.secondaryVariableDependenceListBoxControl.SelectedIndex;
            string   variableRelationKey = secondaryVariableDependenceListBoxControl.SelectedItem as string;

            string[] keyArray     = Regex.Split(variableRelationKey, " --- ", RegexOptions.IgnoreCase);
            string   primaryKey   = keyArray[0];
            string   secondaryKey = keyArray[1];
            ManualAssignmentPlatformWeightSetMethod manualSet = (ManualAssignmentPlatformWeightSetMethod)this.Strategy.PlatformWeightSetMethod.Value;
            SerializableDictionary <VariableDependenceRecordKey, VariableDependenceRecord> secondaryWeightDict = manualSet.SecondaryItemWeightSetMethod.Value.DependenceRecordDict;
            VariableDependenceRecord record = secondaryWeightDict[new VariableDependenceRecordKey(primaryKey, secondaryKey)];
            int    itemSelectIndex          = this.secondaryPrimaryVariableListBoxControl.SelectedIndex;
            string itemRelationKey          = this.secondaryPrimaryVariableListBoxControl.SelectedItem as string;


            foreach (ItemWeightRecord itemRecord in recordList)
            {
                if (recordList.IndexOf(itemRecord) != recordList.Count - 1)
                {
                    itemRecord.Weight = itemArray[0];
                }
                else
                {
                    itemRecord.Weight = itemArray[number - 1];
                }
                string secondaryItemStr = itemRecord.Item;
                record.ItemDependencDict[itemRelationKey][secondaryItemStr].Weight = itemRecord.Weight;
            }
            this.secondarySecondaryVariablGridControl.DataSource = recordList;
            this.setSecondaryGridView();
            this.secondarySecondaryVariablGridControl.RefreshDataSource();
        }
Esempio n. 8
0
        private void secondaryGridView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            GridView gridView = sender as GridView;

            if (e.Column.FieldName.Equals("Weight"))
            {
                string cellValue = e.Value.ToString();

                int    variableSelectIndex = this.secondaryVariableDependenceListBoxControl.SelectedIndex;
                string variableRelationKey = secondaryVariableDependenceListBoxControl.SelectedItem as string;
                if (variableSelectIndex >= 0)
                {
                    string[] keyArray = Regex.Split(variableRelationKey, " --- ", RegexOptions.IgnoreCase);
                    if (keyArray.Length == 2)
                    {
                        string primaryKey   = keyArray[0];
                        string secondaryKey = keyArray[1];
                        ManualAssignmentPlatformWeightSetMethod manualSet = (ManualAssignmentPlatformWeightSetMethod)this.Strategy.PlatformWeightSetMethod.Value;
                        SerializableDictionary <VariableDependenceRecordKey, VariableDependenceRecord> secondaryWeightDict = manualSet.SecondaryItemWeightSetMethod.Value.DependenceRecordDict;
                        VariableDependenceRecord record = secondaryWeightDict[new VariableDependenceRecordKey(primaryKey, secondaryKey)];

                        int    itemSelectIndex = this.secondaryPrimaryVariableListBoxControl.SelectedIndex;
                        string itemRelationKey = this.secondaryPrimaryVariableListBoxControl.SelectedItem as string;
                        if (itemSelectIndex >= 0)
                        {
                            string secondaryItemStr = gridView.GetRowCellValue(e.RowHandle, gridView.Columns["Item"]) as string;
                            record.ItemDependencDict[itemRelationKey][secondaryItemStr].Weight = (double)e.Value;
                        }
                    }
                    else
                    {
                        throw new Exception("key array length error");
                    }
                }
            }
        }