public ConditionEditingForm( MyBank bank, DepositCondition condition, bool isCreating) { InitializeComponent(); this.bank = bank; this.condition = condition; this.isCreating = isCreating; intervalComboBox.DataSource = Enum.GetValues(typeof(AccrualsInterval)); intervalComboBox.SelectedItem = condition.Interval; percentUpDown.Value = condition.Percent; durationUpDown.Value = condition.Duration; }
private void AddButton_Click(object sender, EventArgs e) { DepositCondition condition = new DepositCondition( 10, AccrualsInterval.month, 12 ); var editForm = new ConditionEditingForm(bank, condition, true); DialogResult res = editForm.ShowDialog(); if (res == DialogResult.OK) { isDirty = true; } conditionsBindingSource.ResetBindings(false); }
private void DeleteButton_Click(object sender, EventArgs e) { if (conditionsGridView.SelectedRows.Count == 0) { return; } DialogResult res = MessageBox.Show("Удалить?", "", MessageBoxButtons.YesNo); if (res == DialogResult.No) { return; } DepositCondition condition = conditionsGridView.SelectedRows[0].DataBoundItem as DepositCondition; bank.DepositConditions.Remove(condition); isDirty = true; conditionsBindingSource.ResetBindings(false); }