public FormInstrumentsQuery() { InitializeComponent(); #region 右键支持 BaseForm.BasicInfoRightMenu cms = new BaseForm.BasicInfoRightMenu(this.dataGridView1); cms.InserMenu("查看医疗器械信息", delegate() { this.InstrumentDetailOpen(FormStatusEnum.Read); }); cms.InserMenu("修改医疗器械信息", delegate() { this.InstrumentDetailOpen(FormStatusEnum.Edit); }); cms.InserMenu("导出当前查询结果列表", delegate() { MyExcelUtls.DataGridview2Sheet(this.dataGridView1, "医疗器械信息查询结果列表"); }); cms.InserMenu("导出当前器械审批表", delegate() { var u = this.dataGridView1.CurrentRow.DataBoundItem as Business.Models.InstrumentsModel; byte[] b = this.PharmacyDatabaseService.GetUpdateFiles("ApprovalFiles\\医疗器械.doc").FirstOrDefault().bytes; using (System.IO.FileStream fs = new System.IO.FileStream("File", System.IO.FileMode.OpenOrCreate)) { fs.Write(b, 0, b.Length); fs.Close(); CreateWinWord cww = new CreateWinWord(); cww.Inst = u; if (cww.CreateWord(fs.Name, u.ProductGeneralName, 0)) { MessageBox.Show(u.ProductGeneralName + ":审批信息表导出成功!"); this.PharmacyDatabaseService.WriteLog(BugsBox.Pharmacy.AppClient.Common.AppClientContext.currentUser.Id, "导出首营医疗器械信息审批表成功!品种名称:" + u.ProductGeneralName); } else { this.PharmacyDatabaseService.WriteLog(BugsBox.Pharmacy.AppClient.Common.AppClientContext.currentUser.Id, "导出首营医疗器械信息审批表失败!品种名称:" + u.ProductGeneralName); } fs.Dispose(); } }); #endregion #region datagridview1事件 this.dataGridView1.AutoGenerateColumns = true; this.dataGridView1.ReadOnly = true; this.dataGridView1.RowPostPaint += (sender, ex) => DataGridViewOperator.SetRowNumber((DataGridView)sender, ex); this.dataGridView1.CellMouseDoubleClick += (sender, e) => { if (e.ColumnIndex < 0 || e.RowIndex < 0) { return; } if (e.Button == System.Windows.Forms.MouseButtons.Left) { this.InstrumentDetailOpen(FormStatusEnum.Read); } }; #endregion #region 文本框键盘事件 this.textBox1.KeyDown += (sender, e) => { if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Enter) { this.InstrumentsQuery(); } }; #endregion #region 分页控件事件 this.pagerControl1.DataPaging += pagerControl1_DataPaging; #endregion }
//右键菜单事件 private void GetDrugInfo(int Method) { if (this.dataGridView1.SelectedRows.Count <= 0) { return; } var c = this.dataGridView1.SelectedRows[0].DataBoundItem as Business.Models.DrugInfoModel; DrugInfo di = this.PharmacyDatabaseService.GetDrugInfo(out msg, c.id); if (di == null) { return; } if (Method == 0) { UI.UserControls.ucGoodsInfo ucControl = new UserControls.ucGoodsInfo(di); Form f = new Form(); f.WindowState = FormWindowState.Normal; f.StartPosition = FormStartPosition.CenterScreen; f.Text = di.ProductGeneralName; f.AutoSize = true; f.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; Panel p = new Panel(); p.AutoSize = true; p.Controls.Add(ucControl); f.Controls.Add(p); SetControls.SetControlReadonly(f, true); f.ShowDialog(); } if (Method == 1) { FormApprovalFlowCenter form = new FormApprovalFlowCenter(di, di.FlowID, false); form.ShowDialog(); } if (Method == 2) { MyExcelUtls.DataGridview2Sheet(this.dataGridView1, "品种信息查询结果"); } if (Method == 3) { var u = this.dataGridView1.SelectedRows[0].DataBoundItem as Business.Models.DrugInfoModel; byte[] b = this.PharmacyDatabaseService.GetUpdateFiles("ApprovalFiles\\9047DBCF-CD15-4904-8786-006A76DD4799").FirstOrDefault().bytes; using (System.IO.FileStream fs = new System.IO.FileStream("File", System.IO.FileMode.OpenOrCreate)) { fs.Write(b, 0, b.Length); fs.Close(); CreateWinWord cww = new CreateWinWord(); cww.d = u; if (cww.CreateWord(fs.Name, u.ProductGeneralName, 2)) { MessageBox.Show(u.ProductGeneralName + ":审批信息表导出成功!"); this.PharmacyDatabaseService.WriteLog(BugsBox.Pharmacy.AppClient.Common.AppClientContext.currentUser.Id, "导出首营信息审批表成功!品种名称:" + di.ProductGeneralName); } else { this.PharmacyDatabaseService.WriteLog(BugsBox.Pharmacy.AppClient.Common.AppClientContext.currentUser.Id, "导出首营信息审批表失败!品种名称:" + di.ProductGeneralName); } fs.Dispose(); } } if (Method == 4) { var u = this.dataGridView1.SelectedRows[0].DataBoundItem as Business.Models.DrugInfoModel; Form_DrugQualityTrace frm = new Form_DrugQualityTrace(u.id, u.ProductGeneralName); frm.ShowDialog(); frm.Dispose(); } }