Пример #1
0
        private void ButtonEdit_Click(object sender, System.EventArgs e)
        {
            if (DataGridViewX1.SelectedRows.Count == 1)
            {
                int           selectedRowId = int.Parse(DataGridViewX1.SelectedRows[0].Cells["角色编号"].Value.ToString());
                FrmRoleDetail frm           = new FrmRoleDetail
                {
                    Roleid        = selectedRowId,
                    StartPosition = FormStartPosition.CenterParent
                };

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    RefreshGridView();
                }
            }
            else if (DataGridViewX1.SelectedRows.Count > 1)
            {
                CustomDesktopAlert.H2("只能选择一行编辑");
            }
            else
            {
                CustomDesktopAlert.H2("请先选择要编辑的行");
            }
        }
Пример #2
0
        private void ButtonInsert_Click(object sender, System.EventArgs e)
        {
            FrmRoleDetail frm = new FrmRoleDetail
            {
                Roleid        = -1,
                StartPosition = FormStartPosition.CenterParent
            };

            if (frm.ShowDialog() == DialogResult.OK)
            {
                RefreshGridView();
            }
        }