protected void InitCustomBackInfo(int rowIndex) { DataGridViewRow row = dataGridView1.Rows[rowIndex]; DrugShop.Entities.Store DrugShop = row.DataBoundItem as DrugShop.Entities.Store; if (DrugShop == null) { return; } NumberInput input = new NumberInput(); input.StoreNumber = DrugShop.Number; if (input.ShowDialog(this.ParentForm) != DialogResult.OK) { return; } DrugShop.Entities.Store store = new Entities.Store(); DrugShop.Entities.Lost drugLost = new DrugShop.Entities.Lost(); ColumnCollection cols = DrugShop.GetColumns(); foreach (Property prop in cols) { if (drugLost.ContainsProperty(prop.Name)) { drugLost[prop.Name] = DrugShop[prop.Name]; } if (store.ContainsProperty(prop.Name)) { store[prop.Name] = DrugShop[prop.Name]; } } //保存供应商退药记录 drugLost.ID = ServiceContainer.GetService <IDrugLostService>().GetMaxID(); drugLost.Number = input.Number; this.lostList.Add(drugLost); //更新库存数量 store.Number -= drugLost.Number; this.updateStoreList.Add(store); this.dmrlostBindingSource.DataSource = null; this.dmrlostBindingSource.DataSource = lostList; CaclSumCash(); }
protected void InitProviderBackInfo(int rowIndex) { DataGridViewRow row = dataGridView1.Rows[rowIndex]; DrugShop.Entities.Store DrugShop = row.DataBoundItem as DrugShop.Entities.Store; if (DrugShop == null) { return; } NumberInput input = new NumberInput(); input.StoreNumber = DrugShop.Number; if (input.ShowDialog(this.ParentForm) != DialogResult.OK) { return; } DrugShop.Entities.Store store = new Entities.Store(); DrugShop.Entities.PBack drugBack = new DrugShop.Entities.PBack(); ColumnCollection cols = DrugShop.GetColumns(); foreach (Property prop in cols) { if (drugBack.ContainsProperty(prop.Name)) { drugBack[prop.Name] = DrugShop[prop.Name]; } if (store.ContainsProperty(prop.Name)) { store[prop.Name] = DrugShop[prop.Name]; } } //保存供应商退药记录 drugBack.Id = ServiceContainer.GetService <IDrugBackService>().GetPBackMaxID(); drugBack.Number = input.Number; this.backList.Add(drugBack); //更新库存数量 store.Number -= drugBack.Number; this.updateStoreList.Add(store); }