예제 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            AddEdit form = new AddEdit("Add");

            form.Owner = this;
            form.ShowDialog();
        }
예제 #2
0
        private void GridViewData_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            long   id;
            string str = this.gridList.CurrentRow.Cells["Id"].Value.ToString();

            long.TryParse(str, out id);
            if (e.ColumnIndex == 1)
            {
                if (MessageBox.Show("确定要删除这条数据吗", "提示", MessageBoxButtons.YesNo) != DialogResult.Yes)
                {
                    return;
                }
                bool res = checkWorkService.Del(id);
                if (!res)
                {
                    MessageBox.Show("删除失败");
                    return;
                }
                MessageBox.Show("删除成功");
                Bind();
            }
            else if (e.ColumnIndex == 0)
            {
                AddEdit form = new AddEdit("Edit", id);
                form.Owner = this;
                form.ShowDialog();
            }
        }