public void selectm() { try { 产品原料关系 newform = (产品原料关系)this.ParentForm; if (textBox1.Text != "0") { ProductMaterial pmr = new ProductMaterial(); pmr.MaterialCount = Convert.ToInt16(textBox1.Text); pmr.ProductId = PID; pmr.MaterialId = dataGridView1.Rows[index].Cells["原料编号"].Value.ToString(); if (pm.AddMaterialProductRelation(pmr)) { MessageBox.Show("新原料产品关系建立成功!"); this.Close(); } } else { MessageBox.Show("请输入产品-原材料比例的数量!"); } } catch (Exception ex) { MessageBox.Show("此原料添加失败!"); } }
private void button5_Click(object sender, EventArgs e) { 产品原料关系 win = new 产品原料关系(text产品编号.Text); win.ShowDialog(); }