private void button1_Click(object sender, EventArgs e) { OrderDetails od = new OrderDetails("自己改", 0, 0); listBindingSource.Add(od); OrderService os = new OrderService(); or.numOfDetails++; dataGridView2.Refresh(); os.Update(or); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && e.ColumnIndex == 5) { OrderDetails ods = (OrderDetails)listBindingSource.Current; OrderService os = new OrderService(); os.DeleteDetail(ods.ID); or.numOfDetails--; dataGridView2.Refresh(); listBindingSource.RemoveAt(e.RowIndex); dataGridView2.Refresh(); os.Update(or); } }
private void button3_Click(object sender, EventArgs e) { OrderService os = new OrderService(); os.Update(or); }