private void button1_Click(object sender, EventArgs e) { string commodityId = textBox1_ID.Text; string commodityName = comboBox2.Text; string businessName = comboBox1.Text; string str = textBox5_CBJ.Text; int costPrice = int.Parse(str); string str1 = textBox3_DJ.Text; int unitPrice = int.Parse(str1); string str2 = textBox4_SPKCL.Text; int commodityNumber = int.Parse(str2); string remarks = textBox7_BZ.Text; ProductInfoEntity entity = new ProductInfoEntity(commodityId, commodityName, businessName, costPrice, unitPrice, commodityNumber, remarks); IStockManageController stockManageController = new StockManageControllerImpl(); bool term = stockManageController.InsertProductInfo(entity); if (term == true) { StockManage form = new StockManage(); MessageBox.Show("添加库存信息成功"); this.DialogResult = DialogResult.OK; this.Hide(); } else { MessageBox.Show("添加库存信息失败!"); } }
//添加 private void button1_Click(object sender, EventArgs e) { ProductInfoEntity entity = StockUpdate(); IStockManageController manageController = new StockManageControllerImpl(); bool term = manageController.UpdateProductInfo(entity, entity.ProductId); if (term == true) { MessageBox.Show("修改库存信息成功!"); this.DialogResult = DialogResult.OK; this.Hide(); } }
public void selectColumn(string column, string table) { IStockManageController stockManageController = new StockManageControllerImpl(); List <string> list = stockManageController.SelectColumn(column, table); for (int i = 0; i < list.Count; i++) { string str = list[i]; if (table.Equals("tb_supplier")) { this.comboBox1.Items.Add(str); } else if (table.Equals("tb_purchase")) { this.comboBox2.Items.Add(str); } } }