Esempio n. 1
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dataGridView1.Columns[e.ColumnIndex].Name == "删除" && e.RowIndex >= 0)
     {
         DataGridViewColumn column = dataGridView1.Columns[e.ColumnIndex];
         string             name   = dataGridView1.CurrentRow.Cells[0].Value.ToString();
         OrderItem          item   = new OrderItem();
         item = currentorder.finditem(name);
         currentorder.RemoveorderItem(item);
         Itembindingsource.DataSource = currentorder.orderItems;
         Itembindingsource.ResetBindings(false);
     }
     if (dataGridView1.Columns[e.ColumnIndex].Name == "修改" && e.RowIndex >= 0)
     {
         DataGridViewColumn column = dataGridView1.Columns[e.ColumnIndex];
         string             name   = dataGridView1.CurrentRow.Cells[0].Value.ToString();
         OrderItem          item   = new OrderItem();
         item = currentorder.finditem(name);
         orderitem form3 = new orderitem(item);
         form3.ShowDialog();
         if (form3.newitem != null)
         {
             currentorder.AlterorderItem(form3.newitem);
             Itembindingsource.DataSource = currentorder.orderItems;
             Itembindingsource.ResetBindings(false);
         }
     }
 }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            orderitem form3 = new orderitem();

            form3.ShowDialog();
            if (form3.newitem != null)
            {
                currentorder.AddorderItem(form3.newitem);
                Itembindingsource.DataSource = currentorder.orderItems;
                Itembindingsource.ResetBindings(false);
            }
        }