private void btnRemove_Click(object sender, EventArgs e)
        {
            var rows = dgvList.SelectedRows;

            if (rows.Count > 0)
            {
                DialogResult result = MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel);
                if (result == DialogResult.Cancel)
                {
                    return;
                }
                string id = rows[0].Cells[0].Value.ToString();
                if (bll.Delete(id))
                {
                    RemoveInfo remove = new RemoveInfo()
                    {
                        RId    = Convert.ToInt32(id),
                        RName  = rows[0].Cells[1].Value.ToString(),
                        RTable = "MemberInfo"
                    };
                    RemoveInfoBll removebll = new RemoveInfoBll();
                    removebll.Add(remove);
                    LoadList();
                }
            }
            else
            {
                MessageBox.Show("请选择一行数据");
            }
        }
Beispiel #2
0
        private void LoadList()
        {
            RemoveInfoBll bll = new RemoveInfoBll();

            dgvList.AutoGenerateColumns = false;
            dgvList.DataSource          = bll.GetList();
        }