示例#1
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            var newItem = new UserAccount();

            using (var frm = new AccountInfoDialog())
            {
                frm.UserAccountItem = newItem;
                if (frm.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                DisplayToGridRow(newItem, Grid.Rows[Grid.Rows.Add()]);
            }
        }
示例#2
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            var item = (UserAccount)Grid.CurrentRow?.Tag;

            if (item == null)
            {
                return;
            }
            using (var frm = new AccountInfoDialog())
            {
                frm.UserAccountItem = item;
                if (frm.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                DisplayToGridRow(item, Grid.CurrentRow);
            }
        }