private void cmDelete_Click(object sender, EventArgs e) { MessageBox.Show("所选过滤器将被删除,确定吗?"); int rowIndex = dgvFilterList.CurrentCell.RowIndex; if (rowIndex < 0) { return; } DataGridViewRow row = dgvFilterList.Rows[rowIndex]; HYPDM.Entities.PDM_FILTER filter = row.DataBoundItem as HYPDM.Entities.PDM_FILTER; filter.Delete(); filterList = _filterService.getFilterList(productID, isProduct); this.filterBindingSource.DataSource = null; this.filterBindingSource.DataSource = filterList; MessageBox.Show("删除成功!"); }
/// <summary> /// 选择一个过滤器 /// </summary> private void ViewFilter() { int rowIndex = dgvFilterList.CurrentCell.RowIndex; if (rowIndex < 0) { MessageBox.Show("请选择一个过滤器"); return; } DataGridViewRow row = dgvFilterList.Rows[rowIndex]; HYPDM.Entities.PDM_FILTER filter = row.DataBoundItem as HYPDM.Entities.PDM_FILTER; if (filter == null) { return; } this.Filter = filter; }