Пример #1
0
        protected void InitCustomBackInfo(int rowIndex)
        {
            DataGridViewRow row = dataGridView1.Rows[rowIndex];

            DrugShop.Entities.SOut drugOut = row.DataBoundItem as DrugShop.Entities.SOut;

            if (drugOut == null)
            {
                return;
            }

            BackNumberInput input = new BackNumberInput();

            input.StoreNumber = drugOut.Number;

            if (input.ShowDialog(this.ParentForm) != DialogResult.OK)
            {
                return;
            }

            var   service = ServiceContainer.GetService <IDrugStoreService>();
            Store store   = service.GetDrugStore(drugOut.Code, drugOut.DrugID, drugOut.ChinseName, drugOut.Spec, drugOut.TimeLimit);

            DrugShop.Entities.SBack drugBack = new DrugShop.Entities.SBack();

            ColumnCollection cols = drugOut.GetColumns();

            foreach (Property prop in cols)
            {
                if (drugBack.ContainsProperty(prop.Name))
                {
                    drugBack[prop.Name] = drugOut[prop.Name];
                }
            }

            //保存供应商退药记录
            drugBack.ID         = ServiceContainer.GetService <IDrugBackService>().GetSBackMaxID();
            drugBack.Number     = input.Number;
            drugBack.Customname = drugOut.CustomName;

            this.backList.Add(drugBack);

            //更新库存数量
            store.Number += drugBack.Number;
            this.updateStoreList.Add(store);


            this.dmrcbackBindingSource.DataSource = null;
            this.dmrcbackBindingSource.DataSource = backList;
        }
Пример #2
0
        //往界面右边传值并显示
        private void AddToDrugOut()
        {
            DrugShop.Entities.SOut drugOut = new DrugShop.Entities.SOut();
            ColumnCollection       cols    = store.GetColumns();

            foreach (Property prop in cols)
            {
                if (drugOut.ContainsProperty(prop.Name))
                {
                    drugOut[prop.Name] = store[prop.Name];
                }
            }
            drugOut.Number     = int.Parse(this.txt_OutNumber.Text);
            drugOut.CustomName = txtCustomer.Text;
            //赋值listview
            ListViewItem lv = new ListViewItem(new string[] { string.Empty, drugOut.Code, drugOut.ChinseName, drugOut.Spec, drugOut.Unit, drugOut.TimeLimit.ToShortDateString(), store.SalePrice.ToString(), store.Number.ToString(), drugOut.Number.ToString() });

            store.Number = store.Number - drugOut.Number;
            object[] o = new object[] { drugOut, store };
            lv.Tag = o;
            listView_DrugOut.Items.Add(lv);
            this.store = null;
        }