private void MenuSetRuleClick(object sender, EventArgs e) { var form = new FormRule(); form.Year = Year; form.Month = Month; form.Rule = new RepeatRule(Year, Month, new RepeatRule.MonthRule()); form.Rule.RuleClass.WeekNumber = RepeatRule.GetWeekNo(calendar1.SelectedDate); form.Rule.RuleClass.DayOfWeek = (RepeatRule.DayOfWeek)calendar1.SelectedDate.DayOfWeek; form.Rule.RuleClass.Interval = 0; if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //Person.Requirement.RepeatRule.Add(form.Rule); //AddedRule.Add(form.Rule); setDgv(form.Rule); setRule(form.Rule); } }
private void btnEdit_Click(object sender, EventArgs e) { if (dgvRule.SelectedRows.Count == 0) { return; } var form = new FormRule(); form.Year = Year; form.Month = Month; form.Rule = dgvRule.SelectedRows[0].Tag as RepeatRule; if (form.ShowDialog() == DialogResult.OK) { var target = dgvRule.SelectedRows[0].Tag as RepeatRule; DeleteFromCalendar(target); DeletedRule.Add(target); setDgv(form.Rule); setRule(form.Rule); } }
private void btnAddRule_Click(object sender, EventArgs e) { var form = new FormRule(); form.Year = Year; form.Month = Month; if (form.ShowDialog() == DialogResult.OK) { /*if (checkDuplicateRule(form.Rule)) * { * MessageBox.Show("重複した条件は登録できません。", "条件の重複"); * return; * } */ //Person.Requirement.RepeatRule.Add(form.Rule); //AddedRule.Add(form.Rule); setDgv(form.Rule); setRule(form.Rule); } }