Beispiel #1
0
        private void AccountAddDialog()
        {
            var diag = new Form_AccountAddDialog();

            if (diag.ShowDialog() == DialogResult.OK)
            {
                var acc = new Account();
                acc.name    = diag.AccountName;
                acc.login   = diag.AccountLogin;
                acc.premium = diag.AccountPremium;
                acc.house   = diag.AccountHouse;

                _accounts.Add(acc);
                AccountsPopulate();
                AccountsSave(file_accounts);
            }
        }
Beispiel #2
0
        private void dataGridView_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            e.Cancel = true;

            var acc = _accounts.Where(a => a.name == (string)dataGridView.Rows[e.RowIndex].Cells[0].Value).FirstOrDefault();

            if (acc != null)
            {
                var diag = new Form_AccountAddDialog(acc.name, acc.login, acc.premium, acc.house);

                if (diag.ShowDialog() == DialogResult.OK)
                {
                    acc.name    = diag.AccountName;
                    acc.login   = diag.AccountLogin;
                    acc.premium = diag.AccountPremium;
                    acc.house   = diag.AccountHouse;

                    AccountsDisplayInfo(acc);

                    AccountsPopulate();
                    AccountsSave(file_accounts);
                }
            }
        }