private void btnAdd_Click(object sender, EventArgs e) { BasicRptOptForm optForm = new BasicRptOptForm(); DataRow drNew = (this.gcOptSetting.DataSource as DataTable).NewRow(); drNew[BASE_OPT_SETTING.FIELDS_OPTSETTING_KEY] = FanHai.Hemera.Share.Common.CommonUtils.GenerateNewKey(0); drNew[BASE_OPT_SETTING.FIELDS_ISFLAG] = 1; drNew[BASE_OPT_SETTING.FIELDS_CREATOR] = PropertyService.Get(PROPERTY_FIELDS.USER_NAME); drNew[BASE_OPT_SETTING.FIELDS_OVER_DAY] = 0; optForm.drCommon = drNew; optForm.isEdit = false; if (optForm.ShowDialog() == DialogResult.OK) { InitGridView(); } }
private void btnModify_Click(object sender, EventArgs e) { if (this.gvOptSetting.FocusedRowHandle < 0) { //MessageService.ShowMessage("请选择需要编辑的数据!", "提示"); MessageService.ShowMessage(StringParser.Parse("${res:FanHai.Hemera.Addins.BasicRptOptSetting.msg.0002}"), StringParser.Parse("${res:Global.SystemInfo}")); return; } BasicRptOptForm optForm = new BasicRptOptForm(); DataRow drUpdate = this.gvOptSetting.GetDataRow(this.gvOptSetting.FocusedRowHandle); drUpdate[BASE_OPT_SETTING.FIELDS_EDITOR] = PropertyService.Get(PROPERTY_FIELDS.USER_NAME); optForm.drCommon = drUpdate; optForm.isEdit = true; if (optForm.ShowDialog() == DialogResult.OK) { InitGridView(); } }