void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { Business.Models.DirectSalesOrderDetailModel dsodm = this.dataGridView1.Rows[e.RowIndex].DataBoundItem as Business.Models.DirectSalesOrderDetailModel; if (this.dataGridView1.Columns[e.ColumnIndex].Name == this.Column7.Name || this.dataGridView1.Columns[e.ColumnIndex].Name == this.Column8.Name || this.dataGridView1.Columns[e.ColumnIndex].Name == this.Column9.Name) { dsodm.SaleWholePrice = dsodm.SalePrice * dsodm.Amount; dsodm.SupplyWholePrice = dsodm.SupplyPrice * dsodm.Amount; dsodm.DirectDiffPrice = dsodm.SaleWholePrice - dsodm.SupplyWholePrice; } this.dataGridView1.Refresh(); }
void textBox3_KeyDown(object sender, KeyEventArgs e) { Business.Models.DirectSalesQueryModel dsq = new Business.Models.DirectSalesQueryModel(); dsq.Keyword = this.textBox3.Text.Trim(); if (this._PurchaseUnit == null) { MessageBox.Show("请先选择直调购货单位!"); return; } if (this._SupplyUnit == null) { MessageBox.Show("请先选择直调供货单位!"); return; } dsq.PurchaseUnitId = this._PurchaseUnit.Id; dsq.SupplyUnitId = this._SupplyUnit.Id; dsq.Keyword = this.textBox3.Text.Trim(); if (e.KeyCode != Keys.Return) { return; } using (Form_DrugInfo frm = new Form_DrugInfo(dsq)) { if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Business.Models.DirectSalesOrderDetailModel dsod = new Business.Models.DirectSalesOrderDetailModel { Id = Guid.NewGuid(), ProducGeneralName = frm._DI.ProductGeneralName, Dosage = frm._DI.DictionaryDosageCode, Specific = frm._DI.DictionarySpecificationCode, PermitNumber = frm._DI.LicensePermissionNumber, MeasurementUnitCode = frm._DI.DictionaryMeasurementUnitCode, FactoryName = frm._DI.FactoryName, Amount = 0, DrugInfoId = frm._DI.Id, SalePrice = 0m, SupplyPrice = 0m, SaleWholePrice = 0m, SupplyWholePrice = 0m, DirectDiffPrice = 0m }; this._ListDirectSalesDetail.Add(dsod); } } }