private void dgvContact_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { if (e.ColumnIndex == 1) { if ((dgvContact.Rows[e.RowIndex].Cells["OperName"].Value.ToString() == Classes.PubClass.UserName || Common.AuthenticateRight.AuthOperation(110101) || CommonClass.SttUser.blSuperUser) && Classes.PubClass.UserStatus == "正常") { 客户资料维护 mForm = new 客户资料维护(); mForm.mId = Convert.ToInt64(dgvContact.Rows[e.RowIndex].Cells["idDataGridViewTextBoxColumn"].Value); mForm.ShowDialog(); } } if (e.ColumnIndex == 2) { if ((dgvContact.Rows[e.RowIndex].Cells["OperName"].Value.ToString() == Classes.PubClass.UserName || Common.AuthenticateRight.AuthOperation(110101) || CommonClass.SttUser.blSuperUser) && Classes.PubClass.UserStatus == "正常") { if (MessageBox.Show("确认删除该客户资料?", "警告", MessageBoxButtons.OKCancel) == DialogResult.OK) { long mId = Convert.ToInt64(dgvContact.Rows[e.RowIndex].Cells[0].Value); int ret = t_CustomersTableAdapter.DeleteById(mId); if (ret > 0) { dgvContact.Rows.RemoveAt(e.RowIndex); } else { MessageBox.Show("删除失败"); } } } } } }
private void llAdd_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { 客户资料维护 mForm = new 客户资料维护(); mForm.ShowDialog(); }