Example #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            List <DateRange> dateRangeList = checkDateTimeRangeValidate();

            if (dateRangeList == null)
            {
                return;
            }
            ForNameForm form = new ForNameForm();

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

            setting.name_      = form.name_;
            setting.rangeList_ = dateRangeList;
            foreach (var item in dateRangeList)
            {
                Dictionary <String, Object> row = new Dictionary <string, Object>();
                row["name"]  = setting.name_;
                row["start"] = item.startDate_;
                row["end"]   = item.endDate_;
                DB.Global().Insert("daterange_setting", row);
            }
            BindingSource bs = (BindingSource)(nameListBox_.DataSource);

            bs.Add(setting);
            Utils.SetSysInfo(DB.Global(), "DateRangeSettingForm.daterange", nameListBox_.SelectedItem.ToString());
        }
Example #2
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");
        }