示例#1
0
        //private void dgvCustomerInfor_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        //{
        //    User user = new User();
        //    user.UserName = "";
        //    user.Telephone = "";
        //    user.CarRequirement = "";
        //    user.Id = Convert.ToInt32(dgvCustomerInfor.CurrentRow.Cells["CustomerId"].Value.ToString());
        //    dgvUserRequrement.DataSource = userBLL.SelectbyUser(user);
        //}

        private void dgvGroupList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvGroupList.Columns[e.ColumnIndex].Name == "btnEditGroup")
            {
                Group groupEdit = new Group();
                groupEdit.Id        = Convert.ToInt32(dgvGroupList.CurrentRow.Cells[2].Value.ToString());
                groupEdit.GroupName = dgvGroupList.CurrentRow.Cells[3].Value.ToString();
                groupEdit.CreatTime = DateTime.Now.ToString();
                GroupForm carEditForm = new GroupForm(groupEdit, this);
                carEditForm.Show();
            }
            if (dgvGroupList.Columns[e.ColumnIndex].Name == "btnDeleteGroup")
            {
                Group groupEdit = new Group();
                groupEdit.Id = Convert.ToInt32(dgvGroupList.CurrentRow.Cells[2].Value.ToString());
                try
                {
                    groupBLL.DeleteByGroup(groupEdit);
                    MessageBox.Show("删除成功");
                    dgvGroupList.DataSource = groupBLL.FindAllInfo();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("删除分组失败:" + ex.Message);
                }
            }
        }