示例#1
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            var row = dgvList.SelectedRows;

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