예제 #1
0
        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);
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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;
                }
            }
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
 private void UploadAllToolStripMenuItem_Click(object sender, EventArgs e)
 {
     bank.Charge();
     //CustomersBindingSource.ResetBindings(false);
     DepositsBindingSource.ResetBindings(false);
 }