private void button3_Click(object sender, EventArgs e) { Orderdata orderdata = new Orderdata(); Order del = orderBindingSource.Current as Order; orders.orderlist.Remove(del); orderdata.Deleteorder(del.orderid); orderBindingSource.ResetBindings(false); }
static void Main() { Orderdata orderdata = new Orderdata(); OrderService orderService = new OrderService(); orderdata.datatoclass(orderService); //orderService.listeach(o => Console.WriteLine(o.totalmoney())); /*for (int i = 0; or != null && i < or.Count; i++) * { * Console.WriteLine(or[i]); * }*/ //orderService.listeach(o=> Console.WriteLine(o)); //orderService.listeach(o => orderService.reviseorder(1,1,100)); //orderService.listeach(o => Console.WriteLine(o)); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1(orderService)); }
private void button1_Click(object sender, EventArgs e) { Orderdata orderdata = new Orderdata(); try { orderdata.Insertorder(user.Text, Service.orderlist.Count, DateTime.Now.ToLongDateString().ToString() + DateTime.Now.ToLongTimeString().ToString(), int.Parse(itid.Text), int.Parse(num.Text), name.Text, int.Parse(price.Text)); Service.addorder(Service.orderlist.Count, int.Parse(num.Text), name.Text, user.Text, int.Parse(price.Text), DateTime.Now.ToLongDateString().ToString() + DateTime.Now.ToLongTimeString().ToString(), int.Parse(itid.Text)); } catch { MessageBox.Show("非规范操作", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if ((int)MessageBox.Show("添加成功,是否要继续添加?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != 1) { this.Close(); } item.Add(new OrderItem(int.Parse(itid.Text), int.Parse(num.Text), int.Parse(price.Text), name.Text)); dataGridView1.DataSource = item; }