Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("请开始创建你的订单表:");
            while (OrderService.orderList.Count <= OrderService.orderList.Capacity)
            {
                OrderService.AddOrder();
                Console.WriteLine("按任意键继续,按esc键停止添加。\n");
                if (Console.ReadKey().Key == ConsoleKey.Escape)
                {
                    break;
                }
            }

            OrderService.findOrderByCustomerName();
            OrderService.DeleteOrder();
            OrderService.findOrderByOrderNum();
            OrderService.ChangeOrder();
            OrderService.AddOrder();
            OrderService.findOrderByProductName();
            OrderService.DeleteOrder();
            OrderService.findOrderByOrderCost();

            Console.WriteLine("按任意键退出...");
            Console.ReadKey();
        }
Exemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         OrderService.ChangeOrder(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text, obj);
         DialogResult result = MessageBox.Show("修改成功", "提醒", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
     }
     catch (Exception exception)
     {
         DialogResult result = MessageBox.Show(exception.Message, "提醒", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 3
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (isAdd)
         {
             if (IsRightOrderNum(currentOrder.num))
             {
                 OrderService.AddOrder(currentOrder);
                 MessageBox.Show("添加成功", "提醒", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 throw new Exception();
             }
         }
         else
         {
             if (IsRightOrderNum(currentOrder.num))
             {
                 OrderService.ChangeOrder(currentOrder);
                 MessageBox.Show("修改成功", "提醒", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 throw new Exception();
             }
         }
         this.Close();
     }
     catch
     {
         if (isAdd)
         {
             MessageBox.Show("添加失败", "提醒", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show("修改失败", "提醒", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }