/// <summary> /// 打开INSTRUMENT细节查看或者编辑 /// </summary> /// <param name="fse"></param> private void InstrumentDetailOpen(FormStatusEnum fse) { if (this.dataGridView1.CurrentRow == null) { return; } var c = this.dataGridView1.CurrentRow.DataBoundItem as Business.Models.InstrumentsModel; Models.DrugInfo entity = this.PharmacyDatabaseService.GetDrugInfo(out msg, c.Id); FormInstrument frm = new FormInstrument(); frm.Text = entity.ProductGeneralName; frm.entity = entity; frm.FSE = fse; if (fse == FormStatusEnum.Read) { Common.SetControls.SetControlReadonly(frm, true); } else { frm.InstrumentInfoSubmit += (sender, e) => { if (e) { this.InstrumentsQuery(); } }; } frm.Show(this); }
public FormPurchaseHistoryBySupplyer() { InitializeComponent(); this.dataGridView1.AutoGenerateColumns = false; this.dataGridView1.RowPostPaint += delegate(object o, DataGridViewRowPostPaintEventArgs ex) { DataGridViewOperator.SetRowNumber((DataGridView)o, ex); }; dtpf.Value = DateTime.Now.AddMonths(-3).Date; dtpt.Value = DateTime.Now.Date; this.toolStrip1.Items.Insert(5, new ToolStripControlHost(dtpf)); this.toolStrip1.Items.Insert(7, new ToolStripControlHost(dtpt)); cms = new Pharmacy.UI.Common.BaseRightMenu(this.dataGridView1); cms.InsertMenuItem("查询选中供货商", SupplyStatic); cms.InsertMenuItem("查看选中供货商资料", delegate() { var u = this.dataGridView1.CurrentRow.DataBoundItem as Business.Models.SupplyUnitHistoryDrugList; Models.SupplyUnit su = this.PharmacyDatabaseService.GetSupplyUnit(out msg, u.SupplyUnitId); UserControls.ucSupplyUnit us = new UserControls.ucSupplyUnit(su, false); Form f = new Form(); f.Text = su.Name; f.AutoSize = true; f.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; Panel p = new Panel(); p.AutoSize = true; p.Controls.Add(us); f.Controls.Add(p); f.ShowDialog(); }); cms.InsertMenuItem("查看选中品种资料", delegate() { var u = this.dataGridView1.CurrentRow.DataBoundItem as Business.Models.SupplyUnitHistoryDrugList; Models.DrugInfo di = this.PharmacyDatabaseService.GetDrugInfo(out msg, u.DrugInfoId); if (di == null) { return; } 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); Forms.Common.SetControls.SetControlReadonly(f, true); f.ShowDialog(); }); cms.InsertMenuItem("按选中品种批号查询", delegate() { if (this.ListS.Count > 0) { var c = this.dataGridView1.CurrentRow.DataBoundItem as Business.Models.SupplyUnitHistoryDrugList; if (BtchFrm == null || BtchFrm.IsDisposed) { BtchFrm = new Form_FormPurchaseHistoryBySupplyer_Batch(c.batchNumber); } BtchFrm.StartPosition = FormStartPosition.CenterScreen; BtchFrm.TopMost = true; BtchFrm.Show(this); BtchFrm.GetBatch += (sender, ex) => { if (ex.IsPrecise) { var qre = this.ListS.Where(r => r.batchNumber == ex.Batch); this.dataGridView1.DataSource = qre.ToList(); } else { var qre = this.ListS.Where(r => r.batchNumber.Contains(ex.Batch)); this.dataGridView1.DataSource = qre.ToList(); } }; } }); cms.InsertMenuItem("采购品种汇总", DrugStatic); cms.InsertMenuItem("全部显示", ShowAll); cms.InsertMenuItem("统计该药品购销情况", SupplyAndSale); tsmi = new ToolStripMenuItem("打开采购单"); cms.InsertStripMenuItems(tsmi, InsertDropDownMenuEvt); tsmi = new ToolStripMenuItem("打开验收单"); cms.InsertStripMenuItems_Checking(tsmi, this.InsertDropDownMenuEvt_Checking); }
void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { this._DI = this.dataGridView1.Rows[e.RowIndex].DataBoundItem as Models.DrugInfo; this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
public Form_WareHouseZonePositionSelector(Guid drugInfoId) { InitializeComponent(); this.StartPosition = FormStartPosition.CenterParent; Models.DrugInfo d = this.PharmacyDatabaseService.GetDrugInfo(out msg, drugInfoId); #region combo数据绑定 var w = this.PharmacyDatabaseService.AllWarehouses(out msg).Where(r => r.Deleted == false).OrderBy(r => r.Name).ToList(); this.toolStripComboBox1.ComboBox.DisplayMember = "Name"; this.toolStripComboBox1.ComboBox.ValueMember = "Id"; this.toolStripComboBox1.ComboBox.DataSource = w; this.toolStripComboBox1.ComboBox.SelectedValue = d.WareHouses; var wz = this.PharmacyDatabaseService.AllWarehouseZones(out msg).Where(r => r.Deleted == false).OrderBy(r => r.Name); this.toolStripComboBox1.ComboBox.SelectedIndexChanged += (sender, ex) => { var wzs = wz.Where(r => r.WarehouseId == (Guid)this.toolStripComboBox1.ComboBox.SelectedValue).ToList(); this.toolStripComboBox2.ComboBox.DisplayMember = "Name"; this.toolStripComboBox2.ComboBox.ValueMember = "Id"; this.toolStripComboBox2.ComboBox.DataSource = wzs; if (wzs.Count <= 0) { return; } this.toolStripComboBox2.ComboBox.SelectedIndex = 0; this.GetWareHousePositions(); }; this.toolStripComboBox2.ComboBox.SelectedIndexChanged += (s, e) => { this.GetWareHousePositions(); }; this.toolStripButton1.Click += (s, e) => this.GetWareHousePositions(); this.toolStripComboBox2.ComboBox.DisplayMember = "Name"; this.toolStripComboBox2.ComboBox.ValueMember = "Id"; this.toolStripComboBox2.ComboBox.DataSource = wz.Where(r => r.WarehouseId == d.WareHouses).ToList(); this.toolStripComboBox2.ComboBox.SelectedValue = Guid.Parse(d.WareHouseZones); #endregion this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; this.dataGridView1.RowPostPaint += delegate(object o, DataGridViewRowPostPaintEventArgs ex) { DataGridViewOperator.SetRowNumber((DataGridView)o, ex); }; this.dataGridView1.ReadOnly = true; this.dataGridView1.Columns["Id"].Visible = false; this.dataGridView1.Columns["WareHouseId"].Visible = false; this.dataGridView1.Columns["WareHouseZoneId"].Visible = false; this.dataGridView1.CellDoubleClick += (sender, e) => { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } PositionEventArgs args = new PositionEventArgs { PositionModel = (Business.Models.WareHouseZonePositionModel) this.dataGridView1.Rows[e.RowIndex].DataBoundItem }; if (this.PositionSelected != null) { this.PositionSelected(this, args); this.Close(); } }; }