private void button2_Click(object sender, EventArgs e) { if (FilterManager.GetOrderCount() == 0) { MessageBox.Show("没有可查询订单"); } else { MessageBox.Show("总共用了:" + FilterManager.GetOrder().Sum(x => x.orders.Sum(y => y.display_amount)) + "元"); } }
private void button1_Click_1(object sender, EventArgs e) { if (FilterManager.GetOrderCount() == 0) { MessageBox.Show("没有可导出订单"); } else { MessageBox.Show("订单数为:" + FilterManager.GetOrderCount() + "!正在执行Excel导出"); MessageBox.Show("总共用了:" + FilterManager.GetOrder().Sum(x => x.orders.Sum(y => y.display_amount)) + "元"); Thread.Sleep(2000); var dataList = FilterManager.GetOrder(); List <OrderItem> list = new List <OrderItem>(); foreach (var orderList in dataList) { foreach (var order in orderList.orders) { list.Add(order); } } ExportDataToExcel(ListToDt(list), DateTime.Now.ToString("yyyymmddHHmmss") + "pddorder"); } }