Exemple #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         ProductMaterial pmt = new ProductMaterial();
         pmt.MaterialId    = textBox原料.Text;
         pmt.ProductId     = textBox产品.Text;
         pmt.MaterialCount = Convert.ToInt16(textBox原料数量.Text);
         if (pm.AltMaterialProductRelation(pmt))
         {
             // MessageBox.Show("修改成功!");
             dataGrid产品原料关系.DataSource = pm.GetMaterialProductRelationByProduct(textBox产品.Text);
             dataGrid产品原料关系.Update();
         }
         else
         {
             MessageBox.Show("修改失败!");
         }
     }
     catch (Exception ex) { MessageBox.Show(ex.Message); };
 }
 public void UpdateT2()
 {
     try
     {
         ProductMaterial pmt = new ProductMaterial();
         pmt.MaterialId    = textBox原料.Text;
         pmt.ProductId     = textBox产品.Text;
         pmt.MaterialCount = Convert.ToInt16(textBox原料数量.Text);
         if (pm.AltMaterialProductRelation(pmt))
         {
             // MessageBox.Show("修改成功!");
             dataGridView2.DataSource = pm.GetMaterialProductRelationByProduct(textBox产品.Text);
             dataGridView2.Update();
         }
         else
         {
             MessageBox.Show("修改失败!");
         }
     }
     catch (Exception ex) { };
 }