private void dgvMain_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } Business.Models.DrugInfoModel dm = this.dgvMain.Rows[e.RowIndex].DataBoundItem as Business.Models.DrugInfoModel; if (dm == null) { return; } this.dgvMain.ClearSelection(); this.dgvMain.Rows[e.RowIndex].Selected = true; this.cms.Show(MousePosition.X, MousePosition.Y); }
private void btnModify_Click(object sender, EventArgs e) { try { string message = string.Empty; _TYPE = OperateType.Edit; this.ucGoodsInfo1.RunMode = Pharmacy.UI.Common.FormRunMode.Edit; if (dataGridView1.CurrentRow != null) { Business.Models.DrugInfoModel di = this.dataGridView1.CurrentRow.DataBoundItem as Business.Models.DrugInfoModel; entity = this.PharmacyDatabaseService.GetDrugInfo(out msg, di.id); if (entity.BusinessScopeCode.Contains("医疗器械")) { FormInstrument frm = new FormInstrument { entity = entity, FSE = FormStatusEnum.Edit }; frm.ShowDialog(); } else { message = EditItem(message); } } else { MessageBox.Show("没有选择要修改的记录!"); } } catch (Exception ex) { MessageBox.Show(ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); Log.Error(ex); } }