//查询订单 private void button1_Click_1(object sender, EventArgs e) { //bindingSerives.DataSource = service; mservice.mOrders.Clear(); Orders order; string str1 = textBox1.Text; string str2 = comboBox1.Text; bool isSeach = false; if (str2 == null || str1 == null) { MessageBox.Show("信息未输入"); return; } else if (str2 == "订单号") { for (int i = 0; i < service.mOrders.Count; i++) { order = service.mOrders[i]; if (order.orderNumber == str1) { mservice.AddOrders2(order); isSeach = true; } } if (isSeach == false) { MessageBox.Show("未找到订单"); } } else if (str2 == "姓名") { for (int i = 0; i < service.mOrders.Count; i++) { order = service.mOrders[i]; if (order.theCustomer == str1) { mservice.AddOrders2(order); isSeach = true; } } if (isSeach == false) { MessageBox.Show("未找到订单"); } } else { MessageBox.Show("未找到订单"); } bindingSerives.DataSource = mservice; }
private void AddService() { if (File.Exists(@"orders.xml")) { service = OrderService.Import(@"orders.xml"); } else { Orders order1 = new Orders("20181115001", "Tom", "13811111111"); order1.AddGood("Computer", 5000, 1); Orders order2 = new Orders("20181115002", "Jack", "15822222222"); order2.AddGood("HUAWEI honor10", 3000, 1); Orders order3 = new Orders("20181115003", "Fremont", "18900000000"); order3.AddGood("iWatch", 2000, 1); service.AddOrders2(order1); service.AddOrders2(order2); service.AddOrders2(order3); } }
private void AddService() { if (File.Exists(@"orders.xml")) { service = OrderService.Import(@"orders.xml"); } else { Orders order1 = new Orders("123456", "Tom"); order1.AddGood("电脑", 5000, 1); Orders order2 = new Orders("321654", "Jack"); order2.AddGood("华为honor10", 3000, 1); Orders order3 = new Orders("987654", "Fremont"); order3.AddGood("iWatch", 2000, 1); service.AddOrders2(order1); service.AddOrders2(order2); service.AddOrders2(order3); } }
private void AddService() { if (File.Exists(@"orders.xml")) { service = OrderService.Import(@"orders.xml"); } else { List <OrderDetails> details = new List <OrderDetails>() { new OrderDetails("apple2", 10.0, 20), new OrderDetails("egg3", 2.0, 100) }; Orders order = new Orders("20181129001", "jack", "13811111111", details); order.ReMoney(); service.AddOrders2(order); List <Orders> orders = service.mOrders; List <Orders> orders2 = service.mOrders; } }