private void CreateDeposToolStripMenuItem_Click(object sender, EventArgs e) { Customer customer = usersGridView.SelectedRows[0].DataBoundItem as Customer; if (customer == null) { return; } var createDepositForm = new DepositAddingForm(bank, customer); DialogResult res = createDepositForm.ShowDialog(); if (res == DialogResult.OK) { isDirty = true; } DepositsBindingSource.ResetBindings(false); }
private void EditDepositToolStripMenuItem_Click(object sender, EventArgs e) { Deposit selectedDeposit = depositsGridView.SelectedRows[0].DataBoundItem as Deposit; if (selectedDeposit != null) { var depositEditingForm = new DepositEditingForm( usersGridView.SelectedRows[0].DataBoundItem as Customer, selectedDeposit ); DialogResult res = depositEditingForm.ShowDialog(); if (res == DialogResult.OK) { isDirty = true; } DepositsBindingSource.ResetBindings(false); } }
private void DeleteDepositToolStripMenuItem_Click(object sender, EventArgs e) { Customer selectedCustomer = usersGridView.SelectedRows[0].DataBoundItem as Customer; Deposit selectedDeposit = depositsGridView.SelectedRows[0].DataBoundItem as Deposit; if (selectedDeposit != null) { DialogResult res = MessageBox.Show( "Удалить депозит?", "Подтверждение", MessageBoxButtons.OKCancel ); if (res == DialogResult.OK) { selectedCustomer.Deposits.Remove(selectedDeposit); DepositsBindingSource.ResetBindings(false); isDirty = true; } } }
private void UsersGridView_SelectionChanged(object sender, EventArgs e) { bool isSelectedNull = usersGridView.SelectedRows.Count == 0; EnableCustomerButtons(!isSelectedNull); if (isSelectedNull) { DepositsBindingSource.DataSource = new List <Deposit>(); DepositsBindingSource.ResetBindings(false); return; } Customer selectedCustomer = usersGridView.SelectedRows[0].DataBoundItem as Customer; if (!isSelectedNull) { DepositsBindingSource.DataSource = selectedCustomer.Deposits; DepositsBindingSource.ResetBindings(false); } }
private void UploadAllToolStripMenuItem_Click(object sender, EventArgs e) { bank.Charge(); //CustomersBindingSource.ResetBindings(false); DepositsBindingSource.ResetBindings(false); }