/// <summary> /// 更新BOM /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button3_Click(object sender, EventArgs e) { ExtractInventoryTool_BOM bom = null; DataGridViewSelectedRowCollection rowCollection = dataGridView1.SelectedRows; DataGridViewRow row = null; if (rowCollection.Count != 1) { MessageBox.Show("只能选中一条记录进行更新", "Warning"); return; } row = rowCollection[0]; if (row != null && row.Cells[0].Value != null) { bom = new ExtractInventoryTool_BOM(); int oid = 0; bom.Oid = int.TryParse(row.Cells[0].Value.ToString().Trim(), out oid) ? oid : 0; bom.VehicleModelCode = row.Cells[1].Value.ToString().Trim(); int materialOid = 0; bom.Material = int.TryParse(row.Cells[2].Value.ToString().Trim(), out materialOid) ? materialOid : 0; int unitUsage = 0; bom.UnitUsage = int.TryParse(row.Cells[9].Value.ToString().Trim(), out unitUsage) ? unitUsage : 0; bom.UpdateTime = (DateTime)row.Cells[10].Value; } Form_BOMEditor editor = new Form_BOMEditor(bom); editor.ShowDialog(this); if (editor.DialogResult == DialogResult.OK) { Task.Run(() => QueryBOM()); } return; }
/// <summary> /// 新增客户 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { Form_BOMEditor editor = new Form_BOMEditor(null); editor.ShowDialog(this); if (editor.DialogResult == DialogResult.OK) { Task.Run(() => QueryBOM()); } return; }