/// <summary> ///删除选中行数据的方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tslDelFVN() { try { int j = 0; if (dgvFVN.SelectedRows.Count > 0)//选中删除 { if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { //选中数量 int count = dgvFVN.SelectedRows.Count; string id = ""; //遍历 for (int i = 0; i < count; i++) { int fvnid = int.Parse(this.dgvFVN.SelectedRows[i].Cells["FVN_ID"].Value.ToString()); Expression <Func <FVNInfo, bool> > funuserinfo = n => n.FVN_ID == fvnid; string strContent = LinQBaseDao.Query("select FVN_Name from FVNInfo where FVN_ID=" + fvnid).Tables[0].Rows[0][0].ToString(); if (FVNDAL.DeleteToMany(funuserinfo)) { j++; CommonalityEntity.WriteLogData("删除", "删除地感名称为 " + strContent + " 的信息", common.USERNAME);//添加日志 } } if (j == count) { MessageBox.Show("成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else//没有选中 { MessageBox.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch { CommonalityEntity.WriteTextLog("地感管理 tslDelFVN()+"); } finally { LogInfoLoad(""); } }