private void button1_Click(object sender, EventArgs e) { OrderList.OrderService service = new OrderList.OrderService(); uint i = Convert.ToUInt32(textBox1.Text); service.RemoveOrder(i); DialogResult result = MessageBox.Show("订单删除成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
private void button1_Click(object sender, EventArgs e) { OrderList.OrderService service = new OrderList.OrderService(); uint i = Convert.ToUInt32(textBox1.Text); uint Id = Convert.ToUInt32(textBox3.Text); String name = textBox2.Text; OrderList.Customer customer = new OrderList.Customer(Id, name); service.UpdateCustomer(i, customer); DialogResult result = MessageBox.Show("订单修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }
//查询订单 private void button4_Click(object sender, EventArgs e) { OrderList.OrderService service = new OrderList.OrderService(); if (comboBox1.Text == "按订单号查找") { uint i = Convert.ToUInt32(textBox2.Text); string j = ""; foreach (OrderList.Order order in service.QueryByOrderId(i)) { j += order.ToString(); } textBox1.Text = j; } else if (comboBox1.Text == "按货物名查找") { string i = textBox2.Text; string j = ""; foreach (OrderList.Order order in service.QueryByGoodsName(i)) { j += order.ToString(); } textBox1.Text = j; } else if (comboBox1.Text == "按客户名查找") { string i = textBox2.Text; string j = ""; foreach (OrderList.Order order in service.QueryByCustomerName(i)) { j += order.ToString(); } textBox1.Text = j; } else if (comboBox1.Text == "按货物价格查找") { double p = Convert.ToDouble(textBox2.Text); string j = ""; foreach (OrderList.Order order in service.GetMyOrders(p)) { j += order.ToString(); } textBox1.Text = j; } else { service.QueryAllOrders(); } }
private void button1_Click(object sender, EventArgs e) { OrderList.Order order = new OrderList.Order(); OrderList.Goods good = new OrderList.Goods(); OrderList.OrderDetail detail = new OrderList.OrderDetail(); OrderList.Customer customer = new OrderList.Customer(); customer.Name = customerName; customer.Id = customerId; good.Name = goodsName; good.Id = goodsId; good.Price = price; detail.Quantity = quantity; detail.Goods = good; order.AddDetails(detail); order.Customer = customer; order.Id = i; OrderList.OrderService service = new OrderList.OrderService(); service.AddOrder(order); i++; DialogResult result = MessageBox.Show("订单添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }