示例#1
0
        /// <summary>
        /// 删除 数据单元格 选中的行row
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_删除选中的店员_Click(object sender, EventArgs e)
        {
            var rows = dataGridView_店员管理.SelectedCells;
            //MessageBox.Show(rows[0].Value.ToString());
            ManagerInfo mi = new ManagerInfo()
            {
                MId = Convert.ToInt32(rows[0].Value)
            };

            if (MIBll.Delete(mi))
            {
                GetInfo();
                button_取消.PerformClick();
            }
            else
            {
                button_取消.PerformClick();
                MessageBox.Show("删除操作错误,请先选中要删除的行");
            }
        }
示例#2
0
        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();
                ManagerInfoBll bll = new ManagerInfoBll();
                if (bll.Delete(id))
                {
                    LoadList();
                }
            }
            else
            {
                MessageBox.Show("请选择一行数据");
            }
        }