示例#1
0
        void autoSetName()
        {
            if (slnComboBox_.SelectedItem == null ||
                dateRangeComboBox_.SelectedItem == null)
            {
                return;
            }
            SolutionSetting  slnSetting       = (SolutionSetting)slnComboBox_.SelectedItem;
            DateRangeSetting dateRangeSetting = (DateRangeSetting)dateRangeComboBox_.SelectedItem;

            name_.Text = String.Join("-", slnSetting.name_, dateRangeSetting.name_);
        }
示例#2
0
        private void nameListBox__SelectedIndexChanged(object sender, EventArgs e)
        {
            DataTable dt = (DataTable)straGrid_.DataSource;

            dt.Rows.Clear();
            cmbBox_.Visible = false;
            SolutionSetting setting = (SolutionSetting)nameListBox_.SelectedItem;

            if (setting == null)
            {
                return;
            }
            foreach (var item in setting.straList_)
            {
                var row = dt.NewRow();
                row["Name"] = item.name();
                dt.Rows.Add(row);
            }
        }
示例#3
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            DataTable dt = (DataTable)straGrid_.DataSource;

            dt.Rows.Clear();
            cmbBox_.Visible = false;
            SolutionSetting setting = (SolutionSetting)nameListBox_.SelectedItem;

            if (setting == null)
            {
                return;
            }
            if (DialogResult.Yes != MessageBox.Show("Are you sure to remove ?", "Selector", MessageBoxButtons.YesNo))
            {
                return;
            }
            DB.Global().Execute(String.Format("Delete From solution_setting Where solution = '{0}'", setting.name_));
            BindingSource bs = (BindingSource)(nameListBox_.DataSource);

            bs.Remove(setting);
        }
示例#4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            SolutionSetting setting = (SolutionSetting)nameListBox_.SelectedItem;

            setting.straList_.Clear();
            cmbBox_.Visible = false;
            DB.Global().Execute(String.Format("Delete From solution_setting Where solution = '{0}'", setting.name_));
            DataTable     dt           = (DataTable)straGrid_.DataSource;
            List <String> straNameList = toStraNameList(dt);

            foreach (var name in straNameList)
            {
                setting.straList_.Add(App.grp_.strategy(name));
                Dictionary <String, Object> row = new Dictionary <string, Object>();
                row["solution"] = setting.name_;
                row["strategy"] = name;
                DB.Global().Insert("solution_setting", row);
            }
            App.ReadSolutionSetting();
            MessageBox.Show("Save success", "Selector");
        }
示例#5
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            ForNameForm form = new ForNameForm();

            foreach (var item in App.customSolutionSettingList_)
            {
                form.allreadyExistNameList_.Add(item.name_);
            }
            foreach (var item in App.autoSolutionSettingList_)
            {
                form.allreadyExistNameList_.Add(item.name_);
            }
            if (DialogResult.OK != form.ShowDialog())
            {
                return;
            }
            SolutionSetting setting = new SolutionSetting();

            setting.name_     = form.name_;
            setting.straList_ = new List <IStrategy>();
            DataTable     dt           = (DataTable)straGrid_.DataSource;
            List <String> straNameList = toStraNameList(dt);

            foreach (var name in straNameList)
            {
                setting.straList_.Add(App.grp_.strategy(name));
                Dictionary <String, Object> row = new Dictionary <string, Object>();
                row["solution"] = setting.name_;
                row["strategy"] = name;
                DB.Global().Insert("solution_setting", row);
            }
            BindingSource bs = (BindingSource)(nameListBox_.DataSource);

            bs.Add(setting);
            App.ReadSolutionSetting();
            MessageBox.Show("Add success", "Selector");
        }