public void 重複添加(單點 other) { int number = 1; foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[0].Value != null) { if (row.Cells[0].Value.ToString() == other.GetName()) { number = (int)row.Cells[2].Value + 1; dataGridView1.Rows.Remove(row); } } } dataGridView1.Rows.Add(other.GetName(), other.GetPrice(), number, number * other.GetPrice()); B總價_Click(sender, e); }
public override int GetPrice() { return(單點.GetPrice() + 25); }