private void btnSave_Click(object sender, EventArgs e) { // 过滤器名称不能为空 if (this.txtFilterName.Text.Trim() == "") { MessageBox.Show("请输入过滤器名称"); return; } PDM_FILTER filter = new PDM_FILTER(); // 保存新建过滤器时 if (this.filter == null) { filter.ID = _filterService.GetMaxID().ToString(); } else { filter.ID = this.filter.ID; } // 所有权 if (this.radPublic.Checked) { filter.OWNERSHIP = "PUBLIC"; } else { filter.OWNERSHIP = "PRIVATE"; } // 视图 if (this.chkView.Checked) { filter.VIEWER = true; } else { filter.VIEWER = false; } filter.PARTSNO = this.txtPartsNo.Text; filter.VERSION = this.txtVersion.Text; filter.VERSIONTYPE = this.cobVersionType.Text; filter.FROMDATE = this.dtpFrom.Value.ToString(); filter.TODATE = this.dtpTo.Value.ToString(); filter.SORTCODE = this.txtSortCode.Text; filter.SPECIFICATIONCODE = this.txtSpecificationCode.Text; filter.DESCRIPTION = this.txtDescription.Text; filter.QUANTITY = this.txtQuantity.Text; filter.SINGLENETWEIGHT = this.txtSingleNetweight.Text; filter.SURFACESOLVE = this.cobSurfaceSolve.Text; filter.FILTERNAME = this.txtFilterName.Text; filter.PRODUCTID = this.productID; filter.ISPRODUCT = this.isProduct; filter.Save(); filterList = _filterService.getFilterList(productID, isProduct); this.filterBindingSource.DataSource = null; this.filterBindingSource.DataSource = filterList; MessageBox.Show("保存成功!"); }