private void btnAdd_Click(object sender, EventArgs e) { DataTable dtDtlNew = ((DataView)gvProductDtl.DataSource).Table; DataTable dtNew = ((DataView)gvPorProduct.DataSource).Table; DataRow drNew = dtNew.NewRow(); this._loadKey = FanHai.Hemera.Share.Common.CommonUtils.GenerateNewKey(0); drNew[POR_PRODUCT.FIELDS_PRODUCT_KEY] = this._loadKey; drNew[POR_PRODUCT.FIELDS_CREATER] = PropertyService.Get(PROPERTY_FIELDS.USER_NAME); BasicProductSetForm bpsf = new BasicProductSetForm(); bpsf.isEdit = false; bpsf.drCommon = drNew; bpsf.dtDtl = dtDtlNew.Clone(); if (DialogResult.OK == bpsf.ShowDialog()) { InitBindData(); } }
private void btnModify_Click(object sender, EventArgs e) { if (gvPorProduct.FocusedRowHandle < 0 || gvPorProduct.RowCount < 1) { //MessageService.ShowMessage("请选择编辑的数据!", "提示"); MessageService.ShowMessage(StringParser.Parse("${res:FanHai.Hemera.Addins.BasicProductSet.msg.0001}"), StringParser.Parse("${res:Global.SystemInfo}")); return; } DataTable dtDtlEdit = ((DataView)gvProductDtl.DataSource).Table; DataRow drEdit = gvPorProduct.GetFocusedDataRow(); this._loadKey = Convert.ToString(drEdit[POR_PRODUCT.FIELDS_PRODUCT_KEY]); BasicProductSetForm bpsf = new BasicProductSetForm(); bpsf.isEdit = true; bpsf.drCommon = drEdit; bpsf.dtDtl = dtDtlEdit; if (DialogResult.OK == bpsf.ShowDialog()) { InitBindData(); } }