void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } PurchaseOrderDetailEntity pode = this.dataGridView1.Rows[e.RowIndex].DataBoundItem as PurchaseOrderDetailEntity; this.Bcms.DrugId = pode.DrugInfoId; }
private void btnAddDetail_Click(object sender, EventArgs e) { try { FormDrugsForSupplyUnitSelector selector = new FormDrugsForSupplyUnitSelector(_purchaseOrder.SupplyUnitId); selector.GoogsTypeClass = this.GoogsTypeClass; selector.ShowDialog(); if (selector.DialogResult == System.Windows.Forms.DialogResult.OK) { //先判断选中的药物在现在的list中是否存在 List <DrugInfo> drugsSelected = selector.dinfos; foreach (var drugSelected in drugsSelected) { if (_listPurchaseOrderDetail.Find(r => r.DrugInfoId == drugSelected.Id && r.isdeleted == false) != null) { MessageBox.Show(drugSelected.ProductName + "已存在,不可重复增加!"); continue; } PurchaseOrderDetailEntity newDetail = new PurchaseOrderDetailEntity(); #region create new PurchaseOrderDetail record newDetail.Id = Guid.NewGuid(); newDetail.PurchaseOrderId = _purchaseOrder.Id; newDetail.DrugInfoId = drugSelected.Id; newDetail.PurchasePrice = drugSelected.PurchasePrice; newDetail.Amount = 1; newDetail.AmountOfTax = 17.0m; newDetail.Price = drugSelected.Price; newDetail.ProductGeneralName = drugSelected.ProductGeneralName; newDetail.FactoryName = drugSelected.FactoryName; newDetail.DictionarySpecificationCode = drugSelected.DictionarySpecificationCode; newDetail.DictionaryMeasurementUnitCode = drugSelected.DictionaryMeasurementUnitCode; newDetail.DictionaryDosageCode = drugSelected.DictionaryDosageCode; newDetail.LicensePermissionNumber = drugSelected.LicensePermissionNumber; newDetail.sequence = this._listPurchaseOrderDetail.Count; _listPurchaseOrderDetail.Add(newDetail); this.dataGridView1.DataSource = null; var c = this._listPurchaseOrderDetail.Where(r => r.isdeleted == false).ToList(); this.dataGridView1.DataSource = c; this.dataGridView1.ReadOnly = false; #endregion } } } catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK); Log.Error(ex); } }
public PurchaseOrderForm GetDataIntoModel() { PurchaseOrderForm POForm = new PurchaseOrderForm(); POForm.OrderDetails = new List <PurchaseOrderDetailEntity>(); PurchaseOrderEntity model = new PurchaseOrderEntity(); model.OrderNo = this.OrderNo; model.OrderDate = this.OrderDate; model.TotalBeforeTax = this.TotalBeforeTax; model.TotalTax = this.TotalTax; model.TotalAfterTax = this.TotalAfterTax; //model.ValidForDays = this.ValidForDays; model.DeliveryDate = this.DeliveryDate; model.SupplierID = this.SelectedSupplierID; model.TermsAndConditions = this.TermsAndConditions; if (ExcludingTax == true) { model.ExcIncGST = false; } else { model.ExcIncGST = true; } POForm.Order = model; foreach (var item in PODetailsEntity) { PurchaseOrderDetailEntity pqEntity = new PurchaseOrderDetailEntity(); pqEntity.PONo = Convert.ToString(item.SelectedPSID); pqEntity.PandSCode = item.PandSCode; pqEntity.PandSName = item.PandSName; pqEntity.POQty = item.PQQty; pqEntity.POPrice = item.PQPrice; pqEntity.PODiscount = item.PQDiscount; pqEntity.GSTRate = item.GSTRate; pqEntity.GSTRateStr = Convert.ToString(item.GSTRate) + "%"; pqEntity.POAmount = item.PQAmount; if (item.SelectedPSID != null && Convert.ToInt32(item.SelectedPSID) > 0) { POForm.OrderDetails.Add(pqEntity); } } return(POForm); }