コード例 #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int selectedIndex = DetailGridView.CurrentCell.RowIndex;

            orderModified.RemoveDetails(orderModified.OrderDetails[selectedIndex]);
            OrderBindingSource.ResetBindings(false);
            OrderDetailBindingSource.ResetBindings(false);
        }
コード例 #2
0
 private void btnModify_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < DetailGridView.Rows.Count - 1; i++)
     {
         orderModified.OrderDetails[i].Goods.GoodsName = DetailGridView.Rows[i].Cells[0].Value.ToString();
         orderModified.OrderDetails[i].Num             = int.Parse(DetailGridView.Rows[i].Cells[1].Value.ToString());
         orderModified.OrderDetails[i].GoodsTotalPrice = double.Parse(DetailGridView.Rows[i].Cells[2].Value.ToString());
     }
     OrderBindingSource.ResetBindings(false);
     OrderDetailBindingSource.ResetBindings(false);
 }
コード例 #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            FormAdd formAdd = (FormAdd)this.Owner;

            formAdd.Show();
            textBoxID.DataBindings.Add("Text", OrderDetailBindingSource, "OrderID");
            cbBoxMerchant.DataBindings.Add("SelectedItem", OrderDetailBindingSource, "Mechant");
            cbBoxCustomer.DataBindings.Add("SelectedItem", OrderDetailBindingSource, "Customer");
            orderModified.OrderDetails.Add(orderDetails);
            OrderBindingSource.ResetBindings(false);
            OrderDetailBindingSource.ResetBindings(false);
        }