コード例 #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();
        }
コード例 #2
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();
        }